Commit 3e710c0b authored by Rob Pike's avatar Rob Pike

all: fix shadowing bugs found by go tool vet -shadow

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10328044
parent 9824b018
...@@ -553,12 +553,13 @@ func TestRoundTripGzip(t *testing.T) { ...@@ -553,12 +553,13 @@ func TestRoundTripGzip(t *testing.T) {
res, err := DefaultTransport.RoundTrip(req) res, err := DefaultTransport.RoundTrip(req)
var body []byte var body []byte
if test.compressed { if test.compressed {
gzip, err := gzip.NewReader(res.Body) var r *gzip.Reader
r, err = gzip.NewReader(res.Body)
if err != nil { if err != nil {
t.Errorf("%d. gzip NewReader: %v", i, err) t.Errorf("%d. gzip NewReader: %v", i, err)
continue continue
} }
body, err = ioutil.ReadAll(gzip) body, err = ioutil.ReadAll(r)
res.Body.Close() res.Body.Close()
} else { } else {
body, err = ioutil.ReadAll(res.Body) body, err = ioutil.ReadAll(res.Body)
......
...@@ -158,9 +158,10 @@ func (f *File) readdir(n int) (fi []FileInfo, err error) { ...@@ -158,9 +158,10 @@ func (f *File) readdir(n int) (fi []FileInfo, err error) {
names, err := f.Readdirnames(n) names, err := f.Readdirnames(n)
fi = make([]FileInfo, len(names)) fi = make([]FileInfo, len(names))
for i, filename := range names { for i, filename := range names {
fip, err := Lstat(dirname + filename) fip, lerr := Lstat(dirname + filename)
if err == nil { if err == nil {
fi[i] = fip fi[i] = fip
err = lerr
} else { } else {
fi[i] = &fileStat{name: filename} fi[i] = &fileStat{name: filename}
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment