Skip to content

Commit 2249777

Browse files
authored
Merge pull request #15 from elezar/bump-golang-version
Bump golang version
2 parents 68b0fdd + a77d692 commit 2249777

File tree

9 files changed

+41
-13
lines changed

9 files changed

+41
-13
lines changed

.github/workflows/pre-sanity.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Run pre sanity
2+
3+
# run this workflow for each commit
4+
on: [pull_request]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Build dev image
13+
run: make .build-image
14+
15+
- name: Build
16+
run: make docker-build
17+
18+
- name: Tests
19+
run: make docker-coverage
20+
21+
- name: Checks
22+
run: make docker-check

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
MODULE := github.com/nvidia/go-gpuallocator
15+
MODULE := github.com/NVIDIA/go-gpuallocator
1616

1717
DOCKER ?= docker
1818

19-
GOLANG_VERSION := 1.15
19+
GOLANG_VERSION := 1.20.4
2020

2121
ifeq ($(IMAGE),)
2222
REGISTRY ?= nvidia

docker/Dockerfile.devel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
ARG GOLANG_VERSION=1.15
14+
ARG GOLANG_VERSION=1.20.4
1515
FROM golang:${GOLANG_VERSION}
1616

17-
RUN go get -u golang.org/x/lint/golint
17+
RUN go install golang.org/x/lint/golint@latest

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
module github.com/NVIDIA/go-gpuallocator
22

3-
go 1.15
3+
go 1.20
44

55
require github.com/NVIDIA/go-nvlib v0.0.0-20231116150931-9fd385bace0d
66

7+
require github.com/NVIDIA/go-nvml v0.12.0-1.0.20231020145430-e06766c5e74f // indirect
8+
79
replace (
810
k8s.io/api => k8s.io/api v0.18.2
911
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.2

go.sum

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
1414
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
1515
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
1616
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
17-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
1817
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1918
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2019
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

gpuallocator/device.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ type DeviceList []*Device
7272
type DeviceSet map[string]*Device
7373

7474
// NewDevices creates a list of Devices from all available nvml.Devices using the specified options.
75-
func NewDevices(opts ...deviceListOption) (DeviceList, error) {
75+
func NewDevices(opts ...Option) (DeviceList, error) {
7676
o := &deviceListBuilder{}
7777
for _, opt := range opts {
7878
opt(o)

gpuallocator/options.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,18 @@ type deviceListBuilder struct {
2727
devicelib device.Interface
2828
}
2929

30-
type deviceListOption func(*deviceListBuilder)
30+
// Option defines a type for functional options for constructing device lists.
31+
type Option func(*deviceListBuilder)
3132

3233
// WithNvmlLib provides an option to set the nvml library.
33-
func WithNvmlLib(nvmllib nvml.Interface) deviceListOption {
34+
func WithNvmlLib(nvmllib nvml.Interface) Option {
3435
return func(o *deviceListBuilder) {
3536
o.nvmllib = nvmllib
3637
}
3738
}
3839

3940
// WithDeviceLib provides an option to set the library used for device enumeration.
40-
func WithDeviceLib(devicelib device.Interface) deviceListOption {
41+
func WithDeviceLib(devicelib device.Interface) Option {
4142
return func(o *deviceListBuilder) {
4243
o.devicelib = devicelib
4344
}

internal/links/device.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ import (
2323
"github.com/NVIDIA/go-nvlib/pkg/nvml"
2424
)
2525

26+
// P2PLinkType defines the link information between two devices.
2627
type P2PLinkType uint
2728

29+
// The following constants define the nature of a link between two devices.
30+
// These include peer-2-peer and NVLink information.
2831
const (
2932
P2PLinkUnknown P2PLinkType = iota
3033
P2PLinkCrossCPU
@@ -90,11 +93,11 @@ func GetNVLink(dev1 device.Device, dev2 device.Device) (P2PLinkType, error) {
9093
if ret != nvml.SUCCESS {
9194
return P2PLinkUnknown, fmt.Errorf("failed to get pci info: %v", ret)
9295
}
93-
dev2BusId := PciInfo(dev2PciInfo).BusID()
96+
dev2BusID := PciInfo(dev2PciInfo).BusID()
9497

9598
nvlink := P2PLinkUnknown
9699
for _, pciInfo := range pciInfos {
97-
if pciInfo.BusID() == dev2BusId {
100+
if pciInfo.BusID() == dev2BusID {
98101
continue
99102
}
100103
switch nvlink {

vendor/modules.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# github.com/NVIDIA/go-nvlib v0.0.0-20231116150931-9fd385bace0d
2-
## explicit
2+
## explicit; go 1.20
33
github.com/NVIDIA/go-nvlib/pkg/nvlib/device
44
github.com/NVIDIA/go-nvlib/pkg/nvml
55
# github.com/NVIDIA/go-nvml v0.12.0-1.0.20231020145430-e06766c5e74f
6+
## explicit; go 1.15
67
github.com/NVIDIA/go-nvml/pkg/dl
78
github.com/NVIDIA/go-nvml/pkg/nvml
89
# k8s.io/api => k8s.io/api v0.18.2

0 commit comments

Comments
 (0)