diff --git a/.golangci.yml b/.golangci.yml index f8d01dfc83..ee1e204f10 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -207,6 +207,7 @@ linters: # Only listed rules are applied # https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md rules: + - name: increment-decrement # FIXME make sure all packages have a description. Currently, there's many packages without. - name: package-comments disabled: true diff --git a/daemon/containerd/image_prune.go b/daemon/containerd/image_prune.go index 8986bf42a5..94e3f1a684 100644 --- a/daemon/containerd/image_prune.go +++ b/daemon/containerd/image_prune.go @@ -108,7 +108,7 @@ func (i *ImageService) pruneUnused(ctx context.Context, filterFunc imageFilterFu // Images considered for pruning. imagesToPrune := map[string]c8dimages.Image{} for _, img := range allImages { - digestRefCount[img.Target.Digest] += 1 + digestRefCount[img.Target.Digest]++ if !danglingOnly || isDanglingImage(img) { canBePruned := filterFunc(img) @@ -138,7 +138,7 @@ func (i *ImageService) pruneUnused(ctx context.Context, filterFunc imageFilterFu dgst := img.Target.Digest if digestRefCount[dgst] > 1 { - digestRefCount[dgst] -= 1 + digestRefCount[dgst]-- continue } diff --git a/integration/networking/bridge_linux_test.go b/integration/networking/bridge_linux_test.go index a149c1b5b0..c49232547f 100644 --- a/integration/networking/bridge_linux_test.go +++ b/integration/networking/bridge_linux_test.go @@ -1751,7 +1751,7 @@ func TestAdvertiseAddresses(t *testing.T) { if pa != matchIP || slices.Compare(ha, ctr2NewHwAddr) != 0 { continue } - count += 1 + count++ var interval time.Duration if !lastTimestamp.IsZero() { interval = p.ReceivedAt.Sub(lastTimestamp) diff --git a/internal/nlwrap/nlwrap_linux.go b/internal/nlwrap/nlwrap_linux.go index 03d1a3f7d7..459332184c 100644 --- a/internal/nlwrap/nlwrap_linux.go +++ b/internal/nlwrap/nlwrap_linux.go @@ -57,7 +57,7 @@ func (nlh Handle) Close() { } func retryOnIntr(f func() error) { - for attempt := 0; attempt < maxAttempts; attempt += 1 { + for attempt := 0; attempt < maxAttempts; attempt++ { if err := f(); !errors.Is(err, netlink.ErrDumpInterrupted) { return } diff --git a/libnetwork/drivers/macvlan/macvlan_network.go b/libnetwork/drivers/macvlan/macvlan_network.go index 10b4b5324a..e2299b8809 100644 --- a/libnetwork/drivers/macvlan/macvlan_network.go +++ b/libnetwork/drivers/macvlan/macvlan_network.go @@ -146,7 +146,7 @@ func (d *driver) parentHasSingleUser(n *network) bool { networkList := d.getNetworks() for _, testN := range networkList { if n.config.Parent == testN.config.Parent { - users += 1 + users++ } } return users == 1 diff --git a/libnetwork/internal/resolvconf/resolvconf.go b/libnetwork/internal/resolvconf/resolvconf.go index 4261844cc1..ed29254d00 100644 --- a/libnetwork/internal/resolvconf/resolvconf.go +++ b/libnetwork/internal/resolvconf/resolvconf.go @@ -181,7 +181,7 @@ func (rc *ResolvConf) Options() []string { // Option("ndots") -> ("1", true) // Option("edns0") -> ("", true) func (rc *ResolvConf) Option(search string) (string, bool) { - for i := len(rc.options) - 1; i >= 0; i -= 1 { + for i := len(rc.options) - 1; i >= 0; i-- { k, v, _ := strings.Cut(rc.options[i], ":") if k == search { return v, true diff --git a/libnetwork/portallocator/portallocator_test.go b/libnetwork/portallocator/portallocator_test.go index 90c7b0a96c..f58c0a3e40 100644 --- a/libnetwork/portallocator/portallocator_test.go +++ b/libnetwork/portallocator/portallocator_test.go @@ -338,7 +338,7 @@ func TestRequestPortForMultipleIPs(t *testing.T) { assert.Check(t, is.Equal(port, 10000)) // Multi-port range. - for i := 20000; i < 20004; i += 1 { + for i := 20000; i < 20004; i++ { port, err = p.RequestPortsInRange(addrs, "tcp", 20000, 20004) assert.Check(t, err) assert.Check(t, is.Equal(port, i))