util

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNewStringsToStringArray added in v1.2.0

func AddNewStringsToStringArray(list []string, elmsToAdd ...string) []string

func CopyFileIntoTar added in v1.2.2

func CopyFileIntoTar(tw *tar.Writer, tarEntryName string, filePath string) error

func CopyGitIndexEntryIntoTar added in v1.2.2

func CopyGitIndexEntryIntoTar(tw *tar.Writer, tarEntryName string, entry *index.Entry, obj plumbing.EncodedObject) error

func CreateArchive added in v1.2.2

func CreateArchive(archivePath string, f func(tw *tar.Writer) error) error

func CreateArchiveBasedOnAnotherOne added in v1.2.2

func CreateArchiveBasedOnAnotherOne(ctx context.Context, sourceArchivePath, destinationArchivePath string, pathsToExclude []string, f func(tw *tar.Writer) error) error

func DirExists

func DirExists(path string) (bool, error)

func DumpYaml

func DumpYaml(v interface{}) string

func ExcludeFromStringArray added in v1.2.0

func ExcludeFromStringArray(list []string, elmsToRemove ...string) []string

func ExpandPath

func ExpandPath(path string) string

func FileExists

func FileExists(path string) (bool, error)

FileExists returns true if path exists

func GenerateConsistentRandomString

func GenerateConsistentRandomString(n int) string

func GetAbsoluteFilepath added in v1.2.5

func GetAbsoluteFilepath(absOrRelPath string) string

func GetRelativeToBaseFilepath added in v1.2.1

func GetRelativeToBaseFilepath(base, path string) string

func GlobPrefixWithoutPatterns added in v1.2.7

func GlobPrefixWithoutPatterns(glob string) (string, string)

GlobPrefixWithoutPatterns figures out how many components we don't need to glob because they're just names without patterns

func InterfaceArrayToStringArray

func InterfaceArrayToStringArray(array []interface{}) ([]string, error)

func InterfaceToMapStringInterface

func InterfaceToMapStringInterface(value interface{}) (map[string]interface{}, error)

func InterfaceToStringArray

func InterfaceToStringArray(value interface{}) ([]string, error)

func IsNotADirectoryError

func IsNotADirectoryError(err error) bool

func IsStringsContainValue

func IsStringsContainValue(arr []string, value string) bool

func IsSubpathOfBasePath added in v1.1.30

func IsSubpathOfBasePath(basePath, path string) bool

func MapLoadOrCreateMutex added in v1.2.11

func MapLoadOrCreateMutex(m *sync.Map, key string) *sync.Mutex

func MapMustLoad added in v1.2.11

func MapMustLoad(m *sync.Map, key string) interface{}

func MapStringInterfaceToMapStringString added in v1.1.23

func MapStringInterfaceToMapStringString(value map[string]interface{}) map[string]string

func MurmurHash

func MurmurHash(args ...string) string

func NumerateLines

func NumerateLines(text string, firstLineNumber int) string

func RegularFileExists added in v1.2.2

func RegularFileExists(path string) (bool, error)

func RejectEmptyStrings

func RejectEmptyStrings(arr []string) []string

func RemoveHostDirsWithLinuxContainer

func RemoveHostDirsWithLinuxContainer(ctx context.Context, mountDir string, dirs []string) error

func Reverse added in v1.2.5

func Reverse(s string) string

func Sha256Hash

func Sha256Hash(args ...string) string

func Sha3_224Hash

func Sha3_224Hash(args ...string) string

func SplitFilepath

func SplitFilepath(path string) (result []string)

func ToLinuxContainerPath

func ToLinuxContainerPath(path string) string

func UniqAppendString

func UniqAppendString(arr []string, value string) []string

func UniqStrings

func UniqStrings(arr []string) []string

Types

type GoroutineSafeBuffer added in v1.2.11

type GoroutineSafeBuffer struct {
	*bytes.Buffer
	// contains filtered or unexported fields
}

