Skip to content

Commit

Permalink
fix lint issues reported by golangci-lint
Browse files Browse the repository at this point in the history
Signed-off-by: Tariq Ibrahim <tibrahim@nvidia.com>
  • Loading branch information
tariq1890 committed Oct 7, 2024
1 parent e7a892d commit 1f5df3d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
deadline: 10m
timeout: 10m

linters:
enable:
Expand Down
11 changes: 1 addition & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,9 @@ assert-fmt:
rm fmt.out; \
fi

ineffassign:
ineffassign $(MODULE)/...

lint:
# We use `go list -f '{{.Dir}}' $(MODULE)/...` to skip the `vendor` folder.
go list -f '{{.Dir}}' $(MODULE)/... | xargs golint -set_exit_status

misspell:
misspell $(MODULE)/...

vet:
go vet $(MODULE)/...
golangci-lint run ./...

COVERAGE_FILE := coverage.out
test: build
Expand Down
2 changes: 1 addition & 1 deletion cmd/nvidia-vgpu-dm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ func main() {

err := c.Run(os.Args)
if err != nil {
log.Fatalf(err.Error())
log.Fatal(err.Error())
}
}
4 changes: 3 additions & 1 deletion pkg/types/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewDeviceID(device, vendor uint16) DeviceID {

// NewDeviceIDFromString constructs a 'DeviceID' from its string representation.
func NewDeviceIDFromString(str string) (DeviceID, error) {
deviceID, err := strconv.ParseInt(str, 0, 32)
deviceID, err := strconv.ParseUint(str, 0, 32)
if err != nil {
return 0, fmt.Errorf("unable to create DeviceID from string '%v': %v", str, err)
}
Expand All @@ -45,10 +45,12 @@ func (d DeviceID) String() string {

// GetVendor returns the 'vendor' portion of a 'DeviceID'.
func (d DeviceID) GetVendor() uint16 {
// nolint:gosec // DeviceID is constructed from two uint16 numbers
return uint16(d)
}

// GetDevice returns the 'device' portion of a 'DeviceID'.
func (d DeviceID) GetDevice() uint16 {
// nolint:gosec // DeviceID is constructed from two uint16 numbers
return uint16(d >> 16)
}
2 changes: 1 addition & 1 deletion versions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ VERSION ?= v0.2.7

vVERSION := v$(VERSION:v%=%)

GOLANG_VERSION ?= 1.22.5
GOLANG_VERSION ?= 1.22.8

GIT_COMMIT ?= $(shell git describe --match="" --dirty --long --always --abbrev=40 2> /dev/null || echo "")

0 comments on commit 1f5df3d

Please sign in to comment.