Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be removed

# Many occurrences.
disabled: true

depguard:
rules:
no-patent:
Expand Down
1 change: 1 addition & 0 deletions cmd/nerdctl/compose/compose_pause_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func TestComposePauseAndUnpause(t *testing.T) {
switch base.Info().CgroupDriver {
case "none", "":
t.Skip("requires cgroup (for pausing)")
default:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add // NOP to clarify that this empty default is not a typo

default:
  // NOP

Same for other occurrences too

}

var dockerComposeYAML = fmt.Sprintf(`
Expand Down
1 change: 1 addition & 0 deletions cmd/nerdctl/container/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...]",
Expand Down
1 change: 1 addition & 0 deletions cmd/nerdctl/container/container_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...]",
Expand Down
6 changes: 6 additions & 0 deletions cmd/nerdctl/container/container_run_cgroup_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func TestRunCgroupV2(t *testing.T) {
switch info.CgroupDriver {
case "none", "":
t.Skip("test requires cgroup driver")
default:
}

if !info.MemoryLimit {
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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")
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions cmd/nerdctl/main_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -59,7 +60,9 @@ func appNeedsRootlessParentMain(cmd *cobra.Command, args []string) bool {
switch commands[2] {
case "cp":
return false
default:
}
default:
}
return true
}
Expand Down
2 changes: 0 additions & 2 deletions mod/tigron/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ linters:
- "fmt.Fprintln"
- "fmt.Fprintf"
- name: redundant-test-main-exit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be removed

disabled: true
- name: enforce-switch-style
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be removed

disabled: true
- name: var-naming
disabled: true
depguard:
Expand Down
1 change: 1 addition & 0 deletions mod/tigron/internal/com/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 1 addition & 13 deletions mod/tigron/internal/com/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -55,15 +47,11 @@ func TestMain(m *testing.M) {
for _, file := range diff {
fmt.Fprintln(os.Stderr, file)
}

exitCode = 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is irrelevant to redundant-test-main-exit

}
}

if err := highk.FindGoRoutines(); err != nil {
fmt.Fprintln(os.Stderr, "Leaking go routines")
fmt.Fprintln(os.Stderr, err.Error())

exitCode = 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is irrelevant to redundant-test-main-exit

}
}
14 changes: 1 addition & 13 deletions mod/tigron/test/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -55,15 +47,11 @@ func TestMain(m *testing.M) {
for _, file := range diff {
fmt.Fprintln(os.Stderr, file)
}

exitCode = 1
Copy link
Member

@AkihiroSuda AkihiroSuda Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is irrelevant to redundant-test-main-exit

}
}

if err := highk.FindGoRoutines(); err != nil {
fmt.Fprintln(os.Stderr, "Leaking go routines")
fmt.Fprintln(os.Stderr, os.Stderr, err.Error())

exitCode = 1
Copy link
Member

@AkihiroSuda AkihiroSuda Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is irrelevant to redundant-test-main-exit

}
}
1 change: 1 addition & 0 deletions pkg/api/types/cri/metadata_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
1 change: 1 addition & 0 deletions pkg/cmd/builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/container/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/container/run_mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/container/run_restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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))
Expand Down
3 changes: 2 additions & 1 deletion pkg/cmd/container/top_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/image/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/network/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func Inspect(ctx context.Context, client *containerd.Client, options types.Netwo
return err
}
result = append(result, compat)
default:
}
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/network/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ func getNetworkFilterFuncs(filters []string) ([]func(*map[string]string) bool, [
}
return true
})
default:
continue
}
continue
}
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/system/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/system/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/volume/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ func getVolumeFilterFuncs(filters []string) ([]func(*map[string]string) bool, []
}
return true
})
default:
continue
}
continue
}
Expand Down
1 change: 1 addition & 0 deletions pkg/composer/pipetagger/pipetagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pkg/dnsutil/hostsstore/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ LINE:
skip = true
case MarkerEnd:
sawMarkerEnd = true
default:
}
}
if !skip {
Expand Down
1 change: 1 addition & 0 deletions pkg/infoutil/infoutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ func parseRuncVersion(runcVersionStdout []byte) (*dockercompat.ComponentVersion,
switch strings.TrimSpace(detail[0]) {
case "commit":
details["GitCommit"] = strings.TrimSpace(detail[1])
default:
}
}

Expand Down
1 change: 1 addition & 0 deletions pkg/infoutil/infoutil_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func distroName(r io.Reader) string {
name = v
case "VERSION":
version = v
default:
}
}
if name != "" {
Expand Down
4 changes: 4 additions & 0 deletions pkg/ipcutil/ipcutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -242,6 +244,8 @@ func withBindMountHostIPC(_ context.Context, _ oci.Client, _ *containers.Contain
Source: p,
Options: []string{"rbind", "nosuid", "noexec", "nodev"},
}
default:
continue
}
}
return nil
Expand Down
2 changes: 2 additions & 0 deletions pkg/manifestutil/manifestutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pkg/mountutil/mountutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func ProcessFlagV(s string, volStore volumestore.VolumeStore, createDir bool) (*
case "rbind", "bind":
fstype = "bind"
found = true
default:
}
if found {
break
Expand Down
Loading
Loading