From 1e266176baef159a24b4e8bb61c429bccfbee7ac Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Tue, 7 Mar 2023 13:21:47 +0000 Subject: [PATCH 1/3] test: fix golint error --- .github/workflows/static.yaml | 13 ++++++++----- go.mod | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/static.yaml b/.github/workflows/static.yaml index 0a693099..fa2f9c9f 100644 --- a/.github/workflows/static.yaml +++ b/.github/workflows/static.yaml @@ -7,12 +7,15 @@ jobs: name: Go Lint runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@master - - name: Run linter - uses: golangci/golangci-lint-action@v2 + - name: Set up Go 1.x + uses: actions/setup-go@v3 with: - version: v1.45 + go-version: ^1.19 + - uses: actions/checkout@master + - name: Run linter + uses: golangci/golangci-lint-action@v3 + with: + version: v1.51 args: -E=gofmt,deadcode,unused,varcheck,ineffassign,revive,misspell,exportloopref,asciicheck,bodyclose,contextcheck --timeout=30m0s verify-helm: name: Verify Helm diff --git a/go.mod b/go.mod index 467ee5df..d5824db2 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/kubernetes-csi/csi-driver-nfs -go 1.18 +go 1.19 require ( github.com/container-storage-interface/spec v1.5.0 From 48ae4a19636ea1779f937273cc9ac1dd8a0705a8 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Tue, 7 Mar 2023 13:43:10 +0000 Subject: [PATCH 2/3] cleanup: fix golint error --- pkg/nfs/nfs_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/nfs/nfs_test.go b/pkg/nfs/nfs_test.go index c4e23f89..ea642e38 100644 --- a/pkg/nfs/nfs_test.go +++ b/pkg/nfs/nfs_test.go @@ -17,7 +17,6 @@ limitations under the License. package nfs import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -65,7 +64,7 @@ func TestNewFakeDriver(t *testing.T) { } func TestIsCorruptedDir(t *testing.T) { - existingMountPath, err := ioutil.TempDir(os.TempDir(), "csi-mount-test") + existingMountPath, err := os.MkdirTemp(os.TempDir(), "csi-mount-test") if err != nil { t.Fatalf("failed to create tmp dir: %v", err) } From 8e4d023923a498abdf087c8cafc629a25fd4c98b Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Tue, 7 Mar 2023 14:36:40 +0000 Subject: [PATCH 3/3] Squashed 'release-tools/' changes from aa61bfd0..e322ce5e e322ce5e Merge pull request #220 from andyzhangx/fix-golint-error b74a5120 test: fix golint error git-subtree-dir: release-tools git-subtree-split: e322ce5e5b2b384148a527a5784959b685b296b4 --- filter-junit.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/filter-junit.go b/filter-junit.go index c1b7b619..aab1b8b6 100644 --- a/filter-junit.go +++ b/filter-junit.go @@ -24,7 +24,6 @@ package main import ( "encoding/xml" "flag" - "io/ioutil" "os" "regexp" ) @@ -96,7 +95,7 @@ func main() { } } else { var err error - data, err = ioutil.ReadFile(input) + data, err = os.ReadFile(input) if err != nil { panic(err) } @@ -143,7 +142,7 @@ func main() { panic(err) } } else { - if err := ioutil.WriteFile(*output, data, 0644); err != nil { + if err := os.WriteFile(*output, data, 0644); err != nil { panic(err) } }