Skip to content

Commit e0b900f

Browse files
authored
Merge pull request #187 from thaJeztah/atomicwriter_linting
fix linting issues for golangci-lint v2
2 parents 6e2523c + 3c88fb3 commit e0b900f

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Diff for: capability/syscall_linux.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,17 @@ func setVfsCap(path string, data *vfscapData) (err error) {
141141
return
142142
}
143143
var size uintptr
144-
if data.version == 1 {
144+
switch data.version {
145+
case 1:
145146
data.magic = vfsCapVer1
146147
size = vfscapDataSizeV1
147-
} else if data.version == 2 {
148+
case 2:
148149
data.magic = vfsCapVer2
149150
if data.effective[0] != 0 || data.effective[1] != 0 {
150151
data.magic |= vfsCapFlageffective
151152
}
152153
size = vfscapDataSizeV2
153-
} else {
154+
default:
154155
return syscall.EINVAL
155156
}
156157
_, _, e1 := syscall.RawSyscall6(syscall.SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_vfsXattrName)), uintptr(unsafe.Pointer(data)), size, 0, 0)

Diff for: mountinfo/mounted_linux_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ func testMountedFast(t *testing.T, path string, tc *testMount, openat2Supported
279279
mounted, sure, err := MountedFast(path)
280280
if err != nil {
281281
// Got an error; is it expected?
282-
if !(tc.isNotExist && errors.Is(err, os.ErrNotExist)) {
282+
if !tc.isNotExist || !errors.Is(err, os.ErrNotExist) {
283283
t.Errorf("MountedFast: unexpected error: %v", err)
284284
}
285285

@@ -350,7 +350,7 @@ func TestMountedBy(t *testing.T) {
350350
}
351351
} else {
352352
// Got an error; is it expected?
353-
if !(tc.isNotExist && errors.Is(err, os.ErrNotExist)) {
353+
if !tc.isNotExist || !errors.Is(err, os.ErrNotExist) {
354354
t.Errorf("Mounted: unexpected error: %v", err)
355355
}
356356
// Check false is returned in error case.

Diff for: user/user.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ func GetAdditionalGroups(additionalGroups []string, group io.Reader) ([]int, err
444444
return false
445445
})
446446
if err != nil {
447-
return nil, fmt.Errorf("Unable to find additional groups %v: %w", additionalGroups, err)
447+
return nil, fmt.Errorf("unable to find additional groups %v: %w", additionalGroups, err)
448448
}
449449
}
450450

@@ -468,7 +468,7 @@ func GetAdditionalGroups(additionalGroups []string, group io.Reader) ([]int, err
468468
gid, err := strconv.ParseInt(ag, 10, 64)
469469
if err != nil {
470470
// Not a numeric ID either.
471-
return nil, fmt.Errorf("Unable to find group %s: %w", ag, ErrNoGroupEntries)
471+
return nil, fmt.Errorf("unable to find group %s: %w", ag, ErrNoGroupEntries)
472472
}
473473
// Ensure gid is inside gid range.
474474
if gid < minID || gid > maxID {

0 commit comments

Comments
 (0)