mirror of
https://github.com/safing/portbase
synced 2025-09-01 18:19:57 +00:00
Improve testing with golangci-lint
This commit is contained in:
parent
71dabc1f23
commit
d16cb1ebf2
2 changed files with 10 additions and 2 deletions
6
.golangci.yml
Normal file
6
.golangci.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
linters:
|
||||
enable-all: true
|
||||
disable:
|
||||
- lll
|
||||
- gochecknoinits
|
||||
- gochecknoglobals
|
6
test
6
test
|
@ -5,6 +5,7 @@ errors=0
|
|||
scripted=0
|
||||
goUp="\\e[1A"
|
||||
all=0
|
||||
fullTestFlags="-short"
|
||||
install=0
|
||||
|
||||
function help {
|
||||
|
@ -99,6 +100,7 @@ while true; do
|
|||
;;
|
||||
"all")
|
||||
all=1
|
||||
fullTestFlags=""
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
|
@ -157,7 +159,7 @@ if [[ "$1" == "" ]]; then
|
|||
else
|
||||
# single package testing
|
||||
packages=$(go list)/$1
|
||||
if [[ ! -d "$packages" ]]; then
|
||||
if [[ ! -d "$GOPATH/src/$packages" ]]; then
|
||||
echo "go package $packages does not exist"
|
||||
help
|
||||
exit 1
|
||||
|
@ -174,7 +176,7 @@ for package in $packages; do
|
|||
checkformat $package
|
||||
run golint -set_exit_status -min_confidence 1.0 $package
|
||||
run go vet $package
|
||||
run go test -cover $package
|
||||
run go test -cover $fullTestFlags $package
|
||||
if [[ $all -eq 1 ]]; then
|
||||
run golangci-lint run $GOPATH/src/$package
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue