Skip to content

Commit

Permalink
Merge pull request containerd#9800 from austinvazquez/update-golangci…
Browse files Browse the repository at this point in the history
…-lint

Update golangci-lint version to v1.56.1 and resolve warnings
  • Loading branch information
mxpv authored Feb 22, 2024
2 parents c3ec84c + 6a75971 commit 33e544e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: ./.github/actions/install-go
- uses: golangci/golangci-lint-action@v4
with:
version: v1.55.2
version: v1.56.1
skip-cache: true
args: --timeout=8m

Expand Down
4 changes: 2 additions & 2 deletions client/snapshotter_opts_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

const (
capaRemapIDs = "remap-ids"
capaOnlyRemapIds = "only-remap-ids"
capaOnlyRemapIDs = "only-remap-ids"
)

// WithRemapperLabels creates the labels used by any supporting snapshotter
Expand Down Expand Up @@ -75,7 +75,7 @@ func resolveSnapshotOptions(ctx context.Context, client *Client, snapshotterName

capaOnlyRemap := false
for _, capa := range capabs {
if capa == capaOnlyRemapIds {
if capa == capaOnlyRemapIDs {
capaOnlyRemap = true
}
}
Expand Down
12 changes: 6 additions & 6 deletions plugins/snapshots/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type SnapshotterConfig struct {
upperdirLabel bool
ms MetaStore
mountOptions []string
remapIds bool
remapIDs bool
slowChown bool
}

Expand Down Expand Up @@ -94,8 +94,8 @@ func WithMetaStore(ms MetaStore) Opt {
}
}

func WithRemapIds(config *SnapshotterConfig) error {
config.remapIds = true
func WithRemapIDs(config *SnapshotterConfig) error {
config.remapIDs = true
return nil
}

Expand All @@ -110,7 +110,7 @@ type snapshotter struct {
asyncRemove bool
upperdirLabel bool
options []string
remapIds bool
remapIDs bool
slowChown bool
}

Expand Down Expand Up @@ -167,7 +167,7 @@ func NewSnapshotter(root string, opts ...Opt) (snapshots.Snapshotter, error) {
asyncRemove: config.asyncRemove,
upperdirLabel: config.upperdirLabel,
options: config.mountOptions,
remapIds: config.remapIds,
remapIDs: config.remapIDs,
slowChown: config.slowChown,
}, nil
}
Expand Down Expand Up @@ -573,7 +573,7 @@ func (o *snapshotter) prepareDirectory(ctx context.Context, snapshotDir string,
func (o *snapshotter) mounts(s storage.Snapshot, info snapshots.Info) []mount.Mount {
var options []string

if o.remapIds {
if o.remapIDs {
if v, ok := info.Labels[snapshots.LabelSnapshotUIDMapping]; ok {
options = append(options, fmt.Sprintf("uidmap=%s", v))
}
Expand Down
8 changes: 4 additions & 4 deletions plugins/snapshots/overlay/overlay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestOverlay(t *testing.T) {
// default in init()
"AsynchronousRemove": {AsynchronousRemove},
// idmapped mounts enabled
"WithRemapIds": {WithRemapIds},
"WithRemapIDs": {WithRemapIDs},
}

for optsName, opts := range optTestCases {
Expand Down Expand Up @@ -211,7 +211,7 @@ func testOverlayRemappedBind(t *testing.T, newSnapshotter testsuite.SnapshotterF
t.Fatal(err)
}

if sn, ok := o.(*snapshotter); !ok || !sn.remapIds {
if sn, ok := o.(*snapshotter); !ok || !sn.remapIDs {
t.Skip("overlayfs doesn't support idmapped mounts")
}

Expand Down Expand Up @@ -316,7 +316,7 @@ func testOverlayRemappedActive(t *testing.T, newSnapshotter testsuite.Snapshotte
t.Fatal(err)
}

if sn, ok := o.(*snapshotter); !ok || !sn.remapIds {
if sn, ok := o.(*snapshotter); !ok || !sn.remapIDs {
t.Skip("overlayfs doesn't support idmapped mounts")
}

Expand Down Expand Up @@ -390,7 +390,7 @@ func testOverlayRemappedInvalidMapping(t *testing.T, newSnapshotter testsuite.Sn
t.Fatal(err)
}

if sn, ok := o.(*snapshotter); !ok || !sn.remapIds {
if sn, ok := o.(*snapshotter); !ok || !sn.remapIDs {
t.Skip("overlayfs doesn't support idmapped mounts")
}

Expand Down
12 changes: 6 additions & 6 deletions plugins/snapshots/overlay/plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (
)

const (
capaRemapIds = "remap-ids"
capaOnlyRemapIds = "only-remap-ids"
capaRemapIDs = "remap-ids"
capaOnlyRemapIDs = "only-remap-ids"
)

// Config represents configuration for the overlay plugin.
Expand Down Expand Up @@ -80,16 +80,16 @@ func init() {
oOpts = append(oOpts, overlay.WithMountOptions(config.MountOptions))
}
if ok, err := overlayutils.SupportsIDMappedMounts(); err == nil && ok {
oOpts = append(oOpts, overlay.WithRemapIds)
ic.Meta.Capabilities = append(ic.Meta.Capabilities, capaRemapIds)
oOpts = append(oOpts, overlay.WithRemapIDs)
ic.Meta.Capabilities = append(ic.Meta.Capabilities, capaRemapIDs)
}

if config.SlowChown {
oOpts = append(oOpts, overlay.WithSlowChown)
} else {
// If slowChown is false, we use capaOnlyRemapIds to signal we only
// If slowChown is false, we use capaOnlyRemapIDs to signal we only
// allow idmap mounts.
ic.Meta.Capabilities = append(ic.Meta.Capabilities, capaOnlyRemapIds)
ic.Meta.Capabilities = append(ic.Meta.Capabilities, capaOnlyRemapIDs)
}

ic.Meta.Exports["root"] = root
Expand Down

0 comments on commit 33e544e

Please sign in to comment.