Enable staticcheck linter. Disable check for folder /pkg and /test by now.

Signed-off-by: Xun Jiang <blackpiglet@gmail.com>
This commit is contained in:
Xun Jiang
2023-01-19 16:39:38 +08:00
parent 71b459dff9
commit 955eec7033
13 changed files with 35 additions and 43 deletions

View File

@@ -24,7 +24,6 @@ import (
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"text/template"
@@ -41,7 +40,7 @@ package crds
import (
"bytes"
"compress/gzip"
"io/ioutil"
"io"
apiextinstall "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/install"
apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
@@ -65,7 +64,7 @@ func crds() []*apiextv1.CustomResourceDefinition {
if err != nil {
panic(err)
}
bytes, err := ioutil.ReadAll(gzr)
bytes, err := io.ReadAll(gzr)
if err != nil {
panic(err)
}
@@ -87,7 +86,7 @@ type templateData struct {
}
func main() {
headerBytes, err := ioutil.ReadFile(goHeaderFile)
headerBytes, err := os.ReadFile(goHeaderFile)
if err != nil {
log.Fatalln(err)
}
@@ -97,7 +96,7 @@ func main() {
}
// This is relative to config/crd/crds
manifests, err := ioutil.ReadDir("../bases")
manifests, err := os.ReadDir("../bases")
if err != nil {
log.Fatalln(err)
}

View File

@@ -28,7 +28,7 @@ import (
// minor
// patch
// prerelease (this will be alpha/beta/rc followed by a ".", followed by 1 or more digits (alpha.5)
var release_regex *regexp.Regexp = regexp.MustCompile("^v(?P<major>[[:digit:]]+)\\.(?P<minor>[[:digit:]]+)\\.(?P<patch>[[:digit:]]+)(-{1}(?P<prerelease>(alpha|beta|rc)\\.[[:digit:]]+))*")
var release_regex *regexp.Regexp = regexp.MustCompile(`^v(?P<major>[[:digit:]]+)\.(?P<minor>[[:digit:]]+)\.(?P<patch>[[:digit:]]+)(-{1}(?P<prerelease>(alpha|beta|rc)\.[[:digit:]]+))*`)
// This small program exists because checking the VELERO_VERSION rules in bash is difficult, and difficult to test for correctness.
// Calling it with --verify will verify whether or not the VELERO_VERSION environment variable is a valid version string, without parsing for its components.