mirror of
https://github.com/spf13/cobra
synced 2025-04-07 07:19:16 +00:00
Merge cee7f37a01
into bd914e58d6
This commit is contained in:
commit
21c1eae09e
3 changed files with 82 additions and 28 deletions
|
@ -16,47 +16,105 @@ run:
|
||||||
deadline: 5m
|
deadline: 5m
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
|
fast: false
|
||||||
disable-all: true
|
disable-all: true
|
||||||
enable:
|
enable:
|
||||||
#- bodyclose
|
# Enabled by Default
|
||||||
# - deadcode ! deprecated since v1.49.0; replaced by 'unused'
|
# - 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
|
#- depguard
|
||||||
#- dogsled
|
#- dogsled
|
||||||
#- dupl
|
#- dupl
|
||||||
- errcheck
|
#- durationcheck
|
||||||
|
#- errchkjson
|
||||||
|
#- errname
|
||||||
|
#- errorlint
|
||||||
|
#- execinquery
|
||||||
#- exhaustive
|
#- exhaustive
|
||||||
|
#- exhaustivestruct !
|
||||||
|
#- exhaustruct
|
||||||
|
#- exportloopref
|
||||||
|
#- forbidigo
|
||||||
|
#- forcetypeassert
|
||||||
#- funlen
|
#- funlen
|
||||||
- gas
|
- gas
|
||||||
|
#- gci
|
||||||
|
#- gochecknoglobals
|
||||||
#- gochecknoinits
|
#- gochecknoinits
|
||||||
|
#- gocognit
|
||||||
- goconst
|
- goconst
|
||||||
#- gocritic
|
#- gocritic
|
||||||
#- gocyclo
|
#- gocyclo
|
||||||
#- gofmt
|
#- godot
|
||||||
|
#- godox
|
||||||
|
#- goerr113
|
||||||
|
- gofmt
|
||||||
|
#- gofumpt
|
||||||
|
#- goheader
|
||||||
- goimports
|
- goimports
|
||||||
- golint
|
#- golint ! Use revive instead
|
||||||
#- gomnd
|
#- gomnd
|
||||||
|
#- gomoddirectives
|
||||||
|
#- gomodguard
|
||||||
#- goprintffuncname
|
#- goprintffuncname
|
||||||
#- gosec
|
#- gosec
|
||||||
#- gosimple
|
#- grouper
|
||||||
- govet
|
#- ifshort !
|
||||||
- ineffassign
|
#- importas
|
||||||
- interfacer
|
- interfacer # !
|
||||||
|
#- ireturn
|
||||||
#- lll
|
#- lll
|
||||||
- maligned
|
#- maintidx
|
||||||
|
#- makezero
|
||||||
|
#- maligned # Replaced by govet 'fieldalignment'
|
||||||
- megacheck
|
- megacheck
|
||||||
#- misspell
|
#- misspell
|
||||||
#- nakedret
|
#- nakedret
|
||||||
|
#- nestif
|
||||||
|
#- nilerr
|
||||||
|
#- nilnil
|
||||||
|
#- nlreturn
|
||||||
#- noctx
|
#- noctx
|
||||||
#- nolintlint
|
#- nolintlint
|
||||||
|
#- nonamedreturns
|
||||||
|
#- nosnakecase !
|
||||||
|
#- nosprintfhostport
|
||||||
|
#- paralleltest
|
||||||
|
#- prealloc
|
||||||
|
#- predeclared
|
||||||
|
#- promlinter
|
||||||
|
- revive
|
||||||
#- rowserrcheck
|
#- rowserrcheck
|
||||||
#- scopelint
|
#- scopelint !
|
||||||
#- staticcheck
|
#- sqlclosecheck
|
||||||
#- structcheck ! deprecated since v1.49.0; replaced by 'unused'
|
#- structcheck ! deprecated since v1.49.0; replaced by 'unused'
|
||||||
#- stylecheck
|
#- stylecheck
|
||||||
#- typecheck
|
#- tagliatelle
|
||||||
|
#- tenv
|
||||||
|
#- testpackage
|
||||||
|
#- thelper
|
||||||
|
#- tparallel
|
||||||
- unconvert
|
- unconvert
|
||||||
#- unparam
|
#- unparam
|
||||||
- unused
|
#- usestdlibvars
|
||||||
# - varcheck ! deprecated since v1.49.0; replaced by 'unused'
|
#- varnamelen
|
||||||
|
#- wastedassign
|
||||||
#- whitespace
|
#- whitespace
|
||||||
fast: false
|
#- wrapcheck
|
||||||
|
#- wsl
|
||||||
|
|
20
Makefile
20
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")
|
$(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: fmt lint test install_deps clean
|
.PHONY: lint test install_deps clean
|
||||||
|
|
||||||
default: all
|
default: all
|
||||||
|
|
||||||
all: fmt test
|
all: test
|
||||||
|
|
||||||
fmt:
|
install_deps:
|
||||||
$(info ******************** checking formatting ********************)
|
$(info ******************** downloading dependencies ********************)
|
||||||
@test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1)
|
go get -v ./...
|
||||||
|
|
||||||
lint:
|
|
||||||
$(info ******************** running lint tools ********************)
|
|
||||||
golangci-lint run -v
|
|
||||||
|
|
||||||
test: install_deps
|
test: install_deps
|
||||||
$(info ******************** running tests ********************)
|
$(info ******************** running tests ********************)
|
||||||
|
@ -27,9 +23,9 @@ richtest: install_deps
|
||||||
$(info ******************** running tests with kyoh86/richgo ********************)
|
$(info ******************** running tests with kyoh86/richgo ********************)
|
||||||
richgo test -v ./...
|
richgo test -v ./...
|
||||||
|
|
||||||
install_deps:
|
lint:
|
||||||
$(info ******************** downloading dependencies ********************)
|
$(info ******************** running lint tools ********************)
|
||||||
go get -v ./...
|
golangci-lint run -v
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BIN)
|
rm -rf $(BIN)
|
||||||
|
|
|
@ -1264,7 +1264,7 @@ func TestValidArgsFuncCmdContext(t *testing.T) {
|
||||||
}
|
}
|
||||||
rootCmd.AddCommand(childCmd)
|
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")
|
ctx := context.WithValue(context.Background(), "testKey", "123")
|
||||||
|
|
||||||
// Test completing an empty string on the childCmd
|
// Test completing an empty string on the childCmd
|
||||||
|
|
Loading…
Reference in a new issue