Address golangci-lint warnings
ArangoGutierrez opened this issue · comments
PR #29
Disables
disable:
- unused
- gocritic
- stylecheck
- forcetypeassert
We should address golangci-lint
warnings and re-enable the golangci-lint checks at .golangci.yml
❯ golangci-lint run ./...
pkg/pciids/pciids.go:399:4: assignOp: replace `hkFullID = hkFullID & 0xFFFF0000` with `hkFullID &= 0xFFFF0000` (gocritic)
hkFullID = hkFullID & 0xFFFF0000
^
pkg/pciids/pciids.go:412:4: assignOp: replace `hkFullID = hkFullID & 0xFFFF0000` with `hkFullID &= 0xFFFF0000` (gocritic)
hkFullID = hkFullID & 0xFFFF0000
^
pkg/pciids/pciids.go:415:4: assignOp: replace `hkFullID = hkFullID & 0xFFFFFF00` with `hkFullID &= 0xFFFFFF00` (gocritic)
hkFullID = hkFullID & 0xFFFFFF00
^
pkg/pciids/pciids.go:413:4: assignOp: replace `hkFullID = hkFullID | uint32(id)<<8` with `hkFullID |= uint32(id)<<8` (gocritic)
hkFullID = hkFullID | uint32(id)<<8
^
pkg/nvlib/device/device.go:125:2: commentFormatting: put a space between `//` and comment text (gocritic)
//case nvml.BRAND_NVIDIA_VGAMING:
^
pkg/nvml/device.go:129:47: captLocal: `Index' should not be capitalized (gocritic)
func (d nvmlDevice) GetMigDeviceHandleByIndex(Index int) (Device, Return) {
^
pkg/nvml/device.go:177:36: captLocal: `EventTypes' should not be capitalized (gocritic)
func (d nvmlDevice) RegisterEvents(EventTypes uint64, Set EventSet) Return {
^
pkg/nvml/event_set.go:24:24: captLocal: `Timeoutms' should not be capitalized (gocritic)
func (e EventSet) Wait(Timeoutms uint32) (EventData, Return) {
^
pkg/nvpci/nvpci.go:246:2: ifElseChain: rewrite if-else to switch statement (gocritic)
if err == nil {
^
pkg/nvpci/nvpci.go:256:2: ifElseChain: rewrite if-else to switch statement (gocritic)
if err == nil {
^
pkg/nvpci/resources.go:126:4: assignOp: replace `memSize32bit = memSize32bit + uint64(memSize)` with `memSize32bit += uint64(memSize)` (gocritic)
memSize32bit = memSize32bit + uint64(memSize)
^
pkg/nvpci/resources.go:129:4: assignOp: replace `memSize64bit = memSize64bit + uint64(memSize)` with `memSize64bit += uint64(memSize)` (gocritic)
memSize64bit = memSize64bit + uint64(memSize)
^
pkg/nvpci/resources.go:115:3: assignOp: replace `numBAR = numBAR + 1` with `numBAR++` (gocritic)
numBAR = numBAR + 1
^
pkg/pciids/pciids.go:116:19: func `(*scanner).unread` is unused (unused)
func (s *scanner) unread() { _ = s.r.UnreadRune() }
^
pkg/pciids/pciids.go:251:18: func `(*parser).unscan` is unused (unused)
func (p *parser) unscan() { p.buf.n = 1 }
^
pkg/nvpci/mock.go:46:2: type assertion must be checked (forcetypeassert)
mock = &MockNvpci{
^
pkg/nvml/consts.go:25:2: ST1003: should not use ALL_CAPS in Go names; use CamelCase instead (stylecheck)
NVLINK_MAX_LINKS = nvml.NVLINK_MAX_LINKS
^
pkg/nvml/consts.go:31:2: ST1003: should not use ALL_CAPS in Go names; use CamelCase instead (stylecheck)
ERROR_UNINITIALIZED = Return(nvml.ERROR_UNINITIALIZED)
^
pkg/nvml/consts.go:32:2: ST1003: should not use ALL_CAPS in Go names; use CamelCase instead (stylecheck)
ERROR_INVALID_ARGUMENT = Return(nvml.ERROR_INVALID_ARGUMENT)
^
pkg/nvml/device.go:85:21: ST1003: method GetGpuInstanceById should be GetGpuInstanceByID (stylecheck)
func (d nvmlDevice) GetGpuInstanceById(id int) (GpuInstance, Return) {
^
pkg/nvml/device.go:135:21: ST1003: method GetGpuInstanceId should be GetGpuInstanceID (stylecheck)
func (d nvmlDevice) GetGpuInstanceId() (int, Return) {
^
pkg/nvml/device.go:141:21: ST1003: method GetComputeInstanceId should be GetComputeInstanceID (stylecheck)
func (d nvmlDevice) GetComputeInstanceId() (int, Return) {
^
pkg/nvml/gi.go:40:27: ST1003: method GetComputeInstanceById should be GetComputeInstanceByID (stylecheck)
func (gi nvmlGpuInstance) GetComputeInstanceById(id int) (ComputeInstance, Return) {
^
pkg/nvml/types.go:99:2: ST1003: struct field Id should be ID (stylecheck)
Id uint32
^
pkg/nvml/types.go:100:2: ST1003: struct field ProfileId should be ProfileID (stylecheck)
ProfileId uint32
^
pkg/nvml/types.go:108:2: ST1003: struct field Id should be ID (stylecheck)
Id uint32
^
pkg/nvml/types.go:109:2: ST1003: struct field ProfileId should be ProfileID (stylecheck)
ProfileId uint32
^
pkg/nvml/types.go:118:2: ST1003: struct field GpuInstanceId should be GpuInstanceID (stylecheck)
GpuInstanceId uint32
^
pkg/nvml/types.go:119:2: ST1003: struct field ComputeInstanceId should be ComputeInstanceID (stylecheck)
ComputeInstanceId uint32