ci: enable unconvert linter, fix its warnings

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2021-07-07 10:38:45 -07:00
parent 71a3756b19
commit be1d5f83c0
7 changed files with 9 additions and 8 deletions
+1
View File
@@ -8,3 +8,4 @@ linters:
enable: enable:
- gofumpt - gofumpt
- errorlint - errorlint
- unconvert
+2 -2
View File
@@ -224,12 +224,12 @@ func cpusetCopyIfNeeded(current, parent string) error {
} }
if isEmptyCpuset(currentCpus) { if isEmptyCpuset(currentCpus) {
if err := cgroups.WriteFile(current, "cpuset.cpus", string(parentCpus)); err != nil { if err := cgroups.WriteFile(current, "cpuset.cpus", parentCpus); err != nil {
return err return err
} }
} }
if isEmptyCpuset(currentMems) { if isEmptyCpuset(currentMems) {
if err := cgroups.WriteFile(current, "cpuset.mems", string(parentMems)); err != nil { if err := cgroups.WriteFile(current, "cpuset.mems", parentMems); err != nil {
return err return err
} }
} }
+1 -1
View File
@@ -85,7 +85,7 @@ func GetValueByKey(path, file, key string) (uint64, error) {
return 0, err return 0, err
} }
lines := strings.Split(string(content), "\n") lines := strings.Split(content, "\n")
for _, line := range lines { for _, line := range lines {
arr := strings.Split(line, " ") arr := strings.Split(line, " ")
if len(arr) == 2 && arr[0] == key { if len(arr) == 2 && arr[0] == key {
+1 -1
View File
@@ -446,5 +446,5 @@ func ConvertBlkIOToIOWeightValue(blkIoWeight uint16) uint64 {
if blkIoWeight == 0 { if blkIoWeight == 0 {
return 0 return 0
} }
return uint64(1 + (uint64(blkIoWeight)-10)*9999/990) return 1 + (uint64(blkIoWeight)-10)*9999/990
} }
+2 -2
View File
@@ -1029,7 +1029,7 @@ func (c *linuxContainer) Checkpoint(criuOpts *CriuOpts) error {
// append optional manage cgroups mode // append optional manage cgroups mode
if criuOpts.ManageCgroupsMode != 0 { if criuOpts.ManageCgroupsMode != 0 {
mode := criurpc.CriuCgMode(criuOpts.ManageCgroupsMode) mode := criuOpts.ManageCgroupsMode
rpcOpts.ManageCgroupsMode = &mode rpcOpts.ManageCgroupsMode = &mode
} }
@@ -1406,7 +1406,7 @@ func (c *linuxContainer) Restore(process *Process, criuOpts *CriuOpts) error {
// append optional manage cgroups mode // append optional manage cgroups mode
if criuOpts.ManageCgroupsMode != 0 { if criuOpts.ManageCgroupsMode != 0 {
mode := criurpc.CriuCgMode(criuOpts.ManageCgroupsMode) mode := criuOpts.ManageCgroupsMode
req.Opts.ManageCgroupsMode = &mode req.Opts.ManageCgroupsMode = &mode
} }
+1 -1
View File
@@ -40,7 +40,7 @@ func DeviceFromPath(path, permissions string) (*Device, error) {
var ( var (
devType Type devType Type
mode = stat.Mode mode = stat.Mode
devNumber = uint64(stat.Rdev) devNumber = uint64(stat.Rdev) //nolint:unconvert // Rdev is uint32 on e.g. MIPS.
major = unix.Major(devNumber) major = unix.Major(devNumber)
minor = unix.Minor(devNumber) minor = unix.Minor(devNumber)
) )
+1 -1
View File
@@ -53,7 +53,7 @@ func registerMemoryEventV2(cgDir, evName, cgEvName string) (<-chan struct{}, err
offset = 0 offset = 0
for offset <= uint32(n-unix.SizeofInotifyEvent) { for offset <= uint32(n-unix.SizeofInotifyEvent) {
rawEvent := (*unix.InotifyEvent)(unsafe.Pointer(&buffer[offset])) rawEvent := (*unix.InotifyEvent)(unsafe.Pointer(&buffer[offset]))
offset += unix.SizeofInotifyEvent + uint32(rawEvent.Len) offset += unix.SizeofInotifyEvent + rawEvent.Len
if rawEvent.Mask&unix.IN_MODIFY != unix.IN_MODIFY { if rawEvent.Mask&unix.IN_MODIFY != unix.IN_MODIFY {
continue continue
} }