Documentation
¶
Index ¶
- Variables
- func Exists(linkBehavior LinkTreatment, filename string) (bool, error)
- func ExitWithError(err error)
- func GetCurrentTimeFormatted() string
- func GetDefaultConfigPath() (string, error)
- func GetProcessName() string
- func GetProjectRoot() (string, error)
- func OutDir(path string) (string, error)
- func ReadDirNoStat(dirname string) ([]string, error)
- func SIGTERMExit()
- type LinkTreatment
- type Path
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
getProjectRoot returns the absolute path of the project root directory.
func OutDir ¶
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 ¶
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 (*Path) Index ¶
Index indicates that the previous Path is to be subscripted by an int. This sets the same underlying value as Key.