diff --git a/executor/stubs.go b/executor/stubs.go index e85f10fed3df..5ea4f5edd192 100644 --- a/executor/stubs.go +++ b/executor/stubs.go @@ -10,7 +10,6 @@ import ( "github.com/containerd/continuity/fs" "github.com/moby/buildkit/util/bklog" - "github.com/moby/buildkit/util/system" ) func MountStubsCleaner(ctx context.Context, dir string, mounts []Mount, recursive bool) func() { @@ -87,7 +86,7 @@ func MountStubsCleaner(ctx context.Context, dir string, mounts []Mount, recursiv continue } mtime := dirSt.ModTime() - atime, err := system.Atime(dirSt) + atime, err := fs.Atime(dirSt) if err != nil { bklog.G(ctx).WithError(err).Warnf("Failed to stat atime of %q (parent of mount stub %q)", dir, p) atime = mtime diff --git a/util/system/atime_deprecated.go b/util/system/atime_deprecated.go new file mode 100644 index 000000000000..6a11546087e7 --- /dev/null +++ b/util/system/atime_deprecated.go @@ -0,0 +1,13 @@ +package system + +import ( + iofs "io/fs" + "time" + + "github.com/containerd/continuity/fs" +) + +// Deprecated: use [fs.Atime] instead. +func Atime(st iofs.FileInfo) (time.Time, error) { + return fs.Atime(st) +} diff --git a/util/system/atime_unix.go b/util/system/atime_unix.go deleted file mode 100644 index 9a7af36ffcc6..000000000000 --- a/util/system/atime_unix.go +++ /dev/null @@ -1,21 +0,0 @@ -//go:build !windows -// +build !windows - -package system - -import ( - iofs "io/fs" - "syscall" - "time" - - "github.com/containerd/continuity/fs" - "github.com/pkg/errors" -) - -func Atime(st iofs.FileInfo) (time.Time, error) { - stSys, ok := st.Sys().(*syscall.Stat_t) - if !ok { - return time.Time{}, errors.Errorf("expected st.Sys() to be *syscall.Stat_t, got %T", st.Sys()) - } - return fs.StatATimeAsTime(stSys), nil -} diff --git a/util/system/atime_windows.go b/util/system/atime_windows.go deleted file mode 100644 index cd5190fceb4c..000000000000 --- a/util/system/atime_windows.go +++ /dev/null @@ -1,18 +0,0 @@ -package system - -import ( - iofs "io/fs" - "syscall" - "time" - - "github.com/pkg/errors" -) - -func Atime(st iofs.FileInfo) (time.Time, error) { - stSys, ok := st.Sys().(*syscall.Win32FileAttributeData) - if !ok { - return time.Time{}, errors.Errorf("expected st.Sys() to be *syscall.Win32FileAttributeData, got %T", st.Sys()) - } - // ref: https://github.com/golang/go/blob/go1.19.2/src/os/types_windows.go#L230 - return time.Unix(0, stSys.LastAccessTime.Nanoseconds()), nil -}