diff --git a/.golangci.yml b/.golangci.yml index d98d1c409f..3f04f1af10 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -15,6 +15,7 @@ linters: # All these break for one reason or another - tagliatelle # too many JSON keys cannot be changed due to compat - nosnakecase # too many false positives due to the `unix` package + - dupword # too many false positives (e.g., in tests) - gocognit - testpackage - goerr113 diff --git a/Makefile b/Makefile index 4d9a14145a..4d74b517d6 100644 --- a/Makefile +++ b/Makefile @@ -914,7 +914,7 @@ install.tools: .install.golangci-lint .install.swagger ## Install needed tools .PHONY: .install.golangci-lint .install.golangci-lint: - VERSION=1.49.0 ./hack/install_golangci.sh + VERSION=1.50.1 ./hack/install_golangci.sh .PHONY: .install.swagger .install.swagger: diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go index f66d4d4d34..a175f9c29f 100644 --- a/cmd/podman/containers/run.go +++ b/cmd/podman/containers/run.go @@ -203,7 +203,7 @@ func run(cmd *cobra.Command, args []string) error { } report, err := registry.ContainerEngine().ContainerRun(registry.GetContext(), runOpts) - // report.ExitCode is set by ContainerRun even it it returns an error + // report.ExitCode is set by ContainerRun even it returns an error if report != nil { registry.SetExitCode(report.ExitCode) } diff --git a/cmd/podman/registry/config.go b/cmd/podman/registry/config.go index b9d7b54ca1..3e5920c098 100644 --- a/cmd/podman/registry/config.go +++ b/cmd/podman/registry/config.go @@ -34,7 +34,7 @@ var ( // ABIMode used in cobra.Annotations registry.EngineMode when command only supports ABIMode ABIMode = entities.ABIMode.String() - // TunnelMode used in in cobra.Annotations registry.EngineMode when command only supports TunnelMode + // TunnelMode used in cobra.Annotations registry.EngineMode when command only supports TunnelMode TunnelMode = entities.TunnelMode.String() ) diff --git a/cmd/quadlet/main.go b/cmd/quadlet/main.go index 1e17ace588..7adeeb1500 100644 --- a/cmd/quadlet/main.go +++ b/cmd/quadlet/main.go @@ -261,7 +261,7 @@ func isUnambiguousName(imageName string) bool { // What is before the first slash can be a domain or a path domain := imageName[:firstSlash] - // If its a a domain (has dot or port or is "localhost") it is considered fq + // If its a domain (has dot or port or is "localhost") it is considered fq if strings.ContainsAny(domain, ".:") || domain == "localhost" { return true } diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go index 77c2348925..388f659177 100644 --- a/libpod/boltdb_state.go +++ b/libpod/boltdb_state.go @@ -3451,7 +3451,7 @@ func (s *BoltState) RemoveContainerFromPod(pod *Pod, ctr *Container) error { return fmt.Errorf("pod %s is in namespace %q but we are in namespace %q: %w", pod.ID(), pod.config.Namespace, s.namespace, define.ErrNSMismatch) } if s.namespace != ctr.config.Namespace { - return fmt.Errorf("container %s in in namespace %q but we are in namespace %q: %w", ctr.ID(), ctr.config.Namespace, s.namespace, define.ErrNSMismatch) + return fmt.Errorf("container %s in namespace %q but we are in namespace %q: %w", ctr.ID(), ctr.config.Namespace, s.namespace, define.ErrNSMismatch) } } diff --git a/libpod/container.go b/libpod/container.go index 5aae2c75e1..987843d073 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -1253,7 +1253,7 @@ func (c *Container) Secrets() []*ContainerSecret { // values at runtime via network connect and disconnect. // If the container is configured to use CNI and this function returns an empty // array, the container will still be connected to the default network. -// The second return parameter, a bool, indicates that the container container +// The second return parameter, a bool, indicates that the container // is joining the default CNI network - the network name will be included in the // returned array of network names, but the container did not explicitly join // this network. diff --git a/libpod/define/annotations.go b/libpod/define/annotations.go index 580286d6ae..50bc52571a 100644 --- a/libpod/define/annotations.go +++ b/libpod/define/annotations.go @@ -13,7 +13,7 @@ const ( // InspectResponseFalse) it will be used in the output of Inspect(). InspectAnnotationAutoremove = "io.podman.annotations.autoremove" // InspectAnnotationVolumesFrom is used by Inspect to identify - // containers whose volumes are are being used by this container. + // containers whose volumes are being used by this container. // It is expected to be a comma-separated list of container names and/or // IDs. // If an annotation with this key is found in the OCI spec, it will be diff --git a/libpod/define/containerstate.go b/libpod/define/containerstate.go index 00080ef37c..56890339e8 100644 --- a/libpod/define/containerstate.go +++ b/libpod/define/containerstate.go @@ -25,7 +25,7 @@ const ( ContainerStateStopped ContainerStatus = iota // ContainerStatePaused indicates that the container has been paused ContainerStatePaused ContainerStatus = iota - // ContainerStateExited indicates the the container has stopped and been + // ContainerStateExited indicates the container has stopped and been // cleaned up ContainerStateExited ContainerStatus = iota // ContainerStateRemoving indicates the container is in the process of diff --git a/libpod/logs/reversereader/reversereader.go b/libpod/logs/reversereader/reversereader.go index f2e71fb617..d5d7ac176b 100644 --- a/libpod/logs/reversereader/reversereader.go +++ b/libpod/logs/reversereader/reversereader.go @@ -16,7 +16,7 @@ type ReverseReader struct { // NewReverseReader returns a reader that reads from the end of a file // rather than the beginning. It sets the readsize to pagesize and determines -// the first offset using using modulus. +// the first offset using modulus. func NewReverseReader(reader *os.File) (*ReverseReader, error) { // pagesize should be safe for memory use and file reads should be on page // boundaries as well diff --git a/libpod/options.go b/libpod/options.go index 46dadb7331..153ebd9433 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -296,7 +296,7 @@ func WithHooksDir(hooksDirs ...string) RuntimeOption { } } -// WithCDI sets the devices to check for for CDI configuration. +// WithCDI sets the devices to check for CDI configuration. func WithCDI(devices []string) CtrCreateOption { return func(ctr *Container) error { if ctr.valid { @@ -307,7 +307,7 @@ func WithCDI(devices []string) CtrCreateOption { } } -// WithStorageOpts sets the devices to check for for CDI configuration. +// WithStorageOpts sets the devices to check for CDI configuration. func WithStorageOpts(storageOpts map[string]string) CtrCreateOption { return func(ctr *Container) error { if ctr.valid { diff --git a/libpod/pod_internal.go b/libpod/pod_internal.go index 743280f49f..48d83393d4 100644 --- a/libpod/pod_internal.go +++ b/libpod/pod_internal.go @@ -44,7 +44,7 @@ func (p *Pod) save() error { // This cannot lock any other pod, but may lock individual containers, as those // will have refreshed by the time pod refresh runs. func (p *Pod) refresh() error { - // Need to to an update from the DB to pull potentially-missing state + // Need to do an update from the DB to pull potentially-missing state if err := p.runtime.state.UpdatePod(p); err != nil { return err } diff --git a/pkg/bindings/pods/pods.go b/pkg/bindings/pods/pods.go index 6b454635c8..47befb0935 100644 --- a/pkg/bindings/pods/pods.go +++ b/pkg/bindings/pods/pods.go @@ -188,7 +188,7 @@ func Restart(ctx context.Context, nameOrID string, options *RestartOptions) (*en return &report, response.ProcessWithError(&report, &errorhandling.PodConflictErrorModel{}) } -// Remove deletes a Pod from from local storage. The optional force parameter denotes +// Remove deletes a Pod from local storage. The optional force parameter denotes // that the Pod can be removed even if in a running state. func Remove(ctx context.Context, nameOrID string, options *RemoveOptions) (*entities.PodRmReport, error) { var report entities.PodRmReport diff --git a/pkg/channel/writer.go b/pkg/channel/writer.go index f174860750..b00afbcc5e 100644 --- a/pkg/channel/writer.go +++ b/pkg/channel/writer.go @@ -6,7 +6,7 @@ import ( "sync" ) -// WriteCloser is an io.WriteCloser that that proxies Write() calls to a channel +// WriteCloser is an io.WriteCloser that proxies Write() calls to a channel // The []byte buffer of the Write() is queued on the channel as one message. type WriteCloser interface { io.WriteCloser diff --git a/pkg/lookup/lookup.go b/pkg/lookup/lookup.go index b8ac3046ee..8413f5b6eb 100644 --- a/pkg/lookup/lookup.go +++ b/pkg/lookup/lookup.go @@ -21,7 +21,7 @@ type Overrides struct { ContainerEtcGroupPath string } -// GetUserGroupInfo takes string forms of the the container's mount path and the container user and +// GetUserGroupInfo takes string forms of the container's mount path and the container user and // returns a ExecUser with uid, gid, sgids, and home. And override can be provided for defaults. func GetUserGroupInfo(containerMount, containerUser string, override *Overrides) (*user.ExecUser, error) { var ( diff --git a/pkg/rootless/rootless.go b/pkg/rootless/rootless.go index 5dc5a535e2..6b9b30f35a 100644 --- a/pkg/rootless/rootless.go +++ b/pkg/rootless/rootless.go @@ -135,7 +135,7 @@ func GetAvailableGids() (int64, error) { return countAvailableIDs(gids), nil } -// findIDInMappings find the the mapping that contains the specified ID. +// findIDInMappings find the mapping that contains the specified ID. // It assumes availableMappings is sorted by ID. func findIDInMappings(id int64, availableMappings []user.IDMap) *user.IDMap { i := sort.Search(len(availableMappings), func(i int) bool { diff --git a/pkg/specgen/generate/ports_test.go b/pkg/specgen/generate/ports_test.go index 40ac3a2905..eb84fbc649 100644 --- a/pkg/specgen/generate/ports_test.go +++ b/pkg/specgen/generate/ports_test.go @@ -672,7 +672,7 @@ func TestParsePortMappingWithoutHostPort(t *testing.T) { assert.NoError(t, err, "error is not nil") // because we always get random host ports when it is set to 0 we cannot check that exactly - // check if it is not 0 and set to to 0 afterwards + // check if it is not 0 and set to 0 afterwards for i := range got { assert.Greater(t, got[i].HostPort, uint16(0), "host port is zero") got[i].HostPort = 0 diff --git a/pkg/specgen/namespaces.go b/pkg/specgen/namespaces.go index 13373db48c..78bcb8619c 100644 --- a/pkg/specgen/namespaces.go +++ b/pkg/specgen/namespaces.go @@ -25,8 +25,7 @@ const ( // Default indicates the spec generator should determine // a sane default Default NamespaceMode = "default" - // Host means the the namespace is derived from - // the host + // Host means the namespace is derived from the host Host NamespaceMode = "host" // Path is the path to a namespace Path NamespaceMode = "path" diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index c502fb9c04..fe78bd603d 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -431,7 +431,7 @@ RUN > file2 ` podmanTest.BuildImageWithLabel(dockerfile, "foobar.com/workdir:latest", "false", "abc") podmanTest.BuildImageWithLabel(dockerfile2, "foobar.com/workdir:latest", "false", "xyz") - // --force used to to avoid y/n question + // --force used to avoid y/n question result := podmanTest.Podman([]string{"image", "prune", "--filter", "label=abc", "--force"}) result.WaitWithDefaultTimeout() Expect(result).Should(Exit(0))