Merge pull request #425 from andyzhangx/fix-golint-error
test: fix golint error
This commit is contained in:
commit
af29ce4d9f
13
.github/workflows/static.yaml
vendored
13
.github/workflows/static.yaml
vendored
@ -7,12 +7,15 @@ jobs:
|
|||||||
name: Go Lint
|
name: Go Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Set up Go 1.x
|
||||||
uses: actions/checkout@master
|
uses: actions/setup-go@v3
|
||||||
- name: Run linter
|
|
||||||
uses: golangci/golangci-lint-action@v2
|
|
||||||
with:
|
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
|
args: -E=gofmt,deadcode,unused,varcheck,ineffassign,revive,misspell,exportloopref,asciicheck,bodyclose,contextcheck --timeout=30m0s
|
||||||
verify-helm:
|
verify-helm:
|
||||||
name: Verify Helm
|
name: Verify Helm
|
||||||
|
|||||||
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
|||||||
module github.com/kubernetes-csi/csi-driver-nfs
|
module github.com/kubernetes-csi/csi-driver-nfs
|
||||||
|
|
||||||
go 1.18
|
go 1.19
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/container-storage-interface/spec v1.5.0
|
github.com/container-storage-interface/spec v1.5.0
|
||||||
|
|||||||
@ -17,7 +17,6 @@ limitations under the License.
|
|||||||
package nfs
|
package nfs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
@ -65,7 +64,7 @@ func TestNewFakeDriver(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIsCorruptedDir(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 {
|
if err != nil {
|
||||||
t.Fatalf("failed to create tmp dir: %v", err)
|
t.Fatalf("failed to create tmp dir: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"flag"
|
"flag"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
)
|
)
|
||||||
@ -96,7 +95,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var err error
|
var err error
|
||||||
data, err = ioutil.ReadFile(input)
|
data, err = os.ReadFile(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -143,7 +142,7 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := ioutil.WriteFile(*output, data, 0644); err != nil {
|
if err := os.WriteFile(*output, data, 0644); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user