Documentation
¶
Overview ¶
Package env describes the machine environment the tool runs in.
Index ¶
Constants ¶
const AppName = "dustpan"
AppName is the only place the product name lives.
Variables ¶
var Version = "dev"
Version is set via -ldflags "-X .../internal/env.Version=...". Use VersionString to read it.
Functions ¶
func VersionString ¶
func VersionString() string
VersionString returns the build's version: the -ldflags value if one was set, otherwise the module version Go records for `go install ...@vX.Y.Z`, otherwise "dev".
Types ¶
type Env ¶
type Env struct {
Home string
StateDir string
ConfigDir string
TmpDirs []string
JobDir string
UID int
Now func() time.Time
}
Env holds the locations and clock the rest of the program depends on.
func (Env) Canon ¶
Canon returns the cleaned absolute path with symlinks resolved on its longest existing ancestor; the non-existing remainder is appended unchanged. It never fails: if nothing resolves it returns the cleaned path.
func (Env) CanonParent ¶
CanonParent canonicalizes the parent directory of path and appends the final component unchanged, so the item itself is never dereferenced: a symlink stays a symlink rather than becoming its target.
func (Env) EnsureStateDir ¶
EnsureStateDir creates the state directory with mode 0700.