This commit is contained in:
Unai Martinez-Corral 2024-03-18 12:52:34 +08:00 committed by GitHub
commit 21c1eae09e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 82 additions and 28 deletions

View file

@ -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

View file

@ -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)

View file

@ -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