diff --git a/.circleci/config.yml b/.circleci/config.yml index 06f476e1c..e95798969 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,7 +49,7 @@ executors: environment: KUBEBUILDER_VERSION: 3.1.0 KUBEBUILDER_ARCH: amd64 - GOLANGCI_LINT_VERSION: 1.25.1 + GOLANGCI_LINT_VERSION: 1.43.0 HELM_VERSION: 3.5.4 python: <<: *working_directory diff --git a/.golangci.yml b/.golangci.yml index 4b481446b..f9335f4c9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -26,14 +26,12 @@ linters: - godox - gofmt - goimports - - golint - goprintffuncname - gosec - - interfacer - - maligned - misspell - nakedret - prealloc + - revive - rowserrcheck - stylecheck - unconvert @@ -47,9 +45,14 @@ issues: # gosec - Subprocess launch(ed with variable|ing should be audited) - Expect file permissions to be 0600 or less - - Blacklisted import `crypto/md5` - - Use of weak cryptographic primitive + - Blocklisted import `crypto/md5` + - weak cryptographic primitive + - weak random number generator + - memory aliasing in for loop + - file inclusion via variable # stylecheck - at least one file in a package should have a package comment # golint - (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form) + # revive + - and that stutters diff --git a/Makefile b/Makefile index 8a6ce90b4..2972658b1 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ vet: # Run golangci-lint against code lint: - golangci-lint run --timeout 2m0s + golangci-lint run --timeout 3m0s # Generate code generate: controller-gen diff --git a/cli/chaosli/cmd/root.go b/cli/chaosli/cmd/root.go index 4a6730c09..c8b026f1b 100644 --- a/cli/chaosli/cmd/root.go +++ b/cli/chaosli/cmd/root.go @@ -25,8 +25,8 @@ import ( ) // Version will be set with the -ldflags option at compile time -var Version string = "v0" -var APILibPath string = fmt.Sprintf("chaosli-api-lib/v1beta1/%v", Version) +var Version = "v0" +var APILibPath = fmt.Sprintf("chaosli-api-lib/v1beta1/%v", Version) var cfgFile string // rootCmd represents the base command when called without any subcommands diff --git a/cli/injector/main.go b/cli/injector/main.go index c38d94565..90a8c0eb4 100644 --- a/cli/injector/main.go +++ b/cli/injector/main.go @@ -111,7 +111,7 @@ func main() { // execute command if err := rootCmd.Execute(); err != nil { - os.Exit(1) + os.Exit(1) //nolint:gocritic } } diff --git a/ddmark/validation.go b/ddmark/validation.go index 5d1812d2a..3a42a4ff4 100644 --- a/ddmark/validation.go +++ b/ddmark/validation.go @@ -14,7 +14,7 @@ import ( // AllDefinitions contains all marker definitions for this package. var AllDefinitions []*k8smarkers.Definition -var rulePrefix string = "ddmark:validation:" +var rulePrefix = "ddmark:validation:" func init() { addDefinition(Maximum(0), k8smarkers.DescribesField) diff --git a/network/dns.go b/network/dns.go index ba71900ed..4e9f12fe1 100644 --- a/network/dns.go +++ b/network/dns.go @@ -56,7 +56,7 @@ func (c dnsClient) Resolve(host string) ([]net.IP, error) { // compute possible names to resolve names := append([]string{}, podDNSConfig.NameList(host)...) - names = append([]string{}, nodeDNSConfig.NameList(host)...) + names = append(names, nodeDNSConfig.NameList(host)...) // do the request on the first configured dns resolver dnsClient := dns.Client{} diff --git a/network/tc.go b/network/tc.go index 7b5d2620c..fe921c06e 100644 --- a/network/tc.go +++ b/network/tc.go @@ -235,7 +235,7 @@ func buildCmd(module string, iface string, parent string, handle uint32, kind st // parent if parent == "root" { - cmd += fmt.Sprintf(" root") + cmd += " root" } else { cmd += fmt.Sprintf(" parent %s", parent) }