diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-04-23 06:32:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-23 06:32:41 -0400 |
commit | 2df9bdc00948e24855f3da42e31a6d273861e380 (patch) | |
tree | a2b25921510922eb921c24bc13fb95228d41e0b7 /pkg | |
parent | 31231ffd748d10048e6541b18fd863a66342c6c7 (diff) | |
parent | 5b4af0584d1c66b4f8d3d721374541fb76b5b395 (diff) | |
download | podman-2df9bdc00948e24855f3da42e31a6d273861e380.tar.gz podman-2df9bdc00948e24855f3da42e31a6d273861e380.tar.bz2 podman-2df9bdc00948e24855f3da42e31a6d273861e380.zip |
Merge pull request #13973 from Luap99/linter-revive
replace golint with revive linter
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/handlers/compat/containers_archive.go | 3 | ||||
-rw-r--r-- | pkg/api/handlers/libpod/containers_create.go | 2 | ||||
-rw-r--r-- | pkg/bindings/connection.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/common_test.go | 2 | ||||
-rw-r--r-- | pkg/domain/entities/network.go | 2 | ||||
-rw-r--r-- | pkg/domain/filters/containers.go | 2 | ||||
-rw-r--r-- | pkg/domain/infra/abi/manifest.go | 4 | ||||
-rw-r--r-- | pkg/domain/infra/abi/trust.go | 2 | ||||
-rw-r--r-- | pkg/k8s.io/api/core/v1/resource.go | 2 | ||||
-rw-r--r-- | pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go | 2 | ||||
-rw-r--r-- | pkg/machine/fcos.go | 4 | ||||
-rw-r--r-- | pkg/machine/qemu/config.go | 2 | ||||
-rw-r--r-- | pkg/machine/qemu/machine.go | 2 | ||||
-rw-r--r-- | pkg/specgen/generate/kube/seccomp.go | 2 | ||||
-rw-r--r-- | pkg/specgen/generate/kube/volume.go | 4 | ||||
-rw-r--r-- | pkg/specgen/namespaces.go | 12 |
16 files changed, 26 insertions, 23 deletions
diff --git a/pkg/api/handlers/compat/containers_archive.go b/pkg/api/handlers/compat/containers_archive.go index f2ff4d100..45b13818b 100644 --- a/pkg/api/handlers/compat/containers_archive.go +++ b/pkg/api/handlers/compat/containers_archive.go @@ -2,7 +2,6 @@ package compat import ( "encoding/json" - "fmt" "net/http" "os" @@ -28,7 +27,7 @@ func Archive(w http.ResponseWriter, r *http.Request) { case http.MethodHead, http.MethodGet: handleHeadAndGet(w, r, decoder, runtime) default: - utils.Error(w, http.StatusNotImplemented, errors.New(fmt.Sprintf("unsupported method: %v", r.Method))) + utils.Error(w, http.StatusNotImplemented, errors.Errorf("unsupported method: %v", r.Method)) } } diff --git a/pkg/api/handlers/libpod/containers_create.go b/pkg/api/handlers/libpod/containers_create.go index 1043dec4d..4fff9e345 100644 --- a/pkg/api/handlers/libpod/containers_create.go +++ b/pkg/api/handlers/libpod/containers_create.go @@ -45,7 +45,7 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) { // need to check for memory limit to adjust swap if sg.ResourceLimits != nil && sg.ResourceLimits.Memory != nil { s := "" - var l int64 = 0 + var l int64 if sg.ResourceLimits.Memory.Swap != nil { s = strconv.Itoa(int(*sg.ResourceLimits.Memory.Swap)) } diff --git a/pkg/bindings/connection.go b/pkg/bindings/connection.go index 36e47e5ed..3739ec404 100644 --- a/pkg/bindings/connection.go +++ b/pkg/bindings/connection.go @@ -289,7 +289,7 @@ func sshClient(_url *url.URL, secure bool, passPhrase string, identity string) ( }, ) if err != nil { - return Connection{}, errors.Wrapf(err, "Connection to bastion host (%s) failed.", _url.String()) + return Connection{}, errors.Wrapf(err, "connection to bastion host (%s) failed", _url.String()) } connection := Connection{URI: _url} diff --git a/pkg/bindings/test/common_test.go b/pkg/bindings/test/common_test.go index f2602967b..950fd21e6 100644 --- a/pkg/bindings/test/common_test.go +++ b/pkg/bindings/test/common_test.go @@ -51,7 +51,7 @@ var ( shortName: "busybox", tarballName: "busybox.tar", } - CACHE_IMAGES = []testImage{alpine, busybox} //nolint:golint,stylecheck + CACHE_IMAGES = []testImage{alpine, busybox} //nolint:revive,stylecheck ) type bindingTest struct { diff --git a/pkg/domain/entities/network.go b/pkg/domain/entities/network.go index a057640b3..134ad126a 100644 --- a/pkg/domain/entities/network.go +++ b/pkg/domain/entities/network.go @@ -22,7 +22,7 @@ type NetworkReloadOptions struct { // NetworkReloadReport describes the results of reloading a container network. type NetworkReloadReport struct { - // nolint:stylecheck,golint + // nolint:stylecheck,revive Id string Err error } diff --git a/pkg/domain/filters/containers.go b/pkg/domain/filters/containers.go index 4c6964a00..0557e75d6 100644 --- a/pkg/domain/filters/containers.go +++ b/pkg/domain/filters/containers.go @@ -270,7 +270,7 @@ func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpo invalidPolicyNames = append(invalidPolicyNames, policy) } } - var filterValueError error = nil + var filterValueError error if len(invalidPolicyNames) > 0 { errPrefix := "invalid restart policy" if len(invalidPolicyNames) > 1 { diff --git a/pkg/domain/infra/abi/manifest.go b/pkg/domain/infra/abi/manifest.go index 0e999a019..8b52c335c 100644 --- a/pkg/domain/infra/abi/manifest.go +++ b/pkg/domain/infra/abi/manifest.go @@ -110,6 +110,10 @@ func (ir *ImageEngine) remoteManifestInspect(ctx context.Context, name string) ( if latestErr == nil { latestErr = e } else { + // FIXME should we use multierror package instead? + + // we want the new line here so ignore the linter + //nolint:revive latestErr = errors.Wrapf(latestErr, "tried %v\n", e) } } diff --git a/pkg/domain/infra/abi/trust.go b/pkg/domain/infra/abi/trust.go index df4081349..d53fe16d1 100644 --- a/pkg/domain/infra/abi/trust.go +++ b/pkg/domain/infra/abi/trust.go @@ -84,7 +84,7 @@ func (ir *ImageEngine) SetTrust(ctx context.Context, args []string, options enti policyContentStruct.Default = newReposContent } else { if len(policyContentStruct.Default) == 0 { - return errors.Errorf("Default trust policy must be set.") + return errors.Errorf("default trust policy must be set") } registryExists := false for transport, transportval := range policyContentStruct.Transports { diff --git a/pkg/k8s.io/api/core/v1/resource.go b/pkg/k8s.io/api/core/v1/resource.go index 9270054b3..2fbb663c7 100644 --- a/pkg/k8s.io/api/core/v1/resource.go +++ b/pkg/k8s.io/api/core/v1/resource.go @@ -26,7 +26,7 @@ func (rn ResourceName) String() string { } // Cpu returns the Cpu limit if specified. -// nolint:golint,stylecheck +//nolint:revive,stylecheck func (rl *ResourceList) Cpu() *resource.Quantity { return rl.Name(ResourceCPU, resource.DecimalSI) } diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go b/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go index 352cc028f..965d2ccaf 100644 --- a/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go +++ b/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go @@ -138,7 +138,7 @@ const ( var ( // Errors that could happen while parsing a string. - // nolint:golint + //nolint:revive ErrFormatWrong = errors.New("quantities must match the regular expression '" + splitREString + "'") ErrNumeric = errors.New("unable to parse numeric part of quantity") ErrSuffix = errors.New("unable to parse quantity's suffix") diff --git a/pkg/machine/fcos.go b/pkg/machine/fcos.go index ad1be15c7..d8516dd59 100644 --- a/pkg/machine/fcos.go +++ b/pkg/machine/fcos.go @@ -26,8 +26,8 @@ import ( // These should eventually be moved into machine/qemu as // they are specific to running qemu var ( - artifact string = "qemu" - Format string = "qcow2.xz" + artifact = "qemu" + Format = "qcow2.xz" ) const ( diff --git a/pkg/machine/qemu/config.go b/pkg/machine/qemu/config.go index 6ab25b951..e9416dc36 100644 --- a/pkg/machine/qemu/config.go +++ b/pkg/machine/qemu/config.go @@ -162,7 +162,7 @@ type Monitor struct { var ( // defaultQMPTimeout is the timeout duration for the // qmp monitor interactions. - defaultQMPTimeout time.Duration = 2 * time.Second + defaultQMPTimeout = 2 * time.Second ) // GetPath returns the working path for a machinefile. it returns diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go index 4cfd4e8b0..66f5291c1 100644 --- a/pkg/machine/qemu/machine.go +++ b/pkg/machine/qemu/machine.go @@ -907,7 +907,7 @@ func (v *MachineVM) SSH(_ string, opts machine.SSHOptions) error { return err } if state != machine.Running { - return errors.Errorf("vm %q is not running.", v.Name) + return errors.Errorf("vm %q is not running", v.Name) } username := opts.Username diff --git a/pkg/specgen/generate/kube/seccomp.go b/pkg/specgen/generate/kube/seccomp.go index 1e681e977..8f93b34ff 100644 --- a/pkg/specgen/generate/kube/seccomp.go +++ b/pkg/specgen/generate/kube/seccomp.go @@ -11,7 +11,7 @@ import ( // KubeSeccompPaths holds information about a pod YAML's seccomp configuration // it holds both container and pod seccomp paths -// nolint:golint +//nolint:revive type KubeSeccompPaths struct { containerPaths map[string]string podPath string diff --git a/pkg/specgen/generate/kube/volume.go b/pkg/specgen/generate/kube/volume.go index 987f11569..27881e77a 100644 --- a/pkg/specgen/generate/kube/volume.go +++ b/pkg/specgen/generate/kube/volume.go @@ -17,7 +17,7 @@ const ( kubeFilePermission = 0644 ) -// nolint:golint +//nolint:revive type KubeVolumeType int const ( @@ -26,7 +26,7 @@ const ( KubeVolumeTypeConfigMap KubeVolumeType = iota ) -// nolint:golint +//nolint:revive type KubeVolume struct { // Type of volume to create Type KubeVolumeType diff --git a/pkg/specgen/namespaces.go b/pkg/specgen/namespaces.go index eaf2daad9..7a7ca2706 100644 --- a/pkg/specgen/namespaces.go +++ b/pkg/specgen/namespaces.go @@ -231,14 +231,14 @@ func ParseNamespace(ns string) (Namespace, error) { case strings.HasPrefix(ns, "ns:"): split := strings.SplitN(ns, ":", 2) if len(split) != 2 { - return toReturn, errors.Errorf("must provide a path to a namespace when specifying ns:") + return toReturn, errors.Errorf("must provide a path to a namespace when specifying \"ns:\"") } toReturn.NSMode = Path toReturn.Value = split[1] case strings.HasPrefix(ns, "container:"): split := strings.SplitN(ns, ":", 2) if len(split) != 2 { - return toReturn, errors.Errorf("must provide name or ID or a container when specifying container:") + return toReturn, errors.Errorf("must provide name or ID or a container when specifying \"container:\"") } toReturn.NSMode = FromContainer toReturn.Value = split[1] @@ -349,14 +349,14 @@ func ParseNetworkNamespace(ns string, rootlessDefaultCNI bool) (Namespace, map[s case strings.HasPrefix(ns, "ns:"): split := strings.SplitN(ns, ":", 2) if len(split) != 2 { - return toReturn, nil, errors.Errorf("must provide a path to a namespace when specifying ns:") + return toReturn, nil, errors.Errorf("must provide a path to a namespace when specifying \"ns:\"") } toReturn.NSMode = Path toReturn.Value = split[1] case strings.HasPrefix(ns, string(FromContainer)+":"): split := strings.SplitN(ns, ":", 2) if len(split) != 2 { - return toReturn, nil, errors.Errorf("must provide name or ID or a container when specifying container:") + return toReturn, nil, errors.Errorf("must provide name or ID or a container when specifying \"container:\"") } toReturn.NSMode = FromContainer toReturn.Value = split[1] @@ -427,14 +427,14 @@ func ParseNetworkFlag(networks []string) (Namespace, map[string]types.PerNetwork case strings.HasPrefix(ns, "ns:"): split := strings.SplitN(ns, ":", 2) if len(split) != 2 { - return toReturn, nil, nil, errors.Errorf("must provide a path to a namespace when specifying ns:") + return toReturn, nil, nil, errors.Errorf("must provide a path to a namespace when specifying \"ns:\"") } toReturn.NSMode = Path toReturn.Value = split[1] case strings.HasPrefix(ns, string(FromContainer)+":"): split := strings.SplitN(ns, ":", 2) if len(split) != 2 { - return toReturn, nil, nil, errors.Errorf("must provide name or ID or a container when specifying container:") + return toReturn, nil, nil, errors.Errorf("must provide name or ID or a container when specifying \"container:\"") } toReturn.NSMode = FromContainer toReturn.Value = split[1] |