add a lint script to verify that Ginkgo is not imported

This commit is contained in:
Marten Seemann
2020-02-23 09:40:51 +07:00
parent 215ca4c155
commit aa9a5a4e5f
2 changed files with 25 additions and 0 deletions

24
.travis/no_ginkgo.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# Verify that no non-test files import Ginkgo or Gomega.
set -e
HAS_TESTING=false
cd ..
for f in $(find . -name "*.go" ! -name "*_test.go"); do
if grep -q "github.com/onsi/ginkgo" $f; then
echo "$f imports github.com/onsi/ginkgo"
HAS_TESTING=true
fi
if grep -q "github.com/onsi/gomega" $f; then
echo "$f imports github.com/onsi/gomega"
HAS_TESTING=true
fi
done
if "$HAS_TESTING"; then
exit 1
fi
exit 0

View File

@@ -3,6 +3,7 @@
set -ex
if [ ${TESTMODE} == "lint" ]; then
.travis/no_ginkgo.sh
./bin/golangci-lint run ./...
fi