diff --git a/builder/remotecontext/lazycontext.go b/builder/remotecontext/lazycontext.go index 96435f2585..5866c7473d 100644 --- a/builder/remotecontext/lazycontext.go +++ b/builder/remotecontext/lazycontext.go @@ -3,6 +3,7 @@ package remotecontext // import "github.com/docker/docker/builder/remotecontext" import ( "encoding/hex" "os" + "runtime" "strings" "github.com/docker/docker/builder" @@ -88,7 +89,7 @@ func (c *lazySource) prepareHash(relPath string, fi os.FileInfo) (string, error) // handle UUID paths in windows. func Rel(basepath containerfs.ContainerFS, targpath string) (string, error) { // filepath.Rel can't handle UUID paths in windows - if basepath.OS() == "windows" { + if runtime.GOOS == "windows" { pfx := basepath.Path() + `\` if strings.HasPrefix(targpath, pfx) { p := strings.TrimPrefix(targpath, pfx) diff --git a/pkg/containerfs/archiver.go b/pkg/containerfs/archiver.go index d5f153b373..23e076514e 100644 --- a/pkg/containerfs/archiver.go +++ b/pkg/containerfs/archiver.go @@ -6,6 +6,7 @@ import ( "io" "os" "path/filepath" + "runtime" "time" "github.com/docker/docker/pkg/archive" @@ -109,7 +110,7 @@ func (archiver *Archiver) CopyFileWithTar(src, dst string) (retErr error) { // The original call was system.MkdirAll, which is just // os.MkdirAll on not-Windows and changed for Windows. - if dstDriver.OS() == "windows" { + if runtime.GOOS == "windows" { // Now we are WCOW if err := system.MkdirAll(filepath.Dir(dst), 0700); err != nil { return err @@ -144,7 +145,7 @@ func (archiver *Archiver) CopyFileWithTar(src, dst string) (retErr error) { hdr.AccessTime = time.Time{} hdr.ChangeTime = time.Time{} hdr.Name = dstDriver.Base(dst) - if dstDriver.OS() == "windows" { + if runtime.GOOS == "windows" { hdr.Mode = int64(chmodTarEntry(os.FileMode(hdr.Mode))) } else { hdr.Mode = int64(os.FileMode(hdr.Mode)) diff --git a/pkg/containerfs/containerfs.go b/pkg/containerfs/containerfs.go index cf2d39c82e..77dcaac60b 100644 --- a/pkg/containerfs/containerfs.go +++ b/pkg/containerfs/containerfs.go @@ -2,7 +2,6 @@ package containerfs // import "github.com/docker/docker/pkg/containerfs" import ( "path/filepath" - "runtime" "github.com/containerd/continuity/driver" "github.com/containerd/continuity/pathdriver" @@ -28,13 +27,6 @@ type ContainerFS interface { // Driver combines both continuity's Driver and PathDriver interfaces with a Platform // field to determine the OS. type Driver interface { - // OS returns the OS where the rootfs is located. Essentially, runtime.GOOS. - OS() string - - // Architecture returns the hardware architecture where the - // container is located. - Architecture() string - // Driver & PathDriver provide methods to manipulate files & paths driver.Driver pathdriver.PathDriver @@ -76,11 +68,3 @@ func (l *local) ResolveScopedPath(path string, rawPath bool) (string, error) { } return symlink.FollowSymlinkInScope(filepath.Join(l.path, cleanedPath), l.path) } - -func (l *local) OS() string { - return runtime.GOOS -} - -func (l *local) Architecture() string { - return runtime.GOARCH -}