MCPcopy Index your code
hub / github.com/docker/docker-agent / mtimeOf

Function mtimeOf

pkg/cache/cache.go:284–289  ·  view source on GitHub ↗

mtimeOf returns the file modification time at path, or the zero value if path doesn't exist or can't be stat'd. The zero value (time.Time{}) is a sentinel meaning "file not found" and is safe to compare via [time.Time.Equal] in [Cache.maybeReload]: it will never equal a real mtime, so the reload wi

(path string)

Source from the content-addressed store, hash-verified

282// and is safe to compare via [time.Time.Equal] in [Cache.maybeReload]: it
283// will never equal a real mtime, so the reload will proceed as expected.
284func mtimeOf(path string) time.Time {
285 if info, err := os.Stat(path); err == nil {
286 return info.ModTime()
287 }
288 return time.Time{}
289}
290
291// lockFile takes an exclusive advisory lock on "<path>.lock", creating
292// the lock file (and any missing parent directory) if needed. The

Callers 2

NewFunction · 0.85
persistToDiskMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected