Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v8
with:
version: latest
args: -v --timeout 5m
Expand Down
63 changes: 35 additions & 28 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
run:
deadline: 10m

version: "2"
linters:
enable:
- contextcheck
- errcheck
- gocritic
- gofmt
- goimports
- gosec
- gosimple
- govet
- ineffassign
- misspell
- staticcheck
- unconvert
- unused

linters-settings:
goimports:
local-prefixes: github.com/NVIDIA/go-gpuallocator

issues:
exclude-rules:
# We disable the memory aliasing checks in tests
- path: ".*_test.go"
linters:
- gosec
text: "G601: Implicit memory aliasing in for loop"
# We create world-readable files in tests.
- path: ".*_test.go"
linters:
- gosec
text: "G306: Expect WriteFile permissions to be 0600 or less"
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- gosec
path: .*_test.go
text: 'G601: Implicit memory aliasing in for loop'
- linters:
- gosec
path: .*_test.go
text: 'G306: Expect WriteFile permissions to be 0600 or less'
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
settings:
goimports:
local-prefixes:
- github.com/NVIDIA/go-gpuallocator
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion gpuallocator/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (a *Allocator) Allocate(num int) []*Device {

err := a.AllocateSpecific(devices...)
if err != nil {
err = fmt.Errorf("Internal error while allocating GPUs: %v", err)
err = fmt.Errorf("internal error while allocating GPUs: %v", err)
panic(err)
}

Expand Down
4 changes: 2 additions & 2 deletions gpuallocator/besteffort_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func iterateGPUPartitions(devices []*Device, size int, callback func([][]*Device
// the set '[[0 1 2 3 <nil>], [4 5 6 7 <nil>]]' as a candidate for
// allocating 5 GPUs from a set of 8.
p := gpuSetCountPadding(set)
if !(p == 0 || p == padding) {
if p != 0 && p != padding {
return
}

Expand Down Expand Up @@ -311,7 +311,7 @@ func calculateGPUPairScore(gpu0 *Device, gpu1 *Device) int {
}

if len(gpu0.Links[gpu1.Index]) != len(gpu1.Links[gpu0.Index]) {
err := fmt.Errorf("Internal error in bestEffort GPU allocator: all P2PLinks between 2 GPUs should be bidirectional")
err := fmt.Errorf("internal error in bestEffort GPU allocator: all P2PLinks between 2 GPUs should be bidirectional")
panic(err)
}

Expand Down