Emit errcheck-passing code

This commit is contained in:
Tamir Duberstein 2015-05-08 16:05:20 -04:00
parent 476077970b
commit c3e4c77465
4 changed files with 29 additions and 4 deletions

View File

@ -1,3 +1,16 @@
all: regen check
regen: regen:
go install ./... go install ./...
make -C testdata regen make -C testdata regen
.PHONY: check
check: errcheck
errcheck testdata/out/compress-memcopy.go
errcheck testdata/out/compress-nomemcopy.go
errcheck testdata/out/debug.go
errcheck testdata/out/nocompress-memcopy.go
errcheck testdata/out/nocompress-nomemcopy.go
errcheck:
go get github.com/kisielk/errcheck

View File

@ -129,11 +129,14 @@ func bindata_read(data, name string) ([]byte, error) {
var buf bytes.Buffer var buf bytes.Buffer
_, err = io.Copy(&buf, gz) _, err = io.Copy(&buf, gz)
gz.Close() clErr := gz.Close()
if err != nil { if err != nil {
return nil, fmt.Errorf("Read %%q: %%v", name, err) return nil, fmt.Errorf("Read %%q: %%v", name, err)
} }
if clErr != nil {
return nil, err
}
return buf.Bytes(), nil return buf.Bytes(), nil
} }
@ -164,11 +167,14 @@ func bindata_read(data []byte, name string) ([]byte, error) {
var buf bytes.Buffer var buf bytes.Buffer
_, err = io.Copy(&buf, gz) _, err = io.Copy(&buf, gz)
gz.Close() clErr := gz.Close()
if err != nil { if err != nil {
return nil, fmt.Errorf("Read %%q: %%v", name, err) return nil, fmt.Errorf("Read %%q: %%v", name, err)
} }
if clErr != nil {
return nil, err
}
return buf.Bytes(), nil return buf.Bytes(), nil
} }

View File

@ -21,11 +21,14 @@ func bindata_read(data []byte, name string) ([]byte, error) {
var buf bytes.Buffer var buf bytes.Buffer
_, err = io.Copy(&buf, gz) _, err = io.Copy(&buf, gz)
gz.Close() clErr := gz.Close()
if err != nil { if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err) return nil, fmt.Errorf("Read %q: %v", name, err)
} }
if clErr != nil {
return nil, err
}
return buf.Bytes(), nil return buf.Bytes(), nil
} }

View File

@ -31,11 +31,14 @@ func bindata_read(data, name string) ([]byte, error) {
var buf bytes.Buffer var buf bytes.Buffer
_, err = io.Copy(&buf, gz) _, err = io.Copy(&buf, gz)
gz.Close() clErr := gz.Close()
if err != nil { if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err) return nil, fmt.Errorf("Read %q: %v", name, err)
} }
if clErr != nil {
return nil, err
}
return buf.Bytes(), nil return buf.Bytes(), nil
} }