2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-11-14 11:31:28 +08:00

go tool vet --shadow .

This commit is contained in:
Tamir Duberstein 2016-02-03 23:49:21 -05:00
parent 4146b137dd
commit ebea4cb52a
2 changed files with 15 additions and 4 deletions

View File

@ -7,9 +7,12 @@ go:
before_install: before_install:
- go get -u github.com/golang/lint/golint - go get -u github.com/golang/lint/golint
- if [[ $TRAVIS_GO_VERSION == 1.5* ]]; then go get -u github.com/kisielk/errcheck; fi - if [[ $TRAVIS_GO_VERSION == 1.5* ]]; then go get -u github.com/kisielk/errcheck; fi
- go get -u golang.org/x/tools/cmd/vet
before_script: before_script:
- '! gofmt -s -l . | read' - '! gofmt -s -l . | read'
- golint ./... - golint ./...
- echo $TRAVIS_GO_VERSION - echo $TRAVIS_GO_VERSION
- if [[ $TRAVIS_GO_VERSION == 1.5* ]]; then errcheck ./...; fi - if [[ $TRAVIS_GO_VERSION == 1.5* ]]; then errcheck ./...; fi
- go vet .
- go tool vet --shadow .

View File

@ -46,9 +46,11 @@ func runTestHTTPServer(t *testing.T, l net.Listener) {
} }
func runTestHTTP1Client(t *testing.T, addr string) { func runTestHTTP1Client(t *testing.T, addr string) {
r, err := http.Get("http://" + addr) var r *http.Response
if err != nil { if resp, err := http.Get("http://" + addr); err != nil {
t.Fatal(err) t.Fatal(err)
} else {
r = resp
} }
defer func() { defer func() {
@ -124,9 +126,11 @@ func TestAny(t *testing.T) {
} }
}() }()
r, err := http.Get("http://" + addr) var r *http.Response
if err != nil { if resp, err := http.Get("http://" + addr); err != nil {
t.Fatal(err) t.Fatal(err)
} else {
r = resp
} }
defer func() { defer func() {
@ -135,6 +139,10 @@ func TestAny(t *testing.T) {
} }
}() }()
b, err := ioutil.ReadAll(r.Body) b, err := ioutil.ReadAll(r.Body)
if err != nil {
t.Error(err)
}
if string(b) != testHTTP1Resp { if string(b) != testHTTP1Resp {
t.Errorf("invalid response: want=%s got=%s", testHTTP1Resp, b) t.Errorf("invalid response: want=%s got=%s", testHTTP1Resp, b)
} }