mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
4f8c870d62
These showed locally when running `make validate`. CI doesn't seem to have the
same (possibly it's disabled in the configuration)
builder/fscache/fscache.go:618::error: github.com/docker/docker/vendor/github.com/tonistiigi/fsutil.StatInfo composite literal uses unkeyed fields (vet)
client/swarm_unlock_test.go:44::error: github.com/docker/docker/api/types/swarm.UnlockRequest composite literal uses unkeyed fields (vet)
client/swarm_unlock_test.go:20::error: github.com/docker/docker/api/types/swarm.UnlockRequest composite literal uses unkeyed fields (vet)
cmd/dockerd/daemon_unix.go:113::error: github.com/docker/docker/cmd/dockerd/hack.MalformedHostHeaderOverride composite literal uses unkeyed fields (vet)
cmd/dockerd/daemon_unix.go:110::error: github.com/docker/docker/cmd/dockerd/hack.MalformedHostHeaderOverride composite literal uses unkeyed fields (vet)
daemon/graphdriver/overlay/overlay.go:171::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
daemon/graphdriver/overlay/overlay.go:413::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
daemon/graphdriver/overlay2/overlay.go:203::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
daemon/graphdriver/overlay2/overlay.go:584::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
daemon/graphdriver/zfs/zfs.go:109::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
daemon/graphdriver/zfs/zfs.go:388::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
daemon/volumes_windows.go:27::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
integration/service/network_test.go:31::error: github.com/docker/docker/api/types/network.NetworkingConfig composite literal uses unkeyed fields (vet)
api/server/server.go:129:10⚠️ should not use basic type string as key in context.WithValue (golint)
integration/service/network_test.go:54::error: github.com/docker/docker/api/types/network.NetworkingConfig composite literal uses unkeyed fields (vet)
libcontainerd/client_daemon_linux.go:61::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
libcontainerd/client_daemon_linux.go:74::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
pkg/archive/archive_windows.go:76::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
plugin/manager_linux.go:56::error: github.com/docker/docker/pkg/idtools.IDPair composite literal uses unkeyed fields (vet)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
77 lines
2.5 KiB
Go
77 lines
2.5 KiB
Go
package archive // import "github.com/docker/docker/pkg/archive"
|
|
|
|
import (
|
|
"archive/tar"
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"github.com/docker/docker/pkg/idtools"
|
|
"github.com/docker/docker/pkg/longpath"
|
|
)
|
|
|
|
// fixVolumePathPrefix does platform specific processing to ensure that if
|
|
// the path being passed in is not in a volume path format, convert it to one.
|
|
func fixVolumePathPrefix(srcPath string) string {
|
|
return longpath.AddPrefix(srcPath)
|
|
}
|
|
|
|
// getWalkRoot calculates the root path when performing a TarWithOptions.
|
|
// We use a separate function as this is platform specific.
|
|
func getWalkRoot(srcPath string, include string) string {
|
|
return filepath.Join(srcPath, include)
|
|
}
|
|
|
|
// CanonicalTarNameForPath returns platform-specific filepath
|
|
// to canonical posix-style path for tar archival. p is relative
|
|
// path.
|
|
func CanonicalTarNameForPath(p string) (string, error) {
|
|
// windows: convert windows style relative path with backslashes
|
|
// into forward slashes. Since windows does not allow '/' or '\'
|
|
// in file names, it is mostly safe to replace however we must
|
|
// check just in case
|
|
if strings.Contains(p, "/") {
|
|
return "", fmt.Errorf("Windows path contains forward slash: %s", p)
|
|
}
|
|
return strings.Replace(p, string(os.PathSeparator), "/", -1), nil
|
|
|
|
}
|
|
|
|
// chmodTarEntry is used to adjust the file permissions used in tar header based
|
|
// on the platform the archival is done.
|
|
func chmodTarEntry(perm os.FileMode) os.FileMode {
|
|
//perm &= 0755 // this 0-ed out tar flags (like link, regular file, directory marker etc.)
|
|
permPart := perm & os.ModePerm
|
|
noPermPart := perm &^ os.ModePerm
|
|
// Add the x bit: make everything +x from windows
|
|
permPart |= 0111
|
|
permPart &= 0755
|
|
|
|
return noPermPart | permPart
|
|
}
|
|
|
|
func setHeaderForSpecialDevice(hdr *tar.Header, name string, stat interface{}) (err error) {
|
|
// do nothing. no notion of Rdev, Nlink in stat on Windows
|
|
return
|
|
}
|
|
|
|
func getInodeFromStat(stat interface{}) (inode uint64, err error) {
|
|
// do nothing. no notion of Inode in stat on Windows
|
|
return
|
|
}
|
|
|
|
// handleTarTypeBlockCharFifo is an OS-specific helper function used by
|
|
// createTarFile to handle the following types of header: Block; Char; Fifo
|
|
func handleTarTypeBlockCharFifo(hdr *tar.Header, path string) error {
|
|
return nil
|
|
}
|
|
|
|
func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo) error {
|
|
return nil
|
|
}
|
|
|
|
func getFileUIDGID(stat interface{}) (idtools.IDPair, error) {
|
|
// no notion of file ownership mapping yet on Windows
|
|
return idtools.IDPair{UID: 0, GID: 0}, nil
|
|
}
|