Skip to content

Commit

Permalink
update golangci-lint (1.59.1)
Browse files Browse the repository at this point in the history
Fix:

>  Error: pkg/cmd/container/stats.go:84:60: var-naming: func parameter containerIds should be containerIDs (revive)
>  func Stats(ctx context.Context, client *containerd.Client, containerIds []string, options types.ContainerStatsOptions) error {
>                                                             ^
>  Error: cmd/nerdctl/image_inspect_test.go:79:2: var-naming: var allIds should be allIDs (revive)
>  	allIds := strings.Split(ids, "\n")
>  	^

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
  • Loading branch information
AkihiroSuda committed Jun 20, 2024
1 parent 3bf7c4f commit f35e425
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6.0.1
with:
version: v1.55.2
version: v1.59.1
args: --verbose
- name: yamllint-lint
run: yamllint .
Expand Down
4 changes: 2 additions & 2 deletions cmd/nerdctl/image_inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func TestImageInspectDifferentValidReferencesForTheSameImage(t *testing.T) {
// More specifically, because we trigger https://github.com/containerd/nerdctl/issues/3016
// we cannot do selective rmi, so, just nuke everything
ids := base.Cmd("image", "list", "-q").Out()
allIds := strings.Split(ids, "\n")
for _, id := range allIds {
allIDs := strings.Split(ids, "\n")
for _, id := range allIDs {
id = strings.TrimSpace(id)
if id != "" {
base.Cmd("rmi", "-f", id).Run()
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/container/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ func (s *stats) isKnownContainer(cid string) (int, bool) {
}

// Stats displays a live stream of container(s) resource usage statistics.
func Stats(ctx context.Context, client *containerd.Client, containerIds []string, options types.ContainerStatsOptions) error {
func Stats(ctx context.Context, client *containerd.Client, containerIDs []string, options types.ContainerStatsOptions) error {
// NOTE: rootless container does not rely on cgroupv1.
// more details about possible ways to resolve this concern: #223
if rootlessutil.IsRootless() && infoutil.CgroupsVersion() == "1" {
return errors.New("stats requires cgroup v2 for rootless containers, see https://rootlesscontaine.rs/getting-started/common/cgroup2/")
}

showAll := len(containerIds) == 0
showAll := len(containerIDs) == 0
closeChan := make(chan error)

var err error
Expand Down Expand Up @@ -227,7 +227,7 @@ func Stats(ctx context.Context, client *containerd.Client, containerIds []string
},
}

if err := walker.WalkAll(ctx, containerIds, false); err != nil {
if err := walker.WalkAll(ctx, containerIDs, false); err != nil {
return err
}

Expand Down

0 comments on commit f35e425

Please sign in to comment.