ソースを参照

pkg/system: move CheckSystemDriveAndRemoveDriveLetter to pkg/archive

This one is a "bit" fuzzy, as it may not be _directly_ related to `archive`,
but it's always used _in combination_ with the archive package, so moving it
there.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 年 前
コミット
fb77973201

+ 2 - 3
container/archive_windows.go

@@ -6,7 +6,6 @@ import (
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/pkg/archive"
-	"github.com/docker/docker/pkg/system"
 	"github.com/pkg/errors"
 )
 
@@ -18,8 +17,8 @@ func (container *Container) ResolvePath(path string) (resolvedPath, absPath stri
 	if container.BaseFS == "" {
 		return "", "", errors.New("ResolvePath: BaseFS of container " + container.ID + " is unexpectedly empty")
 	}
-	// Check if a drive letter supplied, it must be the system drive.
-	path, err = system.CheckSystemDriveAndRemoveDriveLetter(path)
+	// Check if a drive letter supplied, it must be the system drive. No-op except on Windows
+	path, err = archive.CheckSystemDriveAndRemoveDriveLetter(path)
 	if err != nil {
 		return "", "", err
 	}

+ 1 - 2
daemon/archive_windows.go

@@ -14,7 +14,6 @@ import (
 	"github.com/docker/docker/pkg/archive"
 	"github.com/docker/docker/pkg/chrootarchive"
 	"github.com/docker/docker/pkg/ioutils"
-	"github.com/docker/docker/pkg/system"
 )
 
 // containerStatPath stats the filesystem resource at the specified path in this
@@ -172,7 +171,7 @@ func (daemon *Daemon) containerExtractToDir(container *container.Container, path
 	path = filepath.FromSlash(path)
 
 	// Check if a drive letter supplied, it must be the system drive. No-op except on Windows
-	path, err = system.CheckSystemDriveAndRemoveDriveLetter(path)
+	path, err = archive.CheckSystemDriveAndRemoveDriveLetter(path)
 	if err != nil {
 		return err
 	}

+ 1 - 1
pkg/system/path.go → pkg/archive/path.go

@@ -1,4 +1,4 @@
-package system // import "github.com/docker/docker/pkg/system"
+package archive
 
 // CheckSystemDriveAndRemoveDriveLetter verifies that a path, if it includes a drive letter,
 // is the system drive.

+ 1 - 1
pkg/system/path_unix.go → pkg/archive/path_unix.go

@@ -1,7 +1,7 @@
 //go:build !windows
 // +build !windows
 
-package system // import "github.com/docker/docker/pkg/system"
+package archive
 
 // checkSystemDriveAndRemoveDriveLetter is the non-Windows implementation
 // of CheckSystemDriveAndRemoveDriveLetter

+ 1 - 1
pkg/system/path_windows.go → pkg/archive/path_windows.go

@@ -1,4 +1,4 @@
-package system // import "github.com/docker/docker/pkg/system"
+package archive
 
 import (
 	"fmt"

+ 1 - 4
pkg/system/path_windows_test.go → pkg/archive/path_windows_test.go

@@ -1,7 +1,4 @@
-//go:build windows
-// +build windows
-
-package system // import "github.com/docker/docker/pkg/system"
+package archive
 
 import (
 	"testing"