changing if conditionals to be ! instead of == false

This commit is contained in:
owjjh 2016-06-07 09:21:43 -04:00
parent d088b01cc8
commit 658fadbc53
2 changed files with 6 additions and 8 deletions

View File

@ -66,7 +66,7 @@ func (c *AccessConfig) Config() (*aws.Config, error) {
// the region from the instance metadata if possible.
func (c *AccessConfig) Region() (string, error) {
if c.RawRegion != "" {
if c.SkipValidation == false {
if !c.SkipValidation {
if valid := ValidateRegion(c.RawRegion); valid == false {
return "", fmt.Errorf("Not a valid region: %s", c.RawRegion)
}
@ -85,11 +85,9 @@ func (c *AccessConfig) Region() (string, error) {
func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error {
var errs []error
if c.RawRegion != "" {
if c.SkipValidation == false {
if valid := ValidateRegion(c.RawRegion); valid == false {
errs = append(errs, fmt.Errorf("Unknown region: %s", c.RawRegion))
}
if c.RawRegion != "" && !c.SkipValidation {
if valid := ValidateRegion(c.RawRegion); valid == false {
errs = append(errs, fmt.Errorf("Unknown region: %s", c.RawRegion))
}
}

View File

@ -40,8 +40,8 @@ func (c *AMIConfig) Prepare(ctx *interpolate.Context) []error {
// Mark that we saw the region
regionSet[region] = struct{}{}
// Verify the region is real
if c.AMISkipRegionValidation == false {
if !c.AMISkipRegionValidation {
// Verify the region is real
if valid := ValidateRegion(region); valid == false {
errs = append(errs, fmt.Errorf("Unknown region: %s", region))
continue