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
13 changes: 13 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: "2"
linters:
enable:
- errorlint
- gocritic
- unconvert
- unparam
exclusions:
Expand All @@ -11,6 +12,18 @@ linters:
- comments
- std-error-handling
settings:
gocritic:
disabled-checks:
- appendAssign
- builtinShadow
- deferInLoop
- hugeParam
- importShadow
- paramTypeCombine
- sloppyReassign
- unnamedResult
- whyNoLint
enable-all: true
staticcheck:
# Enable all options, with some exceptions.
# For defaults, see https://golangci-lint.run/usage/linters/#staticcheck
Expand Down
7 changes: 4 additions & 3 deletions capability/capability_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ func mkString(c Capabilities, max CapType) (ret string) {
ret = "{"
for i := CapType(1); i <= max; i <<= 1 {
ret += " " + i.String() + "=\""
if c.Empty(i) {
switch {
case c.Empty(i):
ret += "empty"
} else if c.Full(i) {
case c.Full(i):
ret += "full"
} else {
default:
ret += c.StringCap(i)
}
ret += "\""
Expand Down
2 changes: 1 addition & 1 deletion capability/capability_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func TestNewPid2Load(t *testing.T) {
// Assuming that at least bounding set is not empty.
bset := c.StringCap(BOUNDING)
t.Logf("Bounding set: %s", bset)
if len(bset) == 0 {
if bset == "" {
t.Fatal("loaded bounding set: want non-empty, got empty")
}
}
Expand Down
8 changes: 3 additions & 5 deletions mount/sharedsubtree_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,7 @@ func TestSubtreeUnbindable(t *testing.T) {
} else if err == nil {
t.Fatalf("%q should not have been bindable", sourceDir)
}
defer func() {
if err := Unmount(targetDir); err != nil {
t.Fatal(err)
}
}()
if err := Unmount(targetDir); err != nil {
t.Fatal(err)
}
}
2 changes: 1 addition & 1 deletion user/idtools_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func lookupSubRangesFile(path string, usr User) ([]IDMap, error) {
ParentID: idrange.SubID,
Count: idrange.Count,
})
containerID = containerID + idrange.Count
containerID += idrange.Count
}
return idMap, nil
}