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
This commit is contained in:
Mark Haines 2017-06-12 19:52:03 +01:00 committed by GitHub
parent 472155837b
commit 5e490e773f
3 changed files with 2 additions and 5 deletions

View file

@ -21,6 +21,7 @@ install:
- go get github.com/golang/lint/golint - go get github.com/golang/lint/golint
- go get github.com/fzipp/gocyclo - go get github.com/fzipp/gocyclo
- go get github.com/client9/misspell/... - go get github.com/client9/misspell/...
- go get github.com/gordonklaus/ineffassign
# Generate a self-signed X.509 certificate for TLS. # Generate a self-signed X.509 certificate for TLS.
before_script: before_script:

View file

@ -18,6 +18,7 @@ then
exit 1 exit 1
fi fi
ineffassign ./src/
go tool vet --all --shadow ./src go tool vet --all --shadow ./src
gocyclo -over 12 src/ gocyclo -over 12 src/
gb test gb test

View file

@ -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) // - the server to exit with an error (error sent on serverCmdChan)
// - our test timeout to expire // - our test timeout to expire
// We don't need to clean up since the main() function handles that in the event we panic // We don't need to clean up since the main() function handles that in the event we panic
var testPassed bool
select { select {
case <-time.After(timeout): case <-time.After(timeout):
if testPassed {
break
}
fmt.Printf("==TESTING== %v TIMEOUT\n", label) fmt.Printf("==TESTING== %v TIMEOUT\n", label)
if reqErr := r.LastErr.Get(); reqErr != nil { if reqErr := r.LastErr.Get(); reqErr != nil {
fmt.Println("Last /sync request error:") fmt.Println("Last /sync request error:")
@ -157,7 +153,6 @@ func (r *Request) Run(label string, timeout time.Duration, serverCmdChan chan er
panic(err) panic(err)
} }
case <-done: case <-done:
testPassed = true
fmt.Printf("==TESTING== %v PASSED\n", label) fmt.Printf("==TESTING== %v PASSED\n", label)
} }
} }