Skip to content

Commit 3f32ac7

Browse files
enable enforce-switch-style linter
Signed-off-by: Aditya <jaiswal.aditya.deelip@gmail.com>
1 parent 55d2f06 commit 3f32ac7

File tree

35 files changed

+57
-9
lines changed

35 files changed

+57
-9
lines changed

.golangci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,6 @@ linters:
185185
# 2605 occurrences. Kind of useful in itself, but unacceptable amount of effort to fix
186186
disabled: true
187187
- name: enforce-switch-style
188-
# Many occurrences.
189-
disabled: true
190-
191188
depguard:
192189
rules:
193190
no-patent:

cmd/nerdctl/compose/compose_pause_linux_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func TestComposePauseAndUnpause(t *testing.T) {
2828
switch base.Info().CgroupDriver {
2929
case "none", "":
3030
t.Skip("requires cgroup (for pausing)")
31+
default:
3132
}
3233

3334
var dockerComposeYAML = fmt.Sprintf(`

cmd/nerdctl/container/container_create.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func CreateCommand() *cobra.Command {
4040
case "freebsd":
4141
longHelp += "\n"
4242
longHelp += "WARNING: `nerdctl create` is experimental on FreeBSD and currently requires `--net=none` (https://github.com/containerd/nerdctl/blob/main/docs/freebsd.md)"
43+
default:
4344
}
4445
var cmd = &cobra.Command{
4546
Use: "create [flags] IMAGE [COMMAND] [ARG...]",

cmd/nerdctl/container/container_run.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ func RunCommand() *cobra.Command {
5858
case "freebsd":
5959
longHelp += "\n"
6060
longHelp += "WARNING: `nerdctl run` is experimental on FreeBSD and currently requires `--net=none` (https://github.com/containerd/nerdctl/blob/main/docs/freebsd.md)"
61+
default:
6162
}
6263
var cmd = &cobra.Command{
6364
Use: "run [flags] IMAGE [COMMAND] [ARG...]",

cmd/nerdctl/container/container_run_cgroup_linux_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func TestRunCgroupV2(t *testing.T) {
5353
switch info.CgroupDriver {
5454
case "none", "":
5555
t.Skip("test requires cgroup driver")
56+
default:
5657
}
5758

5859
if !info.MemoryLimit {
@@ -152,6 +153,7 @@ func TestRunCgroupV1(t *testing.T) {
152153
switch info.CgroupDriver {
153154
case "none", "":
154155
t.Skip("test requires cgroup driver")
156+
default:
155157
}
156158
if !info.MemoryLimit {
157159
t.Skip("test requires MemoryLimit")
@@ -195,6 +197,7 @@ func TestIssue3781(t *testing.T) {
195197
switch info.CgroupDriver {
196198
case "none", "":
197199
t.Skip("test requires cgroup driver")
200+
default:
198201
}
199202
containerName := testutil.Identifier(t)
200203
base.Cmd("run", "-d", "--name", containerName, testutil.AlpineImage, "sleep", "infinity").AssertOK()
@@ -402,6 +405,7 @@ func TestRunCgroupConf(t *testing.T) {
402405
switch info.CgroupDriver {
403406
case "none", "":
404407
t.Skip("test requires cgroup driver")
408+
default:
405409
}
406410
if !info.MemoryLimit {
407411
t.Skip("test requires MemoryLimit")
@@ -417,6 +421,7 @@ func TestRunCgroupParent(t *testing.T) {
417421
switch info.CgroupDriver {
418422
case "none", "":
419423
t.Skip("test requires cgroup driver")
424+
default:
420425
}
421426

422427
containerName := testutil.Identifier(t)
@@ -476,6 +481,7 @@ func TestRunBlkioWeightCgroupV2(t *testing.T) {
476481
switch info.CgroupDriver {
477482
case "none", "":
478483
t.Skip("test requires cgroup driver")
484+
default:
479485
}
480486
containerName := testutil.Identifier(t)
481487
defer base.Cmd("rm", "-f", containerName).AssertOK()

cmd/nerdctl/main_linux.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func appNeedsRootlessParentMain(cmd *cobra.Command, args []string) bool {
5151
switch commands[2] {
5252
case "cp":
5353
return false
54+
default:
5455
}
5556
case "compose":
5657
if len(commands) < 3 {
@@ -59,7 +60,9 @@ func appNeedsRootlessParentMain(cmd *cobra.Command, args []string) bool {
5960
switch commands[2] {
6061
case "cp":
6162
return false
63+
default:
6264
}
65+
default:
6366
}
6467
return true
6568
}

mod/tigron/.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ linters:
9797
- "fmt.Fprintf"
9898
- name: redundant-test-main-exit
9999
- name: enforce-switch-style
100-
disabled: true
101100
- name: var-naming
102101
disabled: true
103102
depguard:

mod/tigron/internal/com/command.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ func (gc *Command) Wait() (*Result, error) {
281281
return gc.result, gc.exec.err
282282
case gc.result != nil:
283283
return gc.result, ErrExecAlreadyFinished
284+
default:
284285
}
285286

286287
// Cancel the context in any case now

pkg/api/types/cri/metadata_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ func (c *ContainerMetadata) UnmarshalJSON(data []byte) error {
7070
case metadataVersion:
7171
*c = ContainerMetadata(versioned.Metadata)
7272
return nil
73+
default:
7374
}
7475
return fmt.Errorf("unsupported version: %q", versioned.Version)
7576
}

pkg/cmd/builder/build.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ func generateBuildctlArgs(ctx context.Context, client *containerd.Client, option
390390
buildctlArgs = append(buildctlArgs, "--opt=image-resolve-mode=pull")
391391
case false:
392392
buildctlArgs = append(buildctlArgs, "--opt=image-resolve-mode=local")
393+
default:
393394
}
394395
}
395396

0 commit comments

Comments
 (0)