Merge pull request #578 from fkautz/pr_out_running_gofmt_version_on_aws_sdk_go

This commit is contained in:
Frederick F. Kautz IV
2015-04-30 19:55:25 -07:00
13 changed files with 67 additions and 71 deletions
@@ -16,8 +16,8 @@ type Struct struct {
}
var data = Struct{
A: []Struct{Struct{C: "value1"}, Struct{C: "value2"}, Struct{C: "value3"}},
a: []Struct{Struct{C: "value1"}, Struct{C: "value2"}, Struct{C: "value3"}},
A: []Struct{{C: "value1"}, {C: "value2"}, {C: "value3"}},
a: []Struct{{C: "value1"}, {C: "value2"}, {C: "value3"}},
B: &Struct{B: &Struct{C: "terminal"}, D: &Struct{C: "terminal2"}},
C: "initial",
}
@@ -40,8 +40,8 @@ func TestNoErrors(t *testing.T) {
input := &StructShape{
RequiredList: []*ConditionalStructShape{},
RequiredMap: &map[string]*ConditionalStructShape{
"key1": &ConditionalStructShape{Name: aws.String("Name")},
"key2": &ConditionalStructShape{Name: aws.String("Name")},
"key1": {Name: aws.String("Name")},
"key2": {Name: aws.String("Name")},
},
RequiredBool: aws.Boolean(true),
OptionalStruct: &ConditionalStructShape{Name: aws.String("Name")},
@@ -65,10 +65,10 @@ func TestMissingRequiredParameters(t *testing.T) {
func TestNestedMissingRequiredParameters(t *testing.T) {
input := &StructShape{
RequiredList: []*ConditionalStructShape{&ConditionalStructShape{}},
RequiredList: []*ConditionalStructShape{{}},
RequiredMap: &map[string]*ConditionalStructShape{
"key1": &ConditionalStructShape{Name: aws.String("Name")},
"key2": &ConditionalStructShape{},
"key1": {Name: aws.String("Name")},
"key2": {},
},
RequiredBool: aws.Boolean(true),
OptionalStruct: &ConditionalStructShape{},
+7 -7
View File
@@ -62,9 +62,9 @@ type jsonErrorResponse struct {
func TestRequestRecoverRetry(t *testing.T) {
reqNum := 0
reqs := []http.Response{
http.Response{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
http.Response{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
http.Response{StatusCode: 200, Body: body(`{"data":"valid"}`)},
{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
{StatusCode: 200, Body: body(`{"data":"valid"}`)},
}
s := NewService(&Config{MaxRetries: 10})
@@ -92,10 +92,10 @@ func TestRequestExhaustRetries(t *testing.T) {
reqNum := 0
reqs := []http.Response{
http.Response{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
http.Response{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
http.Response{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
http.Response{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
{StatusCode: 500, Body: body(`{"__type":"UnknownError","message":"An error occurred."}`)},
}
s := NewService(&Config{MaxRetries: -1})
@@ -15,74 +15,74 @@ type endpointEntry struct {
var endpointsMap = endpointStruct{
Version: 2,
Endpoints: map[string]endpointEntry{
"*/*": endpointEntry{
"*/*": {
Endpoint: "{service}.{region}.amazonaws.com",
},
"*/cloudfront": endpointEntry{
"*/cloudfront": {
Endpoint: "cloudfront.amazonaws.com",
SigningRegion: "us-east-1",
},
"*/cloudsearchdomain": endpointEntry{
"*/cloudsearchdomain": {
Endpoint: "",
SigningRegion: "us-east-1",
},
"*/iam": endpointEntry{
"*/iam": {
Endpoint: "iam.amazonaws.com",
SigningRegion: "us-east-1",
},
"*/importexport": endpointEntry{
"*/importexport": {
Endpoint: "importexport.amazonaws.com",
SigningRegion: "us-east-1",
},
"*/route53": endpointEntry{
"*/route53": {
Endpoint: "route53.amazonaws.com",
SigningRegion: "us-east-1",
},
"*/sts": endpointEntry{
"*/sts": {
Endpoint: "sts.amazonaws.com",
SigningRegion: "us-east-1",
},
"ap-northeast-1/s3": endpointEntry{
"ap-northeast-1/s3": {
Endpoint: "s3-{region}.amazonaws.com",
},
"ap-southeast-1/s3": endpointEntry{
"ap-southeast-1/s3": {
Endpoint: "s3-{region}.amazonaws.com",
},
"ap-southeast-2/s3": endpointEntry{
"ap-southeast-2/s3": {
Endpoint: "s3-{region}.amazonaws.com",
},
"cn-north-1/*": endpointEntry{
"cn-north-1/*": {
Endpoint: "{service}.{region}.amazonaws.com.cn",
},
"eu-central-1/s3": endpointEntry{
"eu-central-1/s3": {
Endpoint: "{service}.{region}.amazonaws.com",
},
"eu-west-1/s3": endpointEntry{
"eu-west-1/s3": {
Endpoint: "s3-{region}.amazonaws.com",
},
"sa-east-1/s3": endpointEntry{
"sa-east-1/s3": {
Endpoint: "s3-{region}.amazonaws.com",
},
"us-east-1/s3": endpointEntry{
"us-east-1/s3": {
Endpoint: "s3.amazonaws.com",
},
"us-east-1/sdb": endpointEntry{
"us-east-1/sdb": {
Endpoint: "sdb.amazonaws.com",
SigningRegion: "us-east-1",
},
"us-gov-west-1/iam": endpointEntry{
"us-gov-west-1/iam": {
Endpoint: "iam.us-gov.amazonaws.com",
},
"us-gov-west-1/s3": endpointEntry{
"us-gov-west-1/s3": {
Endpoint: "s3-{region}.amazonaws.com",
},
"us-gov-west-1/sts": endpointEntry{
"us-gov-west-1/sts": {
Endpoint: "sts.us-gov-west-1.amazonaws.com",
},
"us-west-1/s3": endpointEntry{
"us-west-1/s3": {
Endpoint: "s3-{region}.amazonaws.com",
},
"us-west-2/s3": endpointEntry{
"us-west-2/s3": {
Endpoint: "s3-{region}.amazonaws.com",
},
},
@@ -1494,10 +1494,10 @@ func TestInputService9ProtocolTestRecursiveShapesCase4(t *testing.T) {
input := &InputService9TestShapeInputShape{
RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{
RecursiveList: []*InputService9TestShapeInputService9TestShapeRecursiveStructType{
&InputService9TestShapeInputService9TestShapeRecursiveStructType{
{
NoRecurse: aws.String("foo"),
},
&InputService9TestShapeInputService9TestShapeRecursiveStructType{
{
NoRecurse: aws.String("bar"),
},
},
@@ -1529,10 +1529,10 @@ func TestInputService9ProtocolTestRecursiveShapesCase5(t *testing.T) {
input := &InputService9TestShapeInputShape{
RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{
RecursiveList: []*InputService9TestShapeInputService9TestShapeRecursiveStructType{
&InputService9TestShapeInputService9TestShapeRecursiveStructType{
{
NoRecurse: aws.String("foo"),
},
&InputService9TestShapeInputService9TestShapeRecursiveStructType{
{
RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{
NoRecurse: aws.String("bar"),
},
@@ -1566,10 +1566,10 @@ func TestInputService9ProtocolTestRecursiveShapesCase6(t *testing.T) {
input := &InputService9TestShapeInputShape{
RecursiveStruct: &InputService9TestShapeInputService9TestShapeRecursiveStructType{
RecursiveMap: &map[string]*InputService9TestShapeInputService9TestShapeRecursiveStructType{
"bar": &InputService9TestShapeInputService9TestShapeRecursiveStructType{
"bar": {
NoRecurse: aws.String("bar"),
},
"foo": &InputService9TestShapeInputService9TestShapeRecursiveStructType{
"foo": {
NoRecurse: aws.String("foo"),
},
},
@@ -1593,4 +1593,3 @@ func TestInputService9ProtocolTestRecursiveShapesCase6(t *testing.T) {
// assert headers
}
@@ -1542,4 +1542,3 @@ func TestOutputService14ProtocolTestNamedMapCase1(t *testing.T) {
assert.Equal(t, "bar", *(*out.Map)["qux"])
}
@@ -2346,13 +2346,13 @@ func TestInputService9ProtocolTestListOfStructuresCase1(t *testing.T) {
input := &InputService9TestShapeInputShape{
ListParam: []*InputService9TestShapeSingleFieldStruct{
&InputService9TestShapeSingleFieldStruct{
{
Element: aws.String("one"),
},
&InputService9TestShapeSingleFieldStruct{
{
Element: aws.String("two"),
},
&InputService9TestShapeSingleFieldStruct{
{
Element: aws.String("three"),
},
},
@@ -2741,10 +2741,10 @@ func TestInputService18ProtocolTestRecursiveShapesCase4(t *testing.T) {
input := &InputService18TestShapeInputShape{
RecursiveStruct: &InputService18TestShapeRecursiveStructType{
RecursiveList: []*InputService18TestShapeRecursiveStructType{
&InputService18TestShapeRecursiveStructType{
{
NoRecurse: aws.String("foo"),
},
&InputService18TestShapeRecursiveStructType{
{
NoRecurse: aws.String("bar"),
},
},
@@ -2776,10 +2776,10 @@ func TestInputService18ProtocolTestRecursiveShapesCase5(t *testing.T) {
input := &InputService18TestShapeInputShape{
RecursiveStruct: &InputService18TestShapeRecursiveStructType{
RecursiveList: []*InputService18TestShapeRecursiveStructType{
&InputService18TestShapeRecursiveStructType{
{
NoRecurse: aws.String("foo"),
},
&InputService18TestShapeRecursiveStructType{
{
RecursiveStruct: &InputService18TestShapeRecursiveStructType{
NoRecurse: aws.String("bar"),
},
@@ -2813,10 +2813,10 @@ func TestInputService18ProtocolTestRecursiveShapesCase6(t *testing.T) {
input := &InputService18TestShapeInputShape{
RecursiveStruct: &InputService18TestShapeRecursiveStructType{
RecursiveMap: &map[string]*InputService18TestShapeRecursiveStructType{
"bar": &InputService18TestShapeRecursiveStructType{
"bar": {
NoRecurse: aws.String("bar"),
},
"foo": &InputService18TestShapeRecursiveStructType{
"foo": {
NoRecurse: aws.String("foo"),
},
},
@@ -2862,4 +2862,3 @@ func TestInputService19ProtocolTestTimestampInHeaderCase1(t *testing.T) {
assert.Equal(t, "Sun, 25 Jan 2015 08:00:00 GMT", r.Header.Get("x-amz-timearg"))
}
@@ -1318,4 +1318,3 @@ func TestOutputService11ProtocolTestScalarMembersInHeadersCase1(t *testing.T) {
assert.Equal(t, true, *out.TrueBool)
}
@@ -107,7 +107,7 @@ func parseStruct(r reflect.Value, node *XMLNode, tag reflect.StructTag) error {
for _, a := range node.Attr {
if name == a.Name.Local {
// turn this into a text node for de-serializing
elems = []*XMLNode{&XMLNode{Text: a.Value}}
elems = []*XMLNode{{Text: a.Value}}
}
}
}
@@ -77,7 +77,7 @@ func StructToXML(e *xml.Encoder, node *XMLNode, sorted bool) error {
e.EncodeToken(xml.CharData([]byte(node.Text)))
} else if sorted {
sortedNames := []string{}
for k, _ := range node.Children {
for k := range node.Children {
sortedNames = append(sortedNames, k)
}
sort.Strings(sortedNames)
@@ -186,7 +186,7 @@ func (v4 *signer) buildQuery() {
func (v4 *signer) buildCanonicalHeaders() {
headers := make([]string, 0)
headers = append(headers, "host")
for k, _ := range v4.Request.Header {
for k := range v4.Request.Header {
if _, ok := ignoredHeaders[http.CanonicalHeaderKey(k)]; ok {
continue // ignored header
}
@@ -27,7 +27,7 @@ func TestMD5InPutBucketCORS(t *testing.T) {
Bucket: aws.String("bucketname"),
CORSConfiguration: &s3.CORSConfiguration{
CORSRules: []*s3.CORSRule{
&s3.CORSRule{AllowedMethods: []*string{aws.String("GET")}},
{AllowedMethods: []*string{aws.String("GET")}},
},
},
})
@@ -40,7 +40,7 @@ func TestMD5InPutBucketLifecycle(t *testing.T) {
Bucket: aws.String("bucketname"),
LifecycleConfiguration: &s3.LifecycleConfiguration{
Rules: []*s3.LifecycleRule{
&s3.LifecycleRule{
{
ID: aws.String("ID"),
Prefix: aws.String("Prefix"),
Status: aws.String("Enabled"),
@@ -57,7 +57,7 @@ func TestMD5InPutBucketTagging(t *testing.T) {
Bucket: aws.String("bucketname"),
Tagging: &s3.Tagging{
TagSet: []*s3.Tag{
&s3.Tag{Key: aws.String("KEY"), Value: aws.String("VALUE")},
{Key: aws.String("KEY"), Value: aws.String("VALUE")},
},
},
})
@@ -70,7 +70,7 @@ func TestMD5InDeleteObjects(t *testing.T) {
Bucket: aws.String("bucketname"),
Delete: &s3.Delete{
Objects: []*s3.ObjectIdentifier{
&s3.ObjectIdentifier{Key: aws.String("key")},
{Key: aws.String("key")},
},
},
})
@@ -45,7 +45,7 @@ func ExampleS3_CompleteMultipartUpload() {
UploadID: aws.String("MultipartUploadId"), // Required
MultipartUpload: &s3.CompletedMultipartUpload{
Parts: []*s3.CompletedPart{
&s3.CompletedPart{ // Required
{ // Required
ETag: aws.String("ETag"),
PartNumber: aws.Long(1),
},
@@ -365,7 +365,7 @@ func ExampleS3_DeleteObjects() {
Bucket: aws.String("BucketName"), // Required
Delete: &s3.Delete{ // Required
Objects: []*s3.ObjectIdentifier{ // Required
&s3.ObjectIdentifier{ // Required
{ // Required
Key: aws.String("ObjectKey"), // Required
VersionID: aws.String("ObjectVersionId"),
},
@@ -891,7 +891,7 @@ func ExampleS3_PutBucketACL() {
ACL: aws.String("BucketCannedACL"),
AccessControlPolicy: &s3.AccessControlPolicy{
Grants: []*s3.Grant{
&s3.Grant{ // Required
{ // Required
Grantee: &s3.Grantee{
Type: aws.String("Type"), // Required
DisplayName: aws.String("DisplayName"),
@@ -935,7 +935,7 @@ func ExampleS3_PutBucketCORS() {
Bucket: aws.String("BucketName"), // Required
CORSConfiguration: &s3.CORSConfiguration{
CORSRules: []*s3.CORSRule{
&s3.CORSRule{ // Required
{ // Required
AllowedHeaders: []*string{
aws.String("AllowedHeader"), // Required
// More values...
@@ -979,7 +979,7 @@ func ExampleS3_PutBucketLifecycle() {
Bucket: aws.String("BucketName"), // Required
LifecycleConfiguration: &s3.LifecycleConfiguration{
Rules: []*s3.LifecycleRule{ // Required
&s3.LifecycleRule{ // Required
{ // Required
Prefix: aws.String("Prefix"), // Required
Status: aws.String("ExpirationStatus"), // Required
Expiration: &s3.LifecycleExpiration{
@@ -1027,7 +1027,7 @@ func ExampleS3_PutBucketLogging() {
LoggingEnabled: &s3.LoggingEnabled{
TargetBucket: aws.String("TargetBucket"),
TargetGrants: []*s3.TargetGrant{
&s3.TargetGrant{ // Required
{ // Required
Grantee: &s3.Grantee{
Type: aws.String("Type"), // Required
DisplayName: aws.String("DisplayName"),
@@ -1136,7 +1136,7 @@ func ExampleS3_PutBucketReplication() {
ReplicationConfiguration: &s3.ReplicationConfiguration{ // Required
Role: aws.String("Role"), // Required
Rules: []*s3.ReplicationRule{ // Required
&s3.ReplicationRule{ // Required
{ // Required
Destination: &s3.Destination{ // Required
Bucket: aws.String("BucketName"), // Required
},
@@ -1192,7 +1192,7 @@ func ExampleS3_PutBucketTagging() {
Bucket: aws.String("BucketName"), // Required
Tagging: &s3.Tagging{ // Required
TagSet: []*s3.Tag{ // Required
&s3.Tag{ // Required
{ // Required
Key: aws.String("ObjectKey"), // Required
Value: aws.String("Value"), // Required
},
@@ -1256,7 +1256,7 @@ func ExampleS3_PutBucketWebsite() {
Protocol: aws.String("Protocol"),
},
RoutingRules: []*s3.RoutingRule{
&s3.RoutingRule{ // Required
{ // Required
Redirect: &s3.Redirect{ // Required
HTTPRedirectCode: aws.String("HttpRedirectCode"),
HostName: aws.String("HostName"),
@@ -1342,7 +1342,7 @@ func ExampleS3_PutObjectACL() {
ACL: aws.String("ObjectCannedACL"),
AccessControlPolicy: &s3.AccessControlPolicy{
Grants: []*s3.Grant{
&s3.Grant{ // Required
{ // Required
Grantee: &s3.Grantee{
Type: aws.String("Type"), // Required
DisplayName: aws.String("DisplayName"),