Skip to content

Commit

Permalink
Fix lint and vet errors discovered in Go tip (1.6)
Browse files Browse the repository at this point in the history
Fix #428
  • Loading branch information
jasdel committed Nov 14, 2015
1 parent e6e73d6 commit a8e13a9
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ unit: get-deps-unit build verify
@go test $(SDK_WITH_VENDOR_PKGS)

integration: get-deps-integ
go test ./awstesting/integration/customizations/... -tags=integration
go test -tags=integration ./awstesting/integration/customizations/...
gucumber ./awstesting/integration/smoke

verify: get-deps-verify lint vet

lint:
@echo "go lint SDK and vendor packages"
@lint=`golint ./...`; \
Expand All @@ -62,8 +63,7 @@ lint:
if [ "$$lint" != "" ]; then exit 1; fi

vet:
@echo "go vet SDK and vendor packages"
@go tool vet -all -shadow .
go tool vet -all -shadow $(shell ls -d */ | grep -v vendor)

get-deps: get-deps-unit get-deps-integ get-deps-verify
@echo "go get SDK dependencies"
Expand Down
4 changes: 2 additions & 2 deletions aws/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ var (
// not found.
//
// @readonly
ErrMissingRegion error = awserr.New("MissingRegion", "could not find region configuration", nil)
ErrMissingRegion = awserr.New("MissingRegion", "could not find region configuration", nil)

// ErrMissingEndpoint is an error that is returned if an endpoint cannot be
// resolved for a service.
//
// @readonly
ErrMissingEndpoint error = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil)
ErrMissingEndpoint = awserr.New("MissingEndpoint", "'Endpoint' configuration is required for this service", nil)
)
2 changes: 1 addition & 1 deletion awsmigrate/awsmigrate-renamer/gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func generateRenames(w io.Writer) error {
}

out := bytes.NewBuffer(nil)
if err := tmpl.Execute(out, exportMap); err != nil {
if err = tmpl.Execute(out, exportMap); err != nil {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion private/model/cli/gen-endpoints/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func main() {
SigningRegion string
}
}
if err := json.NewDecoder(in).Decode(&endpoints); err != nil {
if err = json.NewDecoder(in).Decode(&endpoints); err != nil {
panic(err)
}

Expand Down
2 changes: 1 addition & 1 deletion private/model/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func GenerateEndpoints(endpoints interface{}, w io.Writer) error {
}

out := bytes.NewBuffer(nil)
if err := tmpl.Execute(out, endpoints); err != nil {
if err = tmpl.Execute(out, endpoints); err != nil {
return err
}

Expand Down
4 changes: 2 additions & 2 deletions private/protocol/query/queryutil/queryutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix stri
continue // ignore unexported fields
}

value := elemOf(value.Field(i))
elemValue := elemOf(value.Field(i))
field := t.Field(i)
var name string

Expand All @@ -97,7 +97,7 @@ func (q *queryParser) parseStruct(v url.Values, value reflect.Value, prefix stri
name = prefix + "." + name
}

if err := q.parseValue(v, value, name, field.Tag); err != nil {
if err := q.parseValue(v, elemValue, name, field.Tag); err != nil {
return err
}
}
Expand Down
8 changes: 4 additions & 4 deletions private/signer/v2/v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (sb signerBuilder) BuildSigner() signer {
req.URL.RawQuery = sb.Query.Encode()
}

signer := signer{
sig := signer{
Request: req,
Time: sb.SignTime,
Credentials: credentials.NewStaticCredentials(
Expand All @@ -48,11 +48,11 @@ func (sb signerBuilder) BuildSigner() signer {
}

if os.Getenv("DEBUG") != "" {
signer.Debug = aws.LogDebug
signer.Logger = aws.NewDefaultLogger()
sig.Debug = aws.LogDebug
sig.Logger = aws.NewDefaultLogger()
}

return signer
return sig
}

func TestSignRequestWithAndWithoutSession(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions service/ec2/customizations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func TestCopySnapshotPresignedURL(t *testing.T) {

b, _ := ioutil.ReadAll(req.HTTPRequest.Body)
q, _ := url.ParseQuery(string(b))
url, _ := url.QueryUnescape(q.Get("PresignedUrl"))
u, _ := url.QueryUnescape(q.Get("PresignedUrl"))
assert.Equal(t, "us-west-2", q.Get("DestinationRegion"))
assert.Equal(t, "us-west-1", q.Get("SourceRegion"))
assert.Regexp(t, `^https://ec2\.us-west-1\.amazonaws\.com/.+&DestinationRegion=us-west-2`, url)
assert.Regexp(t, `^https://ec2\.us-west-1\.amazonaws\.com/.+&DestinationRegion=us-west-2`, u)
}

0 comments on commit a8e13a9

Please sign in to comment.