Documentation
¶
Index ¶
- func AtomicCreateFile(path string) (bool, error)
- func CleanupOldFiles(dir, pattern string, maxAge int64) error
- func CurrentTimestamp() int64
- func ExpandEnv(s string) string
- func FileAge(path string) int64
- func FileExists(path string) bool
- func FileMTime(path string) int64
- func GetGitBranch(cwd string) string
- func IsLinux() bool
- func IsMacOS() bool
- func IsWindows() bool
- func NormalizePath(path string) string
- func OS() string
- func SetDetachedProcAttr(cmd *exec.Cmd)
- func TempDir() string
- type GitMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicCreateFile ¶
AtomicCreateFile creates a file atomically using O_EXCL flag Returns true if file was created, false if it already exists
func CleanupOldFiles ¶
CleanupOldFiles removes files older than maxAge seconds matching a pattern
func CurrentTimestamp ¶
func CurrentTimestamp() int64
CurrentTimestamp returns the current Unix timestamp
func FileMTime ¶
FileMTime returns the modification time of a file as Unix timestamp Returns 0 if the file doesn't exist or on error
func GetGitBranch ¶
GetGitBranch returns the current git branch name for the given directory. Returns empty string if not in a git repository or on error.
func NormalizePath ¶
NormalizePath normalizes a file path (removes double slashes, etc.)
func SetDetachedProcAttr ¶
SetDetachedProcAttr configures the command to run as a detached process on Unix. Setpgid creates a new process group so the child survives parent exit.
Types ¶
type GitMetadata ¶
type GitMetadata struct {
Branch string
CommitHash string
CommitShortHash string
CommitAuthorName string
CommitAuthorEmail string
UserName string
UserEmail string
}
GitMetadata contains commonly requested git values for a working tree.
func GetGitMetadata ¶
func GetGitMetadata(cwd string) GitMetadata
GetGitMetadata returns commonly used git metadata for the given directory. Empty fields indicate the directory is not a git repo or the value is unavailable.