mirror of
https://github.com/safing/portbase
synced 2025-09-02 10:40:39 +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
|
scripted=0
|
||||||
goUp="\\e[1A"
|
goUp="\\e[1A"
|
||||||
all=0
|
all=0
|
||||||
|
fullTestFlags="-short"
|
||||||
install=0
|
install=0
|
||||||
|
|
||||||
function help {
|
function help {
|
||||||
|
@ -99,6 +100,7 @@ while true; do
|
||||||
;;
|
;;
|
||||||
"all")
|
"all")
|
||||||
all=1
|
all=1
|
||||||
|
fullTestFlags=""
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -157,7 +159,7 @@ if [[ "$1" == "" ]]; then
|
||||||
else
|
else
|
||||||
# single package testing
|
# single package testing
|
||||||
packages=$(go list)/$1
|
packages=$(go list)/$1
|
||||||
if [[ ! -d "$packages" ]]; then
|
if [[ ! -d "$GOPATH/src/$packages" ]]; then
|
||||||
echo "go package $packages does not exist"
|
echo "go package $packages does not exist"
|
||||||
help
|
help
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -174,7 +176,7 @@ for package in $packages; do
|
||||||
checkformat $package
|
checkformat $package
|
||||||
run golint -set_exit_status -min_confidence 1.0 $package
|
run golint -set_exit_status -min_confidence 1.0 $package
|
||||||
run go vet $package
|
run go vet $package
|
||||||
run go test -cover $package
|
run go test -cover $fullTestFlags $package
|
||||||
if [[ $all -eq 1 ]]; then
|
if [[ $all -eq 1 ]]; then
|
||||||
run golangci-lint run $GOPATH/src/$package
|
run golangci-lint run $GOPATH/src/$package
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue