diff --git a/.golangci.yml b/.golangci.yml index a618ec24..dad30b9d 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,47 +16,105 @@ run: deadline: 5m linters: + fast: false disable-all: true enable: - #- bodyclose + # Enabled by Default # - deadcode ! deprecated since v1.49.0; replaced by 'unused' + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - typecheck + - unused + # - varcheck ! deprecated since v1.49.0; replaced by 'unused' + # Disabled by Default + #- asasalint + #- asciicheck + #- bidichk + #- bodyclose + #- containedctx + #- contextcheck + #- cyclop + #- decorder #- depguard #- dogsled #- dupl - - errcheck + #- durationcheck + #- errchkjson + #- errname + #- errorlint + #- execinquery #- exhaustive + #- exhaustivestruct ! + #- exhaustruct + #- exportloopref + #- forbidigo + #- forcetypeassert #- funlen - gas + #- gci + #- gochecknoglobals #- gochecknoinits + #- gocognit - goconst #- gocritic #- gocyclo - #- gofmt + #- godot + #- godox + #- goerr113 + - gofmt + #- gofumpt + #- goheader - goimports - - golint + #- golint ! Use revive instead #- gomnd + #- gomoddirectives + #- gomodguard #- goprintffuncname #- gosec - #- gosimple - - govet - - ineffassign - - interfacer + #- grouper + #- ifshort ! + #- importas + - interfacer # ! + #- ireturn #- lll - - maligned + #- maintidx + #- makezero + #- maligned # Replaced by govet 'fieldalignment' - megacheck #- misspell #- nakedret + #- nestif + #- nilerr + #- nilnil + #- nlreturn #- noctx #- nolintlint + #- nonamedreturns + #- nosnakecase ! + #- nosprintfhostport + #- paralleltest + #- prealloc + #- predeclared + #- promlinter + - revive #- rowserrcheck - #- scopelint - #- staticcheck + #- scopelint ! + #- sqlclosecheck #- structcheck ! deprecated since v1.49.0; replaced by 'unused' #- stylecheck - #- typecheck + #- tagliatelle + #- tenv + #- testpackage + #- thelper + #- tparallel - unconvert #- unparam - - unused - # - varcheck ! deprecated since v1.49.0; replaced by 'unused' + #- usestdlibvars + #- varnamelen + #- wastedassign #- whitespace - fast: false + #- wrapcheck + #- wsl diff --git a/Makefile b/Makefile index 0da8d7aa..8e9b796d 100644 --- a/Makefile +++ b/Makefile @@ -5,19 +5,15 @@ ifeq (, $(shell which golangci-lint)) $(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh") endif -.PHONY: fmt lint test install_deps clean +.PHONY: lint test install_deps clean default: all -all: fmt test +all: test -fmt: - $(info ******************** checking formatting ********************) - @test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1) - -lint: - $(info ******************** running lint tools ********************) - golangci-lint run -v +install_deps: + $(info ******************** downloading dependencies ********************) + go get -v ./... test: install_deps $(info ******************** running tests ********************) @@ -27,9 +23,9 @@ richtest: install_deps $(info ******************** running tests with kyoh86/richgo ********************) richgo test -v ./... -install_deps: - $(info ******************** downloading dependencies ********************) - go get -v ./... +lint: + $(info ******************** running lint tools ********************) + golangci-lint run -v clean: rm -rf $(BIN) diff --git a/completions_test.go b/completions_test.go index df153fcf..a8cb1d01 100644 --- a/completions_test.go +++ b/completions_test.go @@ -1264,7 +1264,7 @@ func TestValidArgsFuncCmdContext(t *testing.T) { } rootCmd.AddCommand(childCmd) - //nolint:golint,staticcheck // We can safely use a basic type as key in tests. + //nolint:golint,revive,staticcheck // We can safely use a basic type as key in tests. ctx := context.WithValue(context.Background(), "testKey", "123") // Test completing an empty string on the childCmd