Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .golangci.max.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: "2"
linters:
enable:
- dogsled
- errcheck
- gocritic
- govet
- gocyclo
- ineffassign
- misspell
- nakedret
- revive
- staticcheck
- unconvert
- unparam
- unused
exclusions:
paths:
- third_party
formatters:
enable:
- gofmt
- goimports
exclusions:
paths:
- third_party
26 changes: 26 additions & 0 deletions .golangci.min.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: "2"
linters:
enable:
- govet
- gocyclo
disable:
- errcheck
- staticcheck
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party
- '(.+)_test\.go'
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party
16 changes: 14 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ run:
timeout: 7m
linters:
enable:
- dogsled
- errcheck
- gocritic
- revive
- govet
- gocyclo
- ineffassign
- misspell
- nakedret
- revive
- staticcheck
- unconvert
- unparam
- dogsled
- unused
settings:
staticcheck:
checks:
Expand All @@ -23,6 +27,7 @@ linters:
- "-ST1020"
- "-ST1021"
- "-ST1022"
# Omit embedded fields from selector expression
- "-QF1008"

revive:
Expand Down Expand Up @@ -165,3 +170,10 @@ linters:
- path: '(.+)\.go$'
text: "Error return value of `.*` is not checked"
linter: errcheck
formatters:
enable:
- gofmt
- goimports
exclusions:
paths:
- third_party
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,20 @@ MINIKUBE_RELEASES_URL=https://github.com/kubernetes/minikube/releases/download

# latest from https://github.com/golangci/golangci-lint/releases
# update this only by running `make update-golint-version`
GOLINT_VERSION ?= v2.1.5
GOLINT_VERSION ?= v2.1.6
# see https://golangci-lint.run/docs/configuration/file/ for config details
GOLINT_CONFIG ?= .golangci.yaml
# Set this to --verbose to see details about the linters and formatters used
GOLINT_VERBOSE ?=
# Limit number of default jobs, to avoid the CI builds running out of memory
GOLINT_JOBS ?= 4
# see https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint
GOLINT_GOGC ?= 100
# options for lint (golangci-lint)
GOLINT_OPTIONS = \
--max-issues-per-linter 0 --max-same-issues 0 \
--build-tags "${MINIKUBE_INTEGRATION_BUILD_TAGS}" \
--config .golangci.yaml
--config $(GOLINT_CONFIG) $(GOLINT_VERBOSE)

export GO111MODULE := on

Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/config/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type ViewTemplate struct {
var configViewCmd = &cobra.Command{
Use: "view",
Short: "Display values currently set in the minikube config file",
Long: `Display values currently set in the minikube config file.
Long: `Display values currently set in the minikube config file.
The output format can be customized using the --format flag, which accepts a Go template.
The config file is typically located at "~/.minikube/config/config.json".`,
Run: func(_ *cobra.Command, _ []string) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ func updateDriver(driverName string) {
}
if errors.Is(err, auxdriver.ErrAuxDriverVersionNotinPath) {
exit.Error(reason.DrvAuxNotHealthy, "Aux driver"+driverName, err)
} //if failed to update but not a fatal error, log it and continue (old version might still work)
} // if failed to update but not a fatal error, log it and continue (old version might still work)
out.WarningT("Unable to update {{.driver}} driver: {{.error}}", out.V{"driver": driverName, "error": err})
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/assets/addons_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func mapsEqual(a, b map[string]string) bool {

func TestParseMapString(t *testing.T) {
cases := map[string]map[string]string{
"Aardvark=1,B=2,Cantaloupe=3": {"Aardvark": "1", "B": "2", "Cantaloupe": "3"},
"Aardvark=1,B=2,Cantaloupe=3": {"Aardvark": "1", "B": "2", "Cantaloupe": "3"},
"A=,B=2,C=": {"A": "", "B": "2", "C": ""},
"": {},
"malformed,good=howdy,manyequals==,": {"good": "howdy"},
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/assets/vm_assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import (
"bytes"
"embed"
"fmt"
"text/template"
"io"
"os"
"path"
"path/filepath"
"strconv"
"strings"
"text/template"
"time"

"github.com/pkg/errors"
Expand Down
16 changes: 8 additions & 8 deletions pkg/minikube/download/licenses.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ func Licenses(dir string) error {
return fmt.Errorf("failed to create temporary file: %v", err)
}
defer func() {
if err := os.Remove(tempFile.Name()); err != nil {
klog.Warningf("Failed to remove temp file %s: %v", tempFile.Name(), err)
}
}()
if err := os.Remove(tempFile.Name()); err != nil {
klog.Warningf("Failed to remove temp file %s: %v", tempFile.Name(), err)
}
}()
defer func() {
if err := tempFile.Close(); err != nil {
klog.Warningf("Failed to close temp file %s: %v", tempFile.Name(), err)
}
}()
if err := tempFile.Close(); err != nil {
klog.Warningf("Failed to close temp file %s: %v", tempFile.Name(), err)
}
}()

if _, err := io.Copy(tempFile, resp.Body); err != nil {
return fmt.Errorf("failed to copy downloaded content from %s: %v", url, err)
Expand Down
6 changes: 4 additions & 2 deletions pkg/minikube/tunnel/route_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ Persistent Routes:
expectedRt := routingTable{
routingTableLine{
route: unsafeParseRoute("127.0.0.1", "10.96.0.0/12"),
line: " 10.96.0.0 255.240.0.0 127.0.0.1 127.0.0.1 281",
line: " 10.96.0.0 255.240.0.0" +
" 127.0.0.1 127.0.0.1 281",
},
routingTableLine{
route: unsafeParseRoute("192.168.1.2", "10.211.55.0/24"),
line: " 10.211.55.0 255.255.255.0 192.168.1.2 10.211.55.3 281",
line: " 10.211.55.0 255.255.255.0" +
" 192.168.1.2 10.211.55.3 281",
},
}
if !reflect.DeepEqual(rt.String(), expectedRt.String()) {
Expand Down
Loading