From a3bab821cbe8cd388cce00bb046793ca60592611 Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Mon, 16 Mar 2020 10:00:40 +0100 Subject: [PATCH] Update golangci-lint to v1.24.0 This update fixes some freshly introduced lints during the linter upgrade. Signed-off-by: Sascha Grunert --- Makefile | 2 +- internal/storage/runtime.go | 5 ++--- pkg/config/config.go | 7 +++---- server/sandbox_run_linux.go | 25 ++++++++++++------------- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index fbd2653cd73..79e8f7fffe2 100644 --- a/Makefile +++ b/Makefile @@ -270,7 +270,7 @@ ${RELEASE_NOTES}: ${GOLANGCI_LINT}: export \ - VERSION=v1.23.8 \ + VERSION=v1.24.0 \ URL=https://raw.githubusercontent.com/golangci/golangci-lint \ BINDIR=${BUILD_BIN_PATH} && \ curl -sfL $$URL/$$VERSION/install.sh | sh -s $$VERSION diff --git a/internal/storage/runtime.go b/internal/storage/runtime.go index 94011274e92..c24ca33a047 100644 --- a/internal/storage/runtime.go +++ b/internal/storage/runtime.go @@ -11,7 +11,6 @@ import ( "github.com/containers/image/v5/transports/alltransports" "github.com/containers/image/v5/types" "github.com/containers/storage" - cstorage "github.com/containers/storage" "github.com/containers/storage/pkg/idtools" v1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/pkg/errors" @@ -262,11 +261,11 @@ func (r *runtimeService) createContainerOrPodSandbox(systemContext *types.System names = append(names, metadata.PodName) } - coptions := cstorage.ContainerOptions{ + coptions := storage.ContainerOptions{ LabelOpts: labelOptions, } if idMappings != nil { - coptions.IDMappingOptions = cstorage.IDMappingOptions{UIDMap: idMappings.UIDs(), GIDMap: idMappings.GIDs()} + coptions.IDMappingOptions = storage.IDMappingOptions{UIDMap: idMappings.UIDs(), GIDMap: idMappings.GIDs()} } container, err := r.storageImageServer.GetStore().CreateContainer(containerID, names, img.ID, "", string(mdata), &coptions) if err != nil { diff --git a/pkg/config/config.go b/pkg/config/config.go index 59e2232d5ab..92f51f2032a 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -18,7 +18,6 @@ import ( "github.com/containers/libpod/pkg/rootless" createconfig "github.com/containers/libpod/pkg/spec" "github.com/containers/storage" - cstorage "github.com/containers/storage" "github.com/cri-o/cri-o/internal/config/apparmor" "github.com/cri-o/cri-o/internal/config/seccomp" "github.com/cri-o/cri-o/server/useragent" @@ -57,13 +56,13 @@ type Config struct { // Iface provides a config interface for data encapsulation type Iface interface { - GetStore() (cstorage.Store, error) + GetStore() (storage.Store, error) GetData() *Config } // GetStore returns the container storage for a given configuration -func (c *Config) GetStore() (cstorage.Store, error) { - return cstorage.GetStore(cstorage.StoreOptions{ +func (c *Config) GetStore() (storage.Store, error) { + return storage.GetStore(storage.StoreOptions{ RunRoot: c.RunRoot, GraphRoot: c.Root, GraphDriverName: c.Storage, diff --git a/server/sandbox_run_linux.go b/server/sandbox_run_linux.go index e462c59af22..bf26a6e0c84 100644 --- a/server/sandbox_run_linux.go +++ b/server/sandbox_run_linux.go @@ -24,7 +24,6 @@ import ( "github.com/cri-o/cri-o/pkg/config" v1 "github.com/opencontainers/image-spec/specs-go/v1" "github.com/opencontainers/runc/libcontainer/cgroups/systemd" - runtimespec "github.com/opencontainers/runtime-spec/specs-go" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-tools/generate" "github.com/opencontainers/selinux/go-selinux/label" @@ -161,7 +160,7 @@ func (s *Server) runPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest if err := label.Relabel(resolvPath, mountLabel, false); err != nil && errors.Cause(err) != unix.ENOTSUP { return nil, err } - mnt := runtimespec.Mount{ + mnt := spec.Mount{ Type: "bind", Source: resolvPath, Destination: "/etc/resolv.conf", @@ -264,7 +263,7 @@ func (s *Server) runPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest }() } - mnt := runtimespec.Mount{ + mnt := spec.Mount{ Type: "bind", Source: shmPath, Destination: sandbox.DevShmPath, @@ -457,7 +456,7 @@ func (s *Server) runPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest if err := label.Relabel(hostnamePath, mountLabel, false); err != nil && errors.Cause(err) != unix.ENOTSUP { return nil, err } - mnt = runtimespec.Mount{ + mnt = spec.Mount{ Type: "bind", Source: hostnamePath, Destination: "/etc/hostname", @@ -479,7 +478,7 @@ func (s *Server) runPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest if s.defaultIDMappings != nil && !s.defaultIDMappings.Empty() { if securityContext.GetNamespaceOptions().GetIpc() == pb.NamespaceMode_NODE { g.RemoveMount("/dev/mqueue") - mqueue := runtimespec.Mount{ + mqueue := spec.Mount{ Type: "bind", Source: "/dev/mqueue", Destination: "/dev/mqueue", @@ -500,7 +499,7 @@ func (s *Server) runPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest } if securityContext.GetNamespaceOptions().GetPid() == pb.NamespaceMode_NODE { g.RemoveMount("/proc") - proc := runtimespec.Mount{ + proc := spec.Mount{ Type: "bind", Source: "/proc", Destination: "/proc", @@ -759,7 +758,7 @@ func (s *Server) configureGeneratorForSysctls(ctx context.Context, g generate.Ge func (s *Server) configureGeneratorForSandboxNamespaces(hostNetwork, hostIPC, hostPID bool, sb *sandbox.Sandbox, g generate.Generator) (cleanupFuncs []func() error, err error) { managedNamespaces := make([]sandbox.NSType, 0, 3) if hostNetwork { - err = g.RemoveLinuxNamespace(string(runtimespec.NetworkNamespace)) + err = g.RemoveLinuxNamespace(string(spec.NetworkNamespace)) if err != nil { return } @@ -768,7 +767,7 @@ func (s *Server) configureGeneratorForSandboxNamespaces(hostNetwork, hostIPC, ho } if hostIPC { - err = g.RemoveLinuxNamespace(string(runtimespec.IPCNamespace)) + err = g.RemoveLinuxNamespace(string(spec.IPCNamespace)) if err != nil { return } @@ -778,7 +777,7 @@ func (s *Server) configureGeneratorForSandboxNamespaces(hostNetwork, hostIPC, ho // Since we need a process to hold open the PID namespace, CRI-O can't manage the NS lifecycle if hostPID { - err = g.RemoveLinuxNamespace(string(runtimespec.PIDNamespace)) + err = g.RemoveLinuxNamespace(string(spec.PIDNamespace)) if err != nil { return } @@ -808,10 +807,10 @@ func (s *Server) configureGeneratorForSandboxNamespaces(hostNetwork, hostIPC, ho // to add or replace the defaults to these paths func configureGeneratorGivenNamespacePaths(managedNamespaces []*sandbox.ManagedNamespace, g generate.Generator) error { typeToSpec := map[sandbox.NSType]string{ - sandbox.IPCNS: runtimespec.IPCNamespace, - sandbox.NETNS: runtimespec.NetworkNamespace, - sandbox.UTSNS: runtimespec.UTSNamespace, - sandbox.USERNS: runtimespec.UserNamespace, + sandbox.IPCNS: spec.IPCNamespace, + sandbox.NETNS: spec.NetworkNamespace, + sandbox.UTSNS: spec.UTSNamespace, + sandbox.USERNS: spec.UserNamespace, } for _, ns := range managedNamespaces {