diff --git a/.golangci.yml b/.golangci.yml index c306a9c29e..ccaafa38c7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -61,6 +61,14 @@ linters-settings: - name: import-shadowing severity: warning disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-block + - name: empty-block + severity: warning + disabled: false + # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#empty-lines + - name: empty-lines + severity: warning + disabled: false issues: # The default exclusion rules are a bit too permissive, so copying the relevant ones below diff --git a/cli/command/container/cp.go b/cli/command/container/cp.go index 5ef409ca88..b7f1fe6c39 100644 --- a/cli/command/container/cp.go +++ b/cli/command/container/cp.go @@ -246,7 +246,6 @@ func copyFromContainer(ctx context.Context, dockerCli command.Cli, copyConfig cp linkTarget, rebaseName = archive.GetRebaseName(srcPath, linkTarget) srcPath = linkTarget } - } ctx, cancel := signal.NotifyContext(ctx, os.Interrupt) diff --git a/cli/command/formatter/container_test.go b/cli/command/formatter/container_test.go index 1c09a57791..0dd28430a2 100644 --- a/cli/command/formatter/container_test.go +++ b/cli/command/formatter/container_test.go @@ -265,7 +265,6 @@ size: 0B assert.Equal(t, out.String(), tc.expected) } }) - } } diff --git a/cli/command/formatter/image.go b/cli/command/formatter/image.go index da636891ad..d16f42b5ba 100644 --- a/cli/command/formatter/image.go +++ b/cli/command/formatter/image.go @@ -166,7 +166,6 @@ func imageFormatTaggedAndDigest(ctx ImageContext, img image.Summary) []*imageCon for _, dgst := range digests { addImage(repo, tag, dgst) } - } } diff --git a/cli/command/network/connect_test.go b/cli/command/network/connect_test.go index c245a78543..9a8b0e6d0d 100644 --- a/cli/command/network/connect_test.go +++ b/cli/command/network/connect_test.go @@ -39,7 +39,6 @@ func TestNetworkConnectErrors(t *testing.T) { cmd.SetArgs(tc.args) cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) - } } diff --git a/cli/command/network/create_test.go b/cli/command/network/create_test.go index 95938df15e..e2432ae3f9 100644 --- a/cli/command/network/create_test.go +++ b/cli/command/network/create_test.go @@ -139,7 +139,6 @@ func TestNetworkCreateErrors(t *testing.T) { } cmd.SetOut(io.Discard) assert.ErrorContains(t, cmd.Execute(), tc.expectedError) - } } diff --git a/cli/command/network/remove_test.go b/cli/command/network/remove_test.go index ed85e54699..98ea2592f6 100644 --- a/cli/command/network/remove_test.go +++ b/cli/command/network/remove_test.go @@ -90,7 +90,6 @@ func TestNetworkRemoveForce(t *testing.T) { } else { assert.Check(t, is.Contains(fakeCli.ErrBuffer().String(), tc.expectedErr)) assert.ErrorContains(t, err, "Code: 1") - } }) } diff --git a/cli/command/service/progress/progress.go b/cli/command/service/progress/progress.go index 3061f6503a..11436370d1 100644 --- a/cli/command/service/progress/progress.go +++ b/cli/command/service/progress/progress.go @@ -493,7 +493,6 @@ func (u *globalProgressUpdater) tasksByNode(tasks []swarm.Task) map[string]swarm numberedStates[existingTask.Status.State] <= numberedStates[task.Status.State] { continue } - } tasksByNode[task.NodeID] = task } diff --git a/cli/command/service/scale.go b/cli/command/service/scale.go index bdc53ae401..4e6efd84cc 100644 --- a/cli/command/service/scale.go +++ b/cli/command/service/scale.go @@ -76,7 +76,6 @@ func runScale(dockerCli command.Cli, options *scaleOptions, args []string) error } else { serviceIDs = append(serviceIDs, serviceID) } - } if len(serviceIDs) > 0 { diff --git a/cli/command/swarm/ipnet_slice_test.go b/cli/command/swarm/ipnet_slice_test.go index 3f28466ea1..5a25f554c2 100644 --- a/cli/command/swarm/ipnet_slice_test.go +++ b/cli/command/swarm/ipnet_slice_test.go @@ -131,7 +131,6 @@ func TestIPNetBadQuoting(t *testing.T) { } for i, test := range tests { - var cidrs []net.IPNet f := setUpIPNetFlagSet(&cidrs) diff --git a/cli/compose/convert/service.go b/cli/compose/convert/service.go index dc996dd3c8..0f8af6897c 100644 --- a/cli/compose/convert/service.go +++ b/cli/compose/convert/service.go @@ -340,7 +340,6 @@ func convertServiceConfigObjs( ConfigName: name, Runtime: &swarm.ConfigReferenceRuntimeTarget{}, }) - } confs, err := servicecli.ParseConfigs(apiClient, refs) @@ -441,7 +440,6 @@ func convertHealthcheck(healthcheck *composetypes.HealthCheckConfig) (*container return &container.HealthConfig{ Test: []string{"NONE"}, }, nil - } if healthcheck.Timeout != nil { timeout = time.Duration(*healthcheck.Timeout) diff --git a/cli/context/docker/load.go b/cli/context/docker/load.go index 8c597bf9a8..700b73c940 100644 --- a/cli/context/docker/load.go +++ b/cli/context/docker/load.go @@ -98,7 +98,6 @@ func (ep *Endpoint) ClientOpts() ([]client.Opt, error) { withHTTPClient(tlsConfig), client.WithHost(ep.Host), ) - } else { result = append(result, client.WithHTTPClient(&http.Client{