utils

package
v1.0.0-develop.21 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindFilesInDir

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

func GlobInDir

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

func GoModule

func GoModule(searchPath string) (string, error)

func NewNitricLogFile

func NewNitricLogFile(stackPath string) (string, error)

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

func NewNotSupportedErr

func NewNotSupportedErr(message string) error

func NewStringFileInfo

func NewStringFileInfo(fileName, content string) fs.FileInfo

func NitricConfigDir

func NitricConfigDir() string

NitricConfigDir returns the directory to find configuration.

func NitricLogDir

func NitricLogDir(stackPath string) string

NitricLogDir returns the directory to find log files.

func NitricRunDir

func NitricRunDir() string

NitricRunDir returns the directory to place runtime data.

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 Take

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

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

func ToStringMapStringMapStringE

func ToStringMapStringMapStringE(i interface{}) (map[string]map[string]interface{}, error)

Types

type ErrorList

type ErrorList struct {
	// contains filtered or unexported fields
}

ErrorList is for when one error is not the cause of others.

func NewErrorList

func NewErrorList() *ErrorList

func (*ErrorList) Add

func (e *ErrorList) Add(err error)

func (*ErrorList) Aggregate

func (e *ErrorList) Aggregate() error

func (*ErrorList) Error

func (e *ErrorList) Error() string

func (*ErrorList) WithSubject

func (e *ErrorList) WithSubject(subject string) *ErrorList

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

type NotSupportedError

type NotSupportedError struct {
	// contains filtered or unexported fields
}

NotSupportedError indicates that a request operation cannot be performed, because it is unsupported. Functions and methods should not return this error but should instead return an error including appropriate context that satisfies

errors.Is(err, errors.NotSupportedError)

either by directly wrapping NotSupportedError or by implementing an Is method.

func (*NotSupportedError) Is

func (*NotSupportedError) Is(err error) bool

Jump to

Keyboard shortcuts

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