field

package
v0.0.46 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLinkTreatment = errors.New("unknown link behavior")

ErrInvalidLinkTreatment indicates that the link treatment behavior requested is not a valid behavior.

Functions

func Exists

func Exists(linkBehavior LinkTreatment, filename string) (bool, error)

Exists checks if specified file, directory, or symlink exists. The behavior of the test depends on the linkBehaviour argument. See LinkTreatment for more details.

func ExitWithError

func ExitWithError(err error)

func GetCurrentTimeFormatted

func GetCurrentTimeFormatted() string

func GetDefaultConfigPath

func GetDefaultConfigPath() (string, error)

return absolude path join ../config/, this is k8s container config path.

func GetProcessName

func GetProcessName() string

GetProcessName retrieves the name of the currently running process. It achieves this by parsing os.Args[0], which typically contains the full path to the program. If os.Args[0] is empty or unset for some reason, the function returns an empty string. Note: This function assumes that os.Args contains at least the program name. This is a safe assumption under normal circumstances.

func GetProjectRoot

func GetProjectRoot() (string, error)

getProjectRoot returns the absolute path of the project root directory.

func OutDir

func OutDir(path string) (string, error)

OutDir creates the absolute path name from path and checks if the path exists and is a directory. Returns absolute path including trailing '/' or error if the path does not exist or is not a directory.

func ReadDirNoStat

func ReadDirNoStat(dirname string) ([]string, error)

ReadDirNoStat returns a string of files/directories contained in dirname without calling lstat on them.

func SIGTERMExit

func SIGTERMExit()

Types

type LinkTreatment

type LinkTreatment int

LinkTreatment is the base type for constants used by Exists that indicate how symlinks are treated for existence checks.

const (
	// CheckFollowSymlink follows the symlink and verifies that the target of
	// the symlink exists.
	CheckFollowSymlink LinkTreatment = iota

	// CheckSymlinkOnly does not follow the symlink and verifies only that they
	// symlink itself exists.
	CheckSymlinkOnly
)

type Path

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

Path represents the path from some root to a particular field.

func NewPath

func NewPath(name string, moreNames ...string) *Path

NewPath creates a root Path object.

func (*Path) Child

func (p *Path) Child(name string, moreNames ...string) *Path

Child creates a new Path that is a child of the method receiver.

func (*Path) Index

func (p *Path) Index(index int) *Path

Index indicates that the previous Path is to be subscripted by an int. This sets the same underlying value as Key.

func (*Path) Key

func (p *Path) Key(key string) *Path

Key indicates that the previous Path is to be subscripted by a string. This sets the same underlying value as Index.

func (*Path) Root

func (p *Path) Root() *Path

Root returns the root element of this Path.

func (*Path) String

func (p *Path) String() string

String produces a string representation of the Path.

Jump to

Keyboard shortcuts

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