Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion mod/tigron/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ linters:
- "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

- 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
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
7 changes: 5 additions & 2 deletions pkg/mountutil/mountutil_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ func ProcessFlagMount(s string, volStore volumestore.VolumeStore) (*Processed, e
case "bind-nonrecursive":
bindNonRecursive = true
continue
default:
}
}

Expand Down Expand Up @@ -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" {
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pkg/platformutil/binfmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/reflectutil/reflectutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
1 change: 1 addition & 0 deletions pkg/snapshotterutil/socisource.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func SociAppendDefaultLabelsHandlerWrapper(indexDigest string, wrapper func(imag
c.Annotations[targetImageLayersSizeLabel] = strings.TrimSuffix(layerSizes, ",")
}
}
default:
}
return children, nil
})
Expand Down
1 change: 1 addition & 0 deletions pkg/statsutil/stats_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pkg/testutil/nerdtest/requirements.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ var CGroup = &test.Requirement{
case "none", "":
ret = false
mess = "cgroup is none"
default:
}
return ret, mess
},
Expand Down Expand Up @@ -212,6 +213,7 @@ var CGroupV2 = &test.Requirement{
case "none", "":
ret = false
mess = "cgroup is none"
default:
}
if dinf.CgroupVersion != "2" {
ret = false
Expand Down
3 changes: 3 additions & 0 deletions pkg/testutil/testsyslog/testsyslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading
Loading