func (*GoroutineSafeBuffer) Bytes added in v1.2.11

func (b *GoroutineSafeBuffer) Bytes() []byte

func (*GoroutineSafeBuffer) Cap added in v1.2.11

func (b *GoroutineSafeBuffer) Cap() int

func (*GoroutineSafeBuffer) Grow added in v1.2.11

func (b *GoroutineSafeBuffer) Grow(n int)

func (*GoroutineSafeBuffer) Len added in v1.2.11

func (b *GoroutineSafeBuffer) Len() int

func (*GoroutineSafeBuffer) Next added in v1.2.11

func (b *GoroutineSafeBuffer) Next(n int) []byte

func (*GoroutineSafeBuffer) Read added in v1.2.11

func (b *GoroutineSafeBuffer) Read(p []byte) (n int, err error)

func (*GoroutineSafeBuffer) ReadByte added in v1.2.11

func (b *GoroutineSafeBuffer) ReadByte() (c byte, err error)

func (*GoroutineSafeBuffer) ReadBytes added in v1.2.11

func (b *GoroutineSafeBuffer) ReadBytes(delim byte) (line []byte, err error)

func (*GoroutineSafeBuffer) ReadFrom added in v1.2.11

func (b *GoroutineSafeBuffer) ReadFrom(r io.Reader) (n int64, err error)

func (*GoroutineSafeBuffer) ReadRune added in v1.2.11

func (b *GoroutineSafeBuffer) ReadRune() (r rune, size int, err error)

func (*GoroutineSafeBuffer) ReadString added in v1.2.11

func (b *GoroutineSafeBuffer) ReadString(delim byte) (line string, err error)

func (*GoroutineSafeBuffer) Reset added in v1.2.11

func (b *GoroutineSafeBuffer) Reset()

func (*GoroutineSafeBuffer) String added in v1.2.11

func (b *GoroutineSafeBuffer) String() string

func (*GoroutineSafeBuffer) Truncate added in v1.2.11

func (b *GoroutineSafeBuffer) Truncate(n int)

func (*GoroutineSafeBuffer) UnreadByte added in v1.2.11

func (b *GoroutineSafeBuffer) UnreadByte() error

func (*GoroutineSafeBuffer) UnreadRune added in v1.2.11

func (b *GoroutineSafeBuffer) UnreadRune() error

func (*GoroutineSafeBuffer) Write added in v1.2.11

func (b *GoroutineSafeBuffer) Write(p []byte) (n int, err error)

func (*GoroutineSafeBuffer) WriteByte added in v1.2.11

func (b *GoroutineSafeBuffer) WriteByte(c byte) error

func (*GoroutineSafeBuffer) WriteRune added in v1.2.11

func (b *GoroutineSafeBuffer) WriteRune(r rune) (n int, err error)

func (*GoroutineSafeBuffer) WriteString added in v1.2.11

func (b *GoroutineSafeBuffer) WriteString(s string) (n int, err error)

func (*GoroutineSafeBuffer) WriteTo added in v1.2.11

func (b *GoroutineSafeBuffer) WriteTo(w io.Writer) (n int64, err error)

type SerializableError added in v1.1.21

type SerializableError struct {
	Error error
}

func (SerializableError) MarshalJSON added in v1.1.21

func (obj SerializableError) MarshalJSON() ([]byte, error)

func (*SerializableError) UnmarshalJSON added in v1.1.21

func (obj *SerializableError) UnmarshalJSON(data []byte) error

type Stack

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

func NewStack

func NewStack() *Stack

Create a new stack

func (*Stack) Len

func (this *Stack) Len() int

Return the number of items in the stack

func (*Stack) Peek

func (this *Stack) Peek() interface{}

View the top item on the stack

func (*Stack) Pop

func (this *Stack) Pop() interface{}

Pop the top item of the stack and return it

func (*Stack) Push

func (this *Stack) Push(value interface{})

Push a value onto the top of the stack

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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