From 55d2f0680ac171a8532ddae69cc3915fc76fb76e Mon Sep 17 00:00:00 2001 From: Aditya Date: Sun, 31 Aug 2025 22:49:17 +0530 Subject: [PATCH 1/2] resolve redundant-test-main-exit issues from linting Signed-off-by: Aditya --- mod/tigron/.golangci.yml | 1 - mod/tigron/internal/com/package_test.go | 14 +------------- mod/tigron/test/package_test.go | 14 +------------- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/mod/tigron/.golangci.yml b/mod/tigron/.golangci.yml index f58a2d37221..351a9c0cfb5 100644 --- a/mod/tigron/.golangci.yml +++ b/mod/tigron/.golangci.yml @@ -96,7 +96,6 @@ linters: - "fmt.Fprintln" - "fmt.Fprintf" - name: redundant-test-main-exit - disabled: true - name: enforce-switch-style disabled: true - name: var-naming diff --git a/mod/tigron/internal/com/package_test.go b/mod/tigron/internal/com/package_test.go index eaadadc4c8a..4732a5ee292 100644 --- a/mod/tigron/internal/com/package_test.go +++ b/mod/tigron/internal/com/package_test.go @@ -25,10 +25,6 @@ import ( ) func TestMain(m *testing.M) { - // Prep exit code - exitCode := 0 - defer func() { os.Exit(exitCode) }() - var ( snapFile *os.File before, after []byte @@ -39,11 +35,7 @@ func TestMain(m *testing.M) { before, _ = highk.SnapshotOpenFiles(snapFile) } - exitCode = m.Run() - - if exitCode != 0 { - return - } + m.Run() if os.Getenv("HIGHK_EXPERIMENTAL_FD") != "" { after, _ = highk.SnapshotOpenFiles(snapFile) @@ -55,15 +47,11 @@ func TestMain(m *testing.M) { for _, file := range diff { fmt.Fprintln(os.Stderr, file) } - - exitCode = 1 } } if err := highk.FindGoRoutines(); err != nil { fmt.Fprintln(os.Stderr, "Leaking go routines") fmt.Fprintln(os.Stderr, err.Error()) - - exitCode = 1 } } diff --git a/mod/tigron/test/package_test.go b/mod/tigron/test/package_test.go index d637f02e53d..edd4f42319c 100644 --- a/mod/tigron/test/package_test.go +++ b/mod/tigron/test/package_test.go @@ -25,10 +25,6 @@ import ( ) func TestMain(m *testing.M) { - // Prep exit code - exitCode := 0 - defer func() { os.Exit(exitCode) }() - var ( snapFile *os.File before, after []byte @@ -39,11 +35,7 @@ func TestMain(m *testing.M) { before, _ = highk.SnapshotOpenFiles(snapFile) } - exitCode = m.Run() - - if exitCode != 0 { - return - } + m.Run() if os.Getenv("HIGHK_EXPERIMENTAL_FD") != "" { after, _ = highk.SnapshotOpenFiles(snapFile) @@ -55,15 +47,11 @@ func TestMain(m *testing.M) { for _, file := range diff { fmt.Fprintln(os.Stderr, file) } - - exitCode = 1 } } if err := highk.FindGoRoutines(); err != nil { fmt.Fprintln(os.Stderr, "Leaking go routines") fmt.Fprintln(os.Stderr, os.Stderr, err.Error()) - - exitCode = 1 } } From 3f32ac76e61f9d4230c3fefa336010461f1bb748 Mon Sep 17 00:00:00 2001 From: Aditya Date: Sun, 31 Aug 2025 23:22:27 +0530 Subject: [PATCH 2/2] enable enforce-switch-style linter Signed-off-by: Aditya --- .golangci.yml | 3 --- cmd/nerdctl/compose/compose_pause_linux_test.go | 1 + cmd/nerdctl/container/container_create.go | 1 + cmd/nerdctl/container/container_run.go | 1 + cmd/nerdctl/container/container_run_cgroup_linux_test.go | 6 ++++++ cmd/nerdctl/main_linux.go | 3 +++ mod/tigron/.golangci.yml | 1 - mod/tigron/internal/com/command.go | 1 + pkg/api/types/cri/metadata_types.go | 1 + pkg/cmd/builder/build.go | 1 + pkg/cmd/container/logs.go | 1 + pkg/cmd/container/run_mount.go | 1 + pkg/cmd/container/run_restart.go | 2 ++ pkg/cmd/container/top_unix.go | 3 ++- pkg/cmd/image/convert.go | 1 + pkg/cmd/network/inspect.go | 1 + pkg/cmd/network/list.go | 2 ++ pkg/cmd/system/events.go | 1 + pkg/cmd/system/info.go | 1 + pkg/cmd/volume/list.go | 2 ++ pkg/composer/pipetagger/pipetagger.go | 1 + pkg/dnsutil/hostsstore/hosts.go | 1 + pkg/infoutil/infoutil.go | 1 + pkg/infoutil/infoutil_unix.go | 1 + pkg/ipcutil/ipcutil.go | 4 ++++ pkg/manifestutil/manifestutils.go | 2 ++ pkg/mountutil/mountutil.go | 1 + pkg/mountutil/mountutil_linux.go | 7 +++++-- pkg/platformutil/binfmt.go | 3 ++- pkg/reflectutil/reflectutil.go | 3 ++- pkg/snapshotterutil/socisource.go | 1 + pkg/statsutil/stats_linux.go | 1 + pkg/testutil/nerdtest/requirements.go | 2 ++ pkg/testutil/testsyslog/testsyslog.go | 3 +++ pkg/version/version.go | 1 + 35 files changed, 57 insertions(+), 9 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index ec60c924491..4e726e34266 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -185,9 +185,6 @@ linters: # 2605 occurrences. Kind of useful in itself, but unacceptable amount of effort to fix disabled: true - name: enforce-switch-style - # Many occurrences. - disabled: true - depguard: rules: no-patent: diff --git a/cmd/nerdctl/compose/compose_pause_linux_test.go b/cmd/nerdctl/compose/compose_pause_linux_test.go index 14624633f39..e4ecda33e9a 100644 --- a/cmd/nerdctl/compose/compose_pause_linux_test.go +++ b/cmd/nerdctl/compose/compose_pause_linux_test.go @@ -28,6 +28,7 @@ func TestComposePauseAndUnpause(t *testing.T) { switch base.Info().CgroupDriver { case "none", "": t.Skip("requires cgroup (for pausing)") + default: } var dockerComposeYAML = fmt.Sprintf(` diff --git a/cmd/nerdctl/container/container_create.go b/cmd/nerdctl/container/container_create.go index fc5cbdd97c8..3d1594ea06a 100644 --- a/cmd/nerdctl/container/container_create.go +++ b/cmd/nerdctl/container/container_create.go @@ -40,6 +40,7 @@ func CreateCommand() *cobra.Command { case "freebsd": longHelp += "\n" longHelp += "WARNING: `nerdctl create` is experimental on FreeBSD and currently requires `--net=none` (https://github.com/containerd/nerdctl/blob/main/docs/freebsd.md)" + default: } var cmd = &cobra.Command{ Use: "create [flags] IMAGE [COMMAND] [ARG...]", diff --git a/cmd/nerdctl/container/container_run.go b/cmd/nerdctl/container/container_run.go index 67b797bdce9..b6a32d0c6bb 100644 --- a/cmd/nerdctl/container/container_run.go +++ b/cmd/nerdctl/container/container_run.go @@ -58,6 +58,7 @@ func RunCommand() *cobra.Command { case "freebsd": longHelp += "\n" longHelp += "WARNING: `nerdctl run` is experimental on FreeBSD and currently requires `--net=none` (https://github.com/containerd/nerdctl/blob/main/docs/freebsd.md)" + default: } var cmd = &cobra.Command{ Use: "run [flags] IMAGE [COMMAND] [ARG...]", diff --git a/cmd/nerdctl/container/container_run_cgroup_linux_test.go b/cmd/nerdctl/container/container_run_cgroup_linux_test.go index e7ea488aa9f..b0368596daf 100644 --- a/cmd/nerdctl/container/container_run_cgroup_linux_test.go +++ b/cmd/nerdctl/container/container_run_cgroup_linux_test.go @@ -53,6 +53,7 @@ func TestRunCgroupV2(t *testing.T) { switch info.CgroupDriver { case "none", "": t.Skip("test requires cgroup driver") + default: } if !info.MemoryLimit { @@ -152,6 +153,7 @@ func TestRunCgroupV1(t *testing.T) { switch info.CgroupDriver { case "none", "": t.Skip("test requires cgroup driver") + default: } if !info.MemoryLimit { t.Skip("test requires MemoryLimit") @@ -195,6 +197,7 @@ func TestIssue3781(t *testing.T) { switch info.CgroupDriver { case "none", "": t.Skip("test requires cgroup driver") + default: } containerName := testutil.Identifier(t) base.Cmd("run", "-d", "--name", containerName, testutil.AlpineImage, "sleep", "infinity").AssertOK() @@ -402,6 +405,7 @@ func TestRunCgroupConf(t *testing.T) { switch info.CgroupDriver { case "none", "": t.Skip("test requires cgroup driver") + default: } if !info.MemoryLimit { t.Skip("test requires MemoryLimit") @@ -417,6 +421,7 @@ func TestRunCgroupParent(t *testing.T) { switch info.CgroupDriver { case "none", "": t.Skip("test requires cgroup driver") + default: } containerName := testutil.Identifier(t) @@ -476,6 +481,7 @@ func TestRunBlkioWeightCgroupV2(t *testing.T) { switch info.CgroupDriver { case "none", "": t.Skip("test requires cgroup driver") + default: } containerName := testutil.Identifier(t) defer base.Cmd("rm", "-f", containerName).AssertOK() diff --git a/cmd/nerdctl/main_linux.go b/cmd/nerdctl/main_linux.go index 5aba7c2f480..311462201fe 100644 --- a/cmd/nerdctl/main_linux.go +++ b/cmd/nerdctl/main_linux.go @@ -51,6 +51,7 @@ func appNeedsRootlessParentMain(cmd *cobra.Command, args []string) bool { switch commands[2] { case "cp": return false + default: } case "compose": if len(commands) < 3 { @@ -59,7 +60,9 @@ func appNeedsRootlessParentMain(cmd *cobra.Command, args []string) bool { switch commands[2] { case "cp": return false + default: } + default: } return true } diff --git a/mod/tigron/.golangci.yml b/mod/tigron/.golangci.yml index 351a9c0cfb5..263fe79bf61 100644 --- a/mod/tigron/.golangci.yml +++ b/mod/tigron/.golangci.yml @@ -97,7 +97,6 @@ linters: - "fmt.Fprintf" - name: redundant-test-main-exit - name: enforce-switch-style - disabled: true - name: var-naming disabled: true depguard: diff --git a/mod/tigron/internal/com/command.go b/mod/tigron/internal/com/command.go index 869a2589de2..68efc8030a5 100644 --- a/mod/tigron/internal/com/command.go +++ b/mod/tigron/internal/com/command.go @@ -281,6 +281,7 @@ func (gc *Command) Wait() (*Result, error) { return gc.result, gc.exec.err case gc.result != nil: return gc.result, ErrExecAlreadyFinished + default: } // Cancel the context in any case now diff --git a/pkg/api/types/cri/metadata_types.go b/pkg/api/types/cri/metadata_types.go index 58b14151ada..3b71709797b 100644 --- a/pkg/api/types/cri/metadata_types.go +++ b/pkg/api/types/cri/metadata_types.go @@ -70,6 +70,7 @@ func (c *ContainerMetadata) UnmarshalJSON(data []byte) error { case metadataVersion: *c = ContainerMetadata(versioned.Metadata) return nil + default: } return fmt.Errorf("unsupported version: %q", versioned.Version) } diff --git a/pkg/cmd/builder/build.go b/pkg/cmd/builder/build.go index 835b2ece8f1..c1d9db3908e 100644 --- a/pkg/cmd/builder/build.go +++ b/pkg/cmd/builder/build.go @@ -390,6 +390,7 @@ func generateBuildctlArgs(ctx context.Context, client *containerd.Client, option buildctlArgs = append(buildctlArgs, "--opt=image-resolve-mode=pull") case false: buildctlArgs = append(buildctlArgs, "--opt=image-resolve-mode=local") + default: } } diff --git a/pkg/cmd/container/logs.go b/pkg/cmd/container/logs.go index c2ede0f0b35..a871e7b141e 100644 --- a/pkg/cmd/container/logs.go +++ b/pkg/cmd/container/logs.go @@ -48,6 +48,7 @@ func Logs(ctx context.Context, client *containerd.Client, container string, opti switch options.GOptions.Namespace { case "moby": log.G(ctx).Warn("Currently, `nerdctl logs` only supports containers created with `nerdctl run -d` or CRI") + default: } stopChannel := make(chan os.Signal, 1) diff --git a/pkg/cmd/container/run_mount.go b/pkg/cmd/container/run_mount.go index 92900a21d59..411d214511e 100644 --- a/pkg/cmd/container/run_mount.go +++ b/pkg/cmd/container/run_mount.go @@ -250,6 +250,7 @@ func generateMountOpts(ctx context.Context, client *containerd.Client, ensuredIm switch imgVol { case "/", "/dev", "/sys", "proc": return nil, nil, nil, fmt.Errorf("invalid VOLUME: %q", imgVolRaw) + default: } if _, ok := mounted[imgVol]; ok { continue diff --git a/pkg/cmd/container/run_restart.go b/pkg/cmd/container/run_restart.go index 5932f2175d5..9d70ac2bbd4 100644 --- a/pkg/cmd/container/run_restart.go +++ b/pkg/cmd/container/run_restart.go @@ -32,6 +32,7 @@ func checkRestartCapabilities(ctx context.Context, client *containerd.Client, re switch policySlice[0] { case "", "no": return true, nil + default: } res, err := client.IntrospectionService().Plugins(ctx, "id==restart") if err != nil { @@ -104,6 +105,7 @@ func UpdateContainerRestartPolicyLabel(ctx context.Context, client *containerd.C desireStatus = containerd.Stopped case containerd.Created: desireStatus = containerd.Created + default: } } updateOpts = append(updateOpts, restart.WithStatus(desireStatus)) diff --git a/pkg/cmd/container/top_unix.go b/pkg/cmd/container/top_unix.go index 92141a4c77a..4f2b5676def 100644 --- a/pkg/cmd/container/top_unix.go +++ b/pkg/cmd/container/top_unix.go @@ -175,8 +175,9 @@ func fieldsASCII(s string) []string { switch r { case '\t', '\n', '\f', '\r', ' ': return true + default: + return false } - return false } return strings.FieldsFunc(s, fn) } diff --git a/pkg/cmd/image/convert.go b/pkg/cmd/image/convert.go index 12a2040d598..ef722caf72a 100644 --- a/pkg/cmd/image/convert.go +++ b/pkg/cmd/image/convert.go @@ -179,6 +179,7 @@ func Convert(ctx context.Context, client *containerd.Client, srcRawRef, targetRa Image: convertedRef, } return printConvertedImage(options.Stdout, options, res) + default: } if convertType != "overlaybd" { diff --git a/pkg/cmd/network/inspect.go b/pkg/cmd/network/inspect.go index 6bacb75e445..47c30011db9 100644 --- a/pkg/cmd/network/inspect.go +++ b/pkg/cmd/network/inspect.go @@ -94,6 +94,7 @@ func Inspect(ctx context.Context, client *containerd.Client, options types.Netwo return err } result = append(result, compat) + default: } } diff --git a/pkg/cmd/network/list.go b/pkg/cmd/network/list.go index d27333a3321..b2c075a4cf2 100644 --- a/pkg/cmd/network/list.go +++ b/pkg/cmd/network/list.go @@ -173,6 +173,8 @@ func getNetworkFilterFuncs(filters []string) ([]func(*map[string]string) bool, [ } return true }) + default: + continue } continue } diff --git a/pkg/cmd/system/events.go b/pkg/cmd/system/events.go index a544f071b57..789769eddb8 100644 --- a/pkg/cmd/system/events.go +++ b/pkg/cmd/system/events.go @@ -90,6 +90,7 @@ func generateEventFilter(filter, filterValue string) (func(e *EventOut) bool, er return strings.EqualFold(string(e.Status), filterValue) }, nil + default: } return nil, fmt.Errorf("%s is an invalid or unsupported filter", filter) diff --git a/pkg/cmd/system/info.go b/pkg/cmd/system/info.go index 183fc577979..6f5300c9428 100644 --- a/pkg/cmd/system/info.go +++ b/pkg/cmd/system/info.go @@ -96,6 +96,7 @@ func Info(ctx context.Context, client *containerd.Client, options types.SystemIn return prettyPrintInfoNative(options.Stdout, infoNative) case "dockercompat": return prettyPrintInfoDockerCompat(options.Stdout, options.Stderr, infoCompat, options.GOptions) + default: } return nil } diff --git a/pkg/cmd/volume/list.go b/pkg/cmd/volume/list.go index 126b65b9045..dea713ce5d6 100644 --- a/pkg/cmd/volume/list.go +++ b/pkg/cmd/volume/list.go @@ -242,6 +242,8 @@ func getVolumeFilterFuncs(filters []string) ([]func(*map[string]string) bool, [] } return true }) + default: + continue } continue } diff --git a/pkg/composer/pipetagger/pipetagger.go b/pkg/composer/pipetagger/pipetagger.go index 9b014354463..34751088aaa 100644 --- a/pkg/composer/pipetagger/pipetagger.go +++ b/pkg/composer/pipetagger/pipetagger.go @@ -64,6 +64,7 @@ func ChooseColorAttrs(tag string) []color.Attribute { attrs = append(attrs, color.BgHiWhite) case color.FgHiWhite: attrs = append(attrs, color.BgHiBlack) + default: } return attrs diff --git a/pkg/dnsutil/hostsstore/hosts.go b/pkg/dnsutil/hostsstore/hosts.go index 1378ed39686..466f40eda98 100644 --- a/pkg/dnsutil/hostsstore/hosts.go +++ b/pkg/dnsutil/hostsstore/hosts.go @@ -61,6 +61,7 @@ LINE: skip = true case MarkerEnd: sawMarkerEnd = true + default: } } if !skip { diff --git a/pkg/infoutil/infoutil.go b/pkg/infoutil/infoutil.go index ce6bf9085b1..b044c281b93 100644 --- a/pkg/infoutil/infoutil.go +++ b/pkg/infoutil/infoutil.go @@ -235,6 +235,7 @@ func parseRuncVersion(runcVersionStdout []byte) (*dockercompat.ComponentVersion, switch strings.TrimSpace(detail[0]) { case "commit": details["GitCommit"] = strings.TrimSpace(detail[1]) + default: } } diff --git a/pkg/infoutil/infoutil_unix.go b/pkg/infoutil/infoutil_unix.go index 1a4068a067a..5b8c0987a17 100644 --- a/pkg/infoutil/infoutil_unix.go +++ b/pkg/infoutil/infoutil_unix.go @@ -84,6 +84,7 @@ func distroName(r io.Reader) string { name = v case "VERSION": version = v + default: } } if name != "" { diff --git a/pkg/ipcutil/ipcutil.go b/pkg/ipcutil/ipcutil.go index 7fd3240f15c..579557cfca0 100644 --- a/pkg/ipcutil/ipcutil.go +++ b/pkg/ipcutil/ipcutil.go @@ -207,6 +207,8 @@ func GenerateIPCOpts(ctx context.Context, ipc IPC, client *containerd.Client) ([ } opts = append(opts, withBindMountHostOtherSourceIPC(*targetConIPC.HostShmPath)) + default: + return nil, fmt.Errorf("unknown ipc mode: %s", ipc.Mode) } return opts, nil @@ -242,6 +244,8 @@ func withBindMountHostIPC(_ context.Context, _ oci.Client, _ *containers.Contain Source: p, Options: []string{"rbind", "nosuid", "noexec", "nodev"}, } + default: + continue } } return nil diff --git a/pkg/manifestutil/manifestutils.go b/pkg/manifestutil/manifestutils.go index acf4e385db1..9f7a8ce2894 100644 --- a/pkg/manifestutil/manifestutils.go +++ b/pkg/manifestutil/manifestutils.go @@ -211,6 +211,8 @@ func CreateManifestEntry(parsedRef *referenceutil.ImageReference, desc ocispec.D entry.SchemaV2Manifest = manifest case "OCIManifest": entry.OCIManifest = manifest + default: + return manifesttypes.DockerManifestEntry{}, fmt.Errorf("unsupported media type: %s", desc.MediaType) } // Special handling for OCI manifests to match Docker output diff --git a/pkg/mountutil/mountutil.go b/pkg/mountutil/mountutil.go index d55a2cb6646..3304690eb5b 100644 --- a/pkg/mountutil/mountutil.go +++ b/pkg/mountutil/mountutil.go @@ -136,6 +136,7 @@ func ProcessFlagV(s string, volStore volumestore.VolumeStore, createDir bool) (* case "rbind", "bind": fstype = "bind" found = true + default: } if found { break diff --git a/pkg/mountutil/mountutil_linux.go b/pkg/mountutil/mountutil_linux.go index a6a79d8e963..38c4576e593 100644 --- a/pkg/mountutil/mountutil_linux.go +++ b/pkg/mountutil/mountutil_linux.go @@ -328,6 +328,7 @@ func ProcessFlagMount(s string, volStore volumestore.VolumeStore) (*Processed, e case "bind-nonrecursive": bindNonRecursive = true continue + default: } } @@ -386,7 +387,6 @@ func ProcessFlagMount(s string, volStore volumestore.VolumeStore) (*Processed, e // compose new fileds and join into a string // to call legacy ProcessFlagTmpfs or ProcessFlagV function - fields = []string{} options := []string{} if rwOption != "" { if rwOption == "readonly" { @@ -416,6 +416,8 @@ func ProcessFlagMount(s string, volStore volumestore.VolumeStore) (*Processed, e options = append(options, "rbind") } } + default: + return nil, fmt.Errorf("invalid mount type '%s' must be a volume/bind/tmpfs", mountType) } if len(options) > 0 { @@ -432,8 +434,9 @@ func ProcessFlagMount(s string, volStore volumestore.VolumeStore) (*Processed, e case Volume, Bind: // createDir=false for --mount option to disallow creating directories on host if not found return ProcessFlagV(fieldsStr, volStore, false) + default: + return nil, fmt.Errorf("invalid mount type '%s' must be a volume/bind/tmpfs", mountType) } - return nil, fmt.Errorf("invalid mount type '%s' must be a volume/bind/tmpfs", mountType) } // copy from https://github.com/moby/moby/blob/085c6a98d54720e70b28354ccec6da9b1b9e7fcf/volume/mounts/linux_parser.go#L375 diff --git a/pkg/platformutil/binfmt.go b/pkg/platformutil/binfmt.go index 1539426790d..ce60ef80438 100644 --- a/pkg/platformutil/binfmt.go +++ b/pkg/platformutil/binfmt.go @@ -38,8 +38,9 @@ func qemuArchFromOCIArch(ociArch string) (string, error) { return "mips64el", nil // NOT typo case "loong64": return "loongarch64", nil // NOT typo + default: + return "", fmt.Errorf("unknown OCI architecture string: %q", ociArch) } - return "", fmt.Errorf("unknown OCI architecture string: %q", ociArch) } func canExecProbably(s string) (bool, error) { diff --git a/pkg/reflectutil/reflectutil.go b/pkg/reflectutil/reflectutil.go index 74d143a1a2b..658c88cb67a 100644 --- a/pkg/reflectutil/reflectutil.go +++ b/pkg/reflectutil/reflectutil.go @@ -58,6 +58,7 @@ func isEmpty(v reflect.Value) bool { switch v.Kind() { case reflect.Map, reflect.Slice: return v.Len() == 0 + default: + return false } - return false } diff --git a/pkg/snapshotterutil/socisource.go b/pkg/snapshotterutil/socisource.go index 7bd0184085c..a66e1581971 100644 --- a/pkg/snapshotterutil/socisource.go +++ b/pkg/snapshotterutil/socisource.go @@ -104,6 +104,7 @@ func SociAppendDefaultLabelsHandlerWrapper(indexDigest string, wrapper func(imag c.Annotations[targetImageLayersSizeLabel] = strings.TrimSuffix(layerSizes, ",") } } + default: } return children, nil }) diff --git a/pkg/statsutil/stats_linux.go b/pkg/statsutil/stats_linux.go index 8e7f08f056b..92bbb9c8c5c 100644 --- a/pkg/statsutil/stats_linux.go +++ b/pkg/statsutil/stats_linux.go @@ -175,6 +175,7 @@ func calculateCgroupBlockIO(metrics *v1.Metrics) (uint64, uint64) { blkRead = blkRead + bioEntry.Value case 'w', 'W': blkWrite = blkWrite + bioEntry.Value + default: } } return blkRead, blkWrite diff --git a/pkg/testutil/nerdtest/requirements.go b/pkg/testutil/nerdtest/requirements.go index 40e3e08e955..bf8948a4d40 100644 --- a/pkg/testutil/nerdtest/requirements.go +++ b/pkg/testutil/nerdtest/requirements.go @@ -177,6 +177,7 @@ var CGroup = &test.Requirement{ case "none", "": ret = false mess = "cgroup is none" + default: } return ret, mess }, @@ -212,6 +213,7 @@ var CGroupV2 = &test.Requirement{ case "none", "": ret = false mess = "cgroup is none" + default: } if dinf.CgroupVersion != "2" { ret = false diff --git a/pkg/testutil/testsyslog/testsyslog.go b/pkg/testutil/testsyslog/testsyslog.go index a5eeb0cbf37..a3e5cbf3398 100644 --- a/pkg/testutil/testsyslog/testsyslog.go +++ b/pkg/testutil/testsyslog/testsyslog.go @@ -95,12 +95,15 @@ func TestableNetwork(network string) bool { switch runtime.GOARCH { case "arm", "arm64": return false + default: } case "windows": return false + default: } case "udp", "tcp", "tcp+tls": return !rootlessutil.IsRootless() + default: } return true } diff --git a/pkg/version/version.go b/pkg/version/version.go index 91d43762670..24d8cb219d0 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -64,6 +64,7 @@ func GetRevision() string { vcsRevision = f.Value case "vcs.modified": vcsModified, _ = strconv.ParseBool(f.Value) + default: } } if vcsRevision == "" {