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:warning: 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>
| ... | ... |
@@ -126,7 +126,11 @@ func (s *Server) makeHTTPHandler(handler httputils.APIFunc) http.HandlerFunc {
|
| 126 | 126 |
// apply to all requests. Data that is specific to the |
| 127 | 127 |
// immediate function being called should still be passed |
| 128 | 128 |
// as 'args' on the function call. |
| 129 |
- ctx := context.WithValue(context.Background(), dockerversion.UAStringKey, r.Header.Get("User-Agent"))
|
|
| 129 |
+ |
|
| 130 |
+ // use intermediate variable to prevent "should not use basic type |
|
| 131 |
+ // string as key in context.WithValue" golint errors |
|
| 132 |
+ var ki interface{} = dockerversion.UAStringKey
|
|
| 133 |
+ ctx := context.WithValue(context.Background(), ki, r.Header.Get("User-Agent"))
|
|
| 130 | 134 |
handlerFunc := s.handlerWithGlobalMiddlewares(handler) |
| 131 | 135 |
|
| 132 | 136 |
vars := mux.Vars(r) |
| ... | ... |
@@ -615,7 +615,7 @@ func (s sortableCacheSources) Swap(i, j int) {
|
| 615 | 615 |
} |
| 616 | 616 |
|
| 617 | 617 |
func newTarsumHash(stat *fsutil.Stat) (hash.Hash, error) {
|
| 618 |
- fi := &fsutil.StatInfo{stat}
|
|
| 618 |
+ fi := &fsutil.StatInfo{Stat: stat}
|
|
| 619 | 619 |
p := stat.Path |
| 620 | 620 |
if fi.IsDir() {
|
| 621 | 621 |
p += string(os.PathSeparator) |
| ... | ... |
@@ -17,7 +17,7 @@ func TestSwarmUnlockError(t *testing.T) {
|
| 17 | 17 |
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")), |
| 18 | 18 |
} |
| 19 | 19 |
|
| 20 |
- err := client.SwarmUnlock(context.Background(), swarm.UnlockRequest{"SWMKEY-1-y6guTZNTwpQeTL5RhUfOsdBdXoQjiB2GADHSRJvbXeU"})
|
|
| 20 |
+ err := client.SwarmUnlock(context.Background(), swarm.UnlockRequest{UnlockKey: "SWMKEY-1-y6guTZNTwpQeTL5RhUfOsdBdXoQjiB2GADHSRJvbXeU"})
|
|
| 21 | 21 |
if err == nil || err.Error() != "Error response from daemon: Server error" {
|
| 22 | 22 |
t.Fatalf("expected a Server Error, got %v", err)
|
| 23 | 23 |
} |
| ... | ... |
@@ -41,7 +41,7 @@ func TestSwarmUnlock(t *testing.T) {
|
| 41 | 41 |
}), |
| 42 | 42 |
} |
| 43 | 43 |
|
| 44 |
- err := client.SwarmUnlock(context.Background(), swarm.UnlockRequest{"SWMKEY-1-y6guTZNTwpQeTL5RhUfOsdBdXoQjiB2GADHSRJvbXeU"})
|
|
| 44 |
+ err := client.SwarmUnlock(context.Background(), swarm.UnlockRequest{UnlockKey: "SWMKEY-1-y6guTZNTwpQeTL5RhUfOsdBdXoQjiB2GADHSRJvbXeU"})
|
|
| 45 | 45 |
if err != nil {
|
| 46 | 46 |
t.Fatal(err) |
| 47 | 47 |
} |
| ... | ... |
@@ -107,10 +107,10 @@ func allocateDaemonPort(addr string) error {
|
| 107 | 107 |
func wrapListeners(proto string, ls []net.Listener) []net.Listener {
|
| 108 | 108 |
switch proto {
|
| 109 | 109 |
case "unix": |
| 110 |
- ls[0] = &hack.MalformedHostHeaderOverride{ls[0]}
|
|
| 110 |
+ ls[0] = &hack.MalformedHostHeaderOverride{Listener: ls[0]}
|
|
| 111 | 111 |
case "fd": |
| 112 | 112 |
for i := range ls {
|
| 113 |
- ls[i] = &hack.MalformedHostHeaderOverride{ls[i]}
|
|
| 113 |
+ ls[i] = &hack.MalformedHostHeaderOverride{Listener: ls[i]}
|
|
| 114 | 114 |
} |
| 115 | 115 |
} |
| 116 | 116 |
return ls |
| ... | ... |
@@ -168,7 +168,7 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap |
| 168 | 168 |
return nil, err |
| 169 | 169 |
} |
| 170 | 170 |
// Create the driver home dir |
| 171 |
- if err := idtools.MkdirAllAndChown(home, 0700, idtools.IDPair{rootUID, rootGID}); err != nil {
|
|
| 171 |
+ if err := idtools.MkdirAllAndChown(home, 0700, idtools.IDPair{UID: rootUID, GID: rootGID}); err != nil {
|
|
| 172 | 172 |
return nil, err |
| 173 | 173 |
} |
| 174 | 174 |
|
| ... | ... |
@@ -410,7 +410,7 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, err erro |
| 410 | 410 |
if err != nil {
|
| 411 | 411 |
return nil, err |
| 412 | 412 |
} |
| 413 |
- if err := idtools.MkdirAndChown(mergedDir, 0700, idtools.IDPair{rootUID, rootGID}); err != nil {
|
|
| 413 |
+ if err := idtools.MkdirAndChown(mergedDir, 0700, idtools.IDPair{UID: rootUID, GID: rootGID}); err != nil {
|
|
| 414 | 414 |
return nil, err |
| 415 | 415 |
} |
| 416 | 416 |
var ( |
| ... | ... |
@@ -200,7 +200,7 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap |
| 200 | 200 |
return nil, err |
| 201 | 201 |
} |
| 202 | 202 |
// Create the driver home dir |
| 203 |
- if err := idtools.MkdirAllAndChown(path.Join(home, linkDir), 0700, idtools.IDPair{rootUID, rootGID}); err != nil {
|
|
| 203 |
+ if err := idtools.MkdirAllAndChown(path.Join(home, linkDir), 0700, idtools.IDPair{UID: rootUID, GID: rootGID}); err != nil {
|
|
| 204 | 204 |
return nil, err |
| 205 | 205 |
} |
| 206 | 206 |
|
| ... | ... |
@@ -581,7 +581,7 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr e |
| 581 | 581 |
if err != nil {
|
| 582 | 582 |
return nil, err |
| 583 | 583 |
} |
| 584 |
- if err := idtools.MkdirAndChown(mergedDir, 0700, idtools.IDPair{rootUID, rootGID}); err != nil {
|
|
| 584 |
+ if err := idtools.MkdirAndChown(mergedDir, 0700, idtools.IDPair{UID: rootUID, GID: rootGID}); err != nil {
|
|
| 585 | 585 |
return nil, err |
| 586 | 586 |
} |
| 587 | 587 |
|
| ... | ... |
@@ -106,7 +106,7 @@ func Init(base string, opt []string, uidMaps, gidMaps []idtools.IDMap) (graphdri |
| 106 | 106 |
if err != nil {
|
| 107 | 107 |
return nil, fmt.Errorf("Failed to get root uid/guid: %v", err)
|
| 108 | 108 |
} |
| 109 |
- if err := idtools.MkdirAllAndChown(base, 0700, idtools.IDPair{rootUID, rootGID}); err != nil {
|
|
| 109 |
+ if err := idtools.MkdirAllAndChown(base, 0700, idtools.IDPair{UID: rootUID, GID: rootGID}); err != nil {
|
|
| 110 | 110 |
return nil, fmt.Errorf("Failed to create '%s': %v", base, err)
|
| 111 | 111 |
} |
| 112 | 112 |
|
| ... | ... |
@@ -385,7 +385,7 @@ func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr e |
| 385 | 385 |
return nil, err |
| 386 | 386 |
} |
| 387 | 387 |
// Create the target directories if they don't exist |
| 388 |
- if err := idtools.MkdirAllAndChown(mountpoint, 0755, idtools.IDPair{rootUID, rootGID}); err != nil {
|
|
| 388 |
+ if err := idtools.MkdirAllAndChown(mountpoint, 0755, idtools.IDPair{UID: rootUID, GID: rootGID}); err != nil {
|
|
| 389 | 389 |
return nil, err |
| 390 | 390 |
} |
| 391 | 391 |
|
| ... | ... |
@@ -24,7 +24,7 @@ func (daemon *Daemon) setupMounts(c *container.Container) ([]container.Mount, er |
| 24 | 24 |
if err := daemon.lazyInitializeVolume(c.ID, mount); err != nil {
|
| 25 | 25 |
return nil, err |
| 26 | 26 |
} |
| 27 |
- s, err := mount.Setup(c.MountLabel, idtools.IDPair{0, 0}, nil)
|
|
| 27 |
+ s, err := mount.Setup(c.MountLabel, idtools.IDPair{UID: 0, GID: 0}, nil)
|
|
| 28 | 28 |
if err != nil {
|
| 29 | 29 |
return nil, err |
| 30 | 30 |
} |
| ... | ... |
@@ -29,7 +29,7 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
|
| 29 | 29 |
|
| 30 | 30 |
cID1 := container.Create(t, ctx, client, func(c *container.TestContainerConfig) {
|
| 31 | 31 |
c.NetworkingConfig = &network.NetworkingConfig{
|
| 32 |
- map[string]*network.EndpointSettings{
|
|
| 32 |
+ EndpointsConfig: map[string]*network.EndpointSettings{
|
|
| 33 | 33 |
name: {},
|
| 34 | 34 |
}, |
| 35 | 35 |
} |
| ... | ... |
@@ -52,7 +52,7 @@ func TestDockerNetworkConnectAlias(t *testing.T) {
|
| 52 | 52 |
|
| 53 | 53 |
cID2 := container.Create(t, ctx, client, func(c *container.TestContainerConfig) {
|
| 54 | 54 |
c.NetworkingConfig = &network.NetworkingConfig{
|
| 55 |
- map[string]*network.EndpointSettings{
|
|
| 55 |
+ EndpointsConfig: map[string]*network.EndpointSettings{
|
|
| 56 | 56 |
name: {},
|
| 57 | 57 |
}, |
| 58 | 58 |
} |
| ... | ... |
@@ -58,7 +58,7 @@ func getSpecUser(ociSpec *specs.Spec) (int, int) {
|
| 58 | 58 |
func prepareBundleDir(bundleDir string, ociSpec *specs.Spec) (string, error) {
|
| 59 | 59 |
uid, gid := getSpecUser(ociSpec) |
| 60 | 60 |
if uid == 0 && gid == 0 {
|
| 61 |
- return bundleDir, idtools.MkdirAllAndChownNew(bundleDir, 0755, idtools.IDPair{0, 0})
|
|
| 61 |
+ return bundleDir, idtools.MkdirAllAndChownNew(bundleDir, 0755, idtools.IDPair{UID: 0, GID: 0})
|
|
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 | 64 |
p := string(filepath.Separator) |
| ... | ... |
@@ -71,7 +71,7 @@ func prepareBundleDir(bundleDir string, ociSpec *specs.Spec) (string, error) {
|
| 71 | 71 |
} |
| 72 | 72 |
if os.IsNotExist(err) || fi.Mode()&1 == 0 {
|
| 73 | 73 |
p = fmt.Sprintf("%s.%d.%d", p, uid, gid)
|
| 74 |
- if err := idtools.MkdirAndChown(p, 0700, idtools.IDPair{uid, gid}); err != nil && !os.IsExist(err) {
|
|
| 74 |
+ if err := idtools.MkdirAndChown(p, 0700, idtools.IDPair{UID: uid, GID: gid}); err != nil && !os.IsExist(err) {
|
|
| 75 | 75 |
return "", err |
| 76 | 76 |
} |
| 77 | 77 |
} |
| ... | ... |
@@ -73,5 +73,5 @@ func handleLChmod(hdr *tar.Header, path string, hdrInfo os.FileInfo) error {
|
| 73 | 73 |
|
| 74 | 74 |
func getFileUIDGID(stat interface{}) (idtools.IDPair, error) {
|
| 75 | 75 |
// no notion of file ownership mapping yet on Windows |
| 76 |
- return idtools.IDPair{0, 0}, nil
|
|
| 76 |
+ return idtools.IDPair{UID: 0, GID: 0}, nil
|
|
| 77 | 77 |
} |
| ... | ... |
@@ -53,7 +53,7 @@ func (pm *Manager) enable(p *v2.Plugin, c *controller, force bool) error {
|
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 | 55 |
rootFS := containerfs.NewLocalContainerFS(filepath.Join(pm.config.Root, p.PluginObj.ID, rootFSFileName)) |
| 56 |
- if err := initlayer.Setup(rootFS, idtools.IDPair{0, 0}); err != nil {
|
|
| 56 |
+ if err := initlayer.Setup(rootFS, idtools.IDPair{UID: 0, GID: 0}); err != nil {
|
|
| 57 | 57 |
return errors.WithStack(err) |
| 58 | 58 |
} |
| 59 | 59 |
|