utils

package
v1.28.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Raw is the string representation of the version. This will be replaced
	// with the calculated version at build time.
	// set in the Makefile.
	Version = "was not built with version info"

	// Commit is the commit hash from which the software was built.
	// Set via LDFLAGS in Makefile.
	Commit = "unknown"

	// BuildTime is the string representation of build time.
	// Set via LDFLAGS in Makefile.
	BuildTime = "unknown"
)

Functions

func CheckErr added in v1.23.0

func CheckErr(err error)

func DirWritable added in v1.14.0

func DirWritable(path string) bool

func FilesExisting added in v1.3.0

func FilesExisting(files ...string) []string

func FindFilesInDir

func FindFilesInDir(dir string, name string) ([]string, error)

func FormatProjectName added in v1.19.0

func FormatProjectName(projectName string) string

func GetInterfaceIpv4Addr added in v1.4.0

func GetInterfaceIpv4Addr(interfaceName string) (string, error)

func GetNextListener added in v1.14.1

func GetNextListener(opts ...getNextListenerOption) (net.Listener, error)

GetNextListener - Gets the next available free port starting from a predefined minimum port Up to a pre-defined maximum port

func GlobInDir

func GlobInDir(dir, pattern string) ([]string, error)

func GoPath added in v1.4.0

func GoPath() (string, error)

func JoinCamelCase added in v1.1.0

func JoinCamelCase(ss []string) string

func MaxPort added in v1.14.1

func MaxPort(maxPort int) getNextListenerOption

func MinPort added in v1.14.1

func MinPort(minPort int) getNextListenerOption

func NewIncompatibleWorkerError added in v1.19.0

func NewIncompatibleWorkerError() error

func NewNitricLogFile

func NewNitricLogFile(stackPath string) (string, error)

NewNitricLogFile returns a path to a unique log file that does not exist.

func NitricConfigDir

func NitricConfigDir() string

NitricConfigDir returns the directory to find configuration.

func NitricHistoryFile added in v1.19.0

func NitricHistoryFile(stackPath string, historyType string) (string, error)

NitricHistoryFile returns a path to a request history file, making one if it doesn't exist

func NitricHomeDir added in v1.6.0

func NitricHomeDir() string

NitricHomeDir gets the nitric home directory

func NitricLocalPassphrasePath added in v1.7.0

func NitricLocalPassphrasePath() string

func NitricLogDir

func NitricLogDir(stackPath string) string

NitricLogDir returns the directory to find log files.

func NitricPreferencesPath added in v1.5.0

func NitricPreferencesPath() string

func NitricProviderDir added in v1.16.0

func NitricProviderDir() string

NitricProviderDir returns the directory to place provider deployment binaries.

func NitricRunDir

func NitricRunDir() string

NitricRunDir returns the directory to place runtime data.

func NitricStacksDir added in v1.6.0

func NitricStacksDir() (string, error)

func NitricTemplatesDir

func NitricTemplatesDir() string

NitricTemplatesDir returns the directory to place template related data.

func SplitPath

func SplitPath(p string) []string

SplitPath - splits a path into its component parts, ignoring leading or trailing slashes. e.g - SplitPath("/one/two/three/") == SplitPath("/one/two/three") == SplitPath("one/two/three") == ["one" "two" "three"]

func StringTrunc added in v1.1.0

func StringTrunc(s string, max int) string

func Take

func Take(n int) ([]int, error)

Take is just a wrapper around freeport.Take() that changes the stderr output to pterm.Debug

Types

type GetterClient

type GetterClient interface {
	Get() error
}

GetterClient exists because go-getter does not have an interface to mock.

func NewGetter

func NewGetter(c *getter.Client) GetterClient

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL