Fix golint findings

This commit is contained in:
ampsingram 2019-01-24 11:58:12 -05:00
parent cc835a86c9
commit 87592b3811
2 changed files with 22 additions and 23 deletions

View File

@ -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
}

View File

@ -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()