builder/amazon/common: remove nil check on slice, len() on nil slices is zero

This commit is contained in:
Lars Lehtonen 2019-10-31 12:09:32 -07:00
parent ada9821897
commit e5e2bfa83f
No known key found for this signature in database
GPG Key ID: 8137D474EBCB04F2
2 changed files with 1 additions and 2 deletions

View File

@ -69,7 +69,6 @@ func TestAMIConfigPrepare_regions(t *testing.T) {
if errs = c.prepareRegions(accessConf); len(errs) > 0 {
t.Fatalf("shouldn't have err: %#v", errs)
}
errs = errs[:0]
c.AMIRegions = []string{"us-east-1", "us-west-1", "us-east-1"}
if errs = c.prepareRegions(accessConf); len(errs) > 0 {

View File

@ -24,7 +24,7 @@ type stsDecoder interface {
func decodeAWSError(decoder stsDecoder, err error) error {
groups := encodedFailureMessagePattern.FindStringSubmatch(err.Error())
if groups != nil && len(groups) > 1 {
if len(groups) > 1 {
result, decodeErr := decoder.DecodeAuthorizationMessage(&sts.DecodeAuthorizationMessageInput{
EncodedMessage: aws.String(groups[2]),
})