aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2017-06-12 19:52:03 +0100
committerGitHub <noreply@github.com>2017-06-12 19:52:03 +0100
commit5e490e773f9e61c4267040dbfc9b3c5594e66ad9 (patch)
tree1b1faa16e36fc508d395f49eeedaebe08e0dbfcd
parent472155837b358ce7d4eab76d126a318f38a1c535 (diff)
Add ineffassign to the pre-commit hooks (#139)
* Add ineffassign to the pre-comiit hooks * Fix travis.yml * Only apply ineffassign to the /src directory
-rw-r--r--.travis.yml1
-rwxr-xr-xhooks/pre-commit1
-rw-r--r--src/github.com/matrix-org/dendrite/common/test/client.go5
3 files changed, 2 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml
index 932a5a60..27f6cb90 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,6 +21,7 @@ install:
- go get github.com/golang/lint/golint
- go get github.com/fzipp/gocyclo
- go get github.com/client9/misspell/...
+ - go get github.com/gordonklaus/ineffassign
# Generate a self-signed X.509 certificate for TLS.
before_script:
diff --git a/hooks/pre-commit b/hooks/pre-commit
index 523ce0af..abce0f59 100755
--- a/hooks/pre-commit
+++ b/hooks/pre-commit
@@ -18,6 +18,7 @@ then
exit 1
fi
+ineffassign ./src/
go tool vet --all --shadow ./src
gocyclo -over 12 src/
gb test
diff --git a/src/github.com/matrix-org/dendrite/common/test/client.go b/src/github.com/matrix-org/dendrite/common/test/client.go
index d8f4fd01..7d7b0589 100644
--- a/src/github.com/matrix-org/dendrite/common/test/client.go
+++ b/src/github.com/matrix-org/dendrite/common/test/client.go
@@ -136,12 +136,8 @@ func (r *Request) Run(label string, timeout time.Duration, serverCmdChan chan er
// - the server to exit with an error (error sent on serverCmdChan)
// - our test timeout to expire
// We don't need to clean up since the main() function handles that in the event we panic
- var testPassed bool
select {
case <-time.After(timeout):
- if testPassed {
- break
- }
fmt.Printf("==TESTING== %v TIMEOUT\n", label)
if reqErr := r.LastErr.Get(); reqErr != nil {
fmt.Println("Last /sync request error:")
@@ -157,7 +153,6 @@ func (r *Request) Run(label string, timeout time.Duration, serverCmdChan chan er
panic(err)
}
case <-done:
- testPassed = true
fmt.Printf("==TESTING== %v PASSED\n", label)
}
}