diff --git a/.travis.yml b/.travis.yml index 1f3613b..b71954e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,15 @@ before_script: - FIXED=$(go fmt ./... | wc -l); if [ $FIXED -gt 0 ]; then echo "gofmt - $FIXED file(s) not formatted correctly, please run gofmt to fix this." && exit 1; fi script: + - go test -v ./autoscaling/ - go test -v ./aws/ + - go test -v ./cloudfront/ - go test -v ./cloudwatch/ - go test -v ./dynamodb/ - go test -v ./ec2/ - go test -v ./elb/ - go test -v ./iam/ + - go test -v ./rds/ + - go test -v ./route53/ - go test -v ./s3/ - go test -v ./sqs/ - - go test -v ./autoscaling/ - - go test -v ./rds/ diff --git a/rds/rds.go b/rds/rds.go index 543bdbc..f00b52c 100644 --- a/rds/rds.go +++ b/rds/rds.go @@ -8,7 +8,7 @@ import ( "strconv" ) -const debug = true +const debug = false const ( ServiceName = "rds" diff --git a/s3/responses_test.go b/s3/responses_test.go index 7ceaba8..414ede0 100644 --- a/s3/responses_test.go +++ b/s3/responses_test.go @@ -2,9 +2,13 @@ package s3_test var GetObjectErrorDump = ` -NoSuchBucketThe specified bucket does not exist -non-existent-bucket3F1B667FAD71C3D8 -L4ee/zrm1irFXY5F45fKXIRdOf9ktsKY/8TDVawuMK2jWRb1RF84i1uBzkdNqS5D + + NoSuchBucket + The specified bucket does not exist + non-existent-bucket + 3F1B667FAD71C3D8 + L4ee/zrm1irFXY5F45fKXIRdOf9ktsKY/8TDVawuMK2jWRb1RF84i1uBzkdNqS5D + ` var GetListResultDump1 = ` diff --git a/s3/s3.go b/s3/s3.go index 7689b1b..9831c35 100644 --- a/s3/s3.go +++ b/s3/s3.go @@ -168,11 +168,15 @@ func (b *Bucket) DelBucket() (err error) { // See http://goo.gl/isCO7 for details. func (b *Bucket) Get(path string) (data []byte, err error) { body, err := b.GetReader(path) + defer func() { + if body != nil { + body.Close() + } + }() if err != nil { return nil, err } data, err = ioutil.ReadAll(body) - body.Close() return data, err } @@ -946,7 +950,7 @@ func (s3 *S3) run(req *request, resp interface{}) (*http.Response, error) { log.Printf("} -> %s\n", dump) } if hresp.StatusCode != 200 && hresp.StatusCode != 204 { - hresp.Body.Close() + defer hresp.Body.Close() return nil, buildError(hresp) } if resp != nil {