From 106cd9847ce99256bedcce1bc580341c03b6dcab Mon Sep 17 00:00:00 2001 From: Tariq Ibrahim Date: Thu, 11 Apr 2024 14:06:59 -0700 Subject: [PATCH 1/4] Bump golang version to 1.22.2 Signed-off-by: Tariq Ibrahim --- deployments/systemd/install.sh | 2 +- versions.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deployments/systemd/install.sh b/deployments/systemd/install.sh index f8eccf17..01ab4ee0 100755 --- a/deployments/systemd/install.sh +++ b/deployments/systemd/install.sh @@ -45,7 +45,7 @@ chmod a+rx ${PROFILED_DIR} ${DOCKER} run --rm \ -v ${BINARY_DIR}:/dest \ - golang:1.20.1 \ + golang:1.22.2 \ sh -c " go install $MIG_PARTED_GO_GET_PATH@latest mv /go/bin/nvidia-mig-parted /dest/nvidia-mig-parted diff --git a/versions.mk b/versions.mk index 02991da6..4b6aefd0 100644 --- a/versions.mk +++ b/versions.mk @@ -17,7 +17,7 @@ VERSION ?= v0.6.0 vVERSION := v$(VERSION:v%=%) -GOLANG_VERSION := 1.20.5 +GOLANG_VERSION := 1.22.2 BUILDIMAGE_TAG ?= devel-go$(GOLANG_VERSION) BUILDIMAGE ?= ghcr.io/nvidia/k8s-test-infra:$(BUILDIMAGE_TAG) From 21ecf2fdd2175a7dba4ffea89dae89fd8fc4223e Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Thu, 18 Apr 2024 10:12:03 +0200 Subject: [PATCH 2/4] Use version.mk golang version in CI Signed-off-by: Evan Lezar --- .github/workflows/golang.yaml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/golang.yaml b/.github/workflows/golang.yaml index 38a77a33..fc5acb4b 100644 --- a/.github/workflows/golang.yaml +++ b/.github/workflows/golang.yaml @@ -16,6 +16,9 @@ name: Golang on: pull_request: + types: + - opened + - synchronize branches: - main - release-* @@ -29,28 +32,45 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - + name: Checkout code + - name: Get Golang version + id: vars + run: | + GOLANG_VERSION=$( grep "GOLANG_VERSION :=" versions.mk ) + echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GOLANG_VERSION }} - name: Lint uses: golangci/golangci-lint-action@v4 with: version: latest args: -v --timeout 5m skip-cache: true + - name: Check golang modules + run: make check-vendor test: name: Unit test runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 + - name: Get Golang version + id: vars + run: | + GOLANG_VERSION=$( grep "GOLANG_VERSION :=" versions.mk ) + echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV - name: Install Go uses: actions/setup-go@v5 with: - go-version: '1.20' + go-version: ${{ env.GOLANG_VERSION }} - run: make test build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + name: Checkout code - name: Build run: make docker-build From d0e57e69ac63128248edeeacb6c480fac514f870 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Thu, 18 Apr 2024 10:15:31 +0200 Subject: [PATCH 3/4] Add check-vendor target Signed-off-by: Evan Lezar --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1c205941..dd8ef674 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/)))) CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS)) CHECK_TARGETS := lint -MAKE_TARGETS := binaries build check fmt lint-internal test examples cmds coverage generate $(CHECK_TARGETS) +MAKE_TARGETS := binaries build check fmt lint-internal test examples cmds coverage generate vendor check-vendor $(CHECK_TARGETS) TARGETS := $(MAKE_TARGETS) $(EXAMPLE_TARGETS) $(CMD_TARGETS) @@ -73,6 +73,14 @@ goimports: lint: golangci-lint run ./... +vendor: + go mod tidy + go mod vendor + go mod verify + +check-vendor: vendor + git diff --quiet HEAD -- go.mod go.sum vendor + COVERAGE_FILE := coverage.out test: build cmds go test -coverprofile=$(COVERAGE_FILE) $(MODULE)/cmd/... $(MODULE)/internal/... $(MODULE)/api/... From 40d1530e0dea7c432a9096bcd1ec9b2675468220 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Thu, 18 Apr 2024 10:43:26 +0200 Subject: [PATCH 4/4] Update modules Signed-off-by: Evan Lezar --- go.mod | 4 +++- go.sum | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index a8597ef2..7284b7be 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/NVIDIA/mig-parted -go 1.20 +go 1.21 + +toolchain go1.22.2 require ( github.com/NVIDIA/go-nvlib v0.2.0 diff --git a/go.sum b/go.sum index 46aa4922..46d5565a 100644 --- a/go.sum +++ b/go.sum @@ -19,6 +19,7 @@ github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -33,6 +34,7 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= @@ -45,6 +47,7 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -59,10 +62,13 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/onsi/ginkgo/v2 v2.13.0 h1:0jY9lJquiL8fcf3M4LAXN5aMlS/b2BV86HFFPCPMgE4= +github.com/onsi/ginkgo/v2 v2.13.0/go.mod h1:TE309ZR8s5FsKKpuB1YAQYBzCaAfUgatB/xlT/ETL/o= github.com/onsi/gomega v1.29.0 h1:KIA/t2t5UBzoirT4H9tsML45GEbo3ouUnBHsCfD2tVg= +github.com/onsi/gomega v1.29.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= @@ -122,6 +128,7 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.16.1 h1:TLyB3WofjdOEepBHAU20JdNC1Zbg87elYofWYAY5oZA= +golang.org/x/tools v0.16.1/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=