Merge pull request #2372 from lucas-clemente/no-ginkgo-lint

remove stray GinkgoRecover(), add a lint script to check that
This commit is contained in:
Marten Seemann
2020-02-24 13:49:27 +07:00
committed by GitHub
3 changed files with 25 additions and 2 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

View File

@@ -17,7 +17,6 @@ import (
"github.com/lucas-clemente/quic-go"
"github.com/lucas-clemente/quic-go/internal/utils"
"github.com/marten-seemann/qpack"
"github.com/onsi/ginkgo"
)
// allows mocking of quic.Listen and quic.ListenAddr
@@ -198,7 +197,6 @@ func (s *Server) handleConn(sess quic.EarlySession) {
return
}
go func() {
defer ginkgo.GinkgoRecover()
rerr := s.handleRequest(sess, str, decoder, func() {
sess.CloseWithError(quic.ErrorCode(errorFrameUnexpected), "")
})