From 87592b38113a91f878f4657044d28af41cccd66f Mon Sep 17 00:00:00 2001 From: ampsingram Date: Thu, 24 Jan 2019 11:58:12 -0500 Subject: [PATCH] Fix golint findings --- pkg/cloudprovider/providers/aws/aws.go | 15 +++++------ pkg/cloudprovider/providers/aws/aws_test.go | 30 ++++++++++----------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/pkg/cloudprovider/providers/aws/aws.go b/pkg/cloudprovider/providers/aws/aws.go index aec92f015f1..56c3af459b4 100644 --- a/pkg/cloudprovider/providers/aws/aws.go +++ b/pkg/cloudprovider/providers/aws/aws.go @@ -574,18 +574,18 @@ type CloudConfig struct { // [ServiceOverride "1"] // Service = s3 // Region = region1 - // Url = https://s3.foo.bar + // URL = https://s3.foo.bar // SigningRegion = signing_region // // [ServiceOverride "2"] // Service = ec2 // Region = region2 - // Url = https://ec2.foo.bar + // URL = https://ec2.foo.bar // SigningRegion = signing_region ServiceOverride map[string]*struct { Service string Region string - Url string + URL string SigningRegion string } } @@ -604,9 +604,9 @@ func (cfg *CloudConfig) validateOverrides() error { if region == "" { return fmt.Errorf("service region is missing [Region is \"\"] in override %s", onum) } - url := strings.TrimSpace(ovrd.Url) + url := strings.TrimSpace(ovrd.URL) if url == "" { - return fmt.Errorf("url is missing [Url is \"\"] in override %s", onum) + return fmt.Errorf("url is missing [URL is \"\"] in override %s", onum) } signingRegion := strings.TrimSpace(ovrd.SigningRegion) if signingRegion == "" { @@ -614,9 +614,8 @@ func (cfg *CloudConfig) validateOverrides() error { } if _, ok := set[name+"_"+region]; ok { return fmt.Errorf("duplicate entry found for service override [%s] (%s in %s)", onum, name, region) - } else { - set[name+"_"+region] = true } + set[name+"_"+region] = true } return nil } @@ -636,7 +635,7 @@ func (cfg *CloudConfig) getResolver() func(service, region string, for _, override := range cfg.ServiceOverride { if override.Service == service && override.Region == region { return endpoints.ResolvedEndpoint{ - URL: override.Url, + URL: override.URL, SigningRegion: override.SigningRegion, }, nil } diff --git a/pkg/cloudprovider/providers/aws/aws_test.go b/pkg/cloudprovider/providers/aws/aws_test.go index 6ab4f8fe7cd..4a7ea0217c0 100644 --- a/pkg/cloudprovider/providers/aws/aws_test.go +++ b/pkg/cloudprovider/providers/aws/aws_test.go @@ -218,7 +218,7 @@ func TestOverridesActiveConfig(t *testing.T) { [ServiceOverride "1"] Region=sregion - Url=https://s3.foo.bar + URL=https://s3.foo.bar SigningRegion=sregion `), nil, @@ -232,7 +232,7 @@ func TestOverridesActiveConfig(t *testing.T) { [ServiceOverride "1"] Service=s3 - Url=https://s3.foo.bar + URL=https://s3.foo.bar SigningRegion=sregion `), nil, @@ -261,7 +261,7 @@ func TestOverridesActiveConfig(t *testing.T) { [ServiceOverride "1"] Service=s3 Region=sregion - Url=https://s3.foo.bar + URL=https://s3.foo.bar `), nil, true, false, @@ -275,7 +275,7 @@ func TestOverridesActiveConfig(t *testing.T) { [ServiceOverride "1"] Service = s3 Region = sregion - Url = https://s3.foo.bar + URL = https://s3.foo.bar SigningRegion = sregion `), nil, @@ -291,13 +291,13 @@ func TestOverridesActiveConfig(t *testing.T) { [ServiceOverride "1"] Service=s3 Region=sregion1 - Url=https://s3.foo.bar + URL=https://s3.foo.bar SigningRegion=sregion [ServiceOverride "2"] Service=ec2 Region=sregion2 - Url=https://ec2.foo.bar + URL=https://ec2.foo.bar SigningRegion=sregion`), nil, false, true, @@ -312,13 +312,13 @@ func TestOverridesActiveConfig(t *testing.T) { [ServiceOverride "1"] Service=s3 Region=sregion1 - Url=https://s3.foo.bar + URL=https://s3.foo.bar SigningRegion=sregion [ServiceOverride "2"] Service=s3 Region=sregion1 - Url=https://s3.foo.bar + URL=https://s3.foo.bar SigningRegion=sregion`), nil, true, false, @@ -332,13 +332,13 @@ func TestOverridesActiveConfig(t *testing.T) { [ServiceOverride "1"] Service=s3 Region=region1 - Url=https://s3.foo.bar + URL=https://s3.foo.bar SigningRegion=sregion [ServiceOverride "2"] Service=ec2 Region=region2 - Url=https://ec2.foo.bar + URL=https://ec2.foo.bar SigningRegion=sregion `), nil, @@ -353,13 +353,13 @@ func TestOverridesActiveConfig(t *testing.T) { [ServiceOverride "1"] Service=s3 Region=region1 - Url=https://s3.foo.bar + URL=https://s3.foo.bar SigningRegion=sregion [ServiceOverride "2"] Service=s3 Region=region2 - Url=https://s3.foo.bar + URL=https://s3.foo.bar SigningRegion=sregion `), nil, @@ -391,7 +391,7 @@ func TestOverridesActiveConfig(t *testing.T) { var found *struct { Service string Region string - Url string + URL string SigningRegion string } for _, v := range cfg.ServiceOverride { @@ -409,9 +409,9 @@ func TestOverridesActiveConfig(t *testing.T) { found.SigningRegion, test.name) } targetName := fmt.Sprintf("https://%s.foo.bar", sd.name) - if found.Url != targetName { + if found.URL != targetName { t.Errorf("Expected Endpoint '%s', received '%s' for case %s", - targetName, found.Url, test.name) + targetName, found.URL, test.name) } fn := cfg.getResolver()