diff --git a/communicator/ssh/communicator_test.go b/communicator/ssh/communicator_test.go index 3f9d4f8839..b2344fa558 100644 --- a/communicator/ssh/communicator_test.go +++ b/communicator/ssh/communicator_test.go @@ -381,7 +381,7 @@ func acceptPublicKey(keystr string) func(ssh.ConnMetadata, ssh.PublicKey) (*ssh. panic(fmt.Errorf("error parsing key: %s", err)) } return func(_ ssh.ConnMetadata, inkey ssh.PublicKey) (*ssh.Permissions, error) { - if bytes.Compare(inkey.Marshal(), goodkey.Marshal()) == 0 { + if bytes.Equal(inkey.Marshal(), goodkey.Marshal()) { return nil, nil } diff --git a/config/interpolate_walk.go b/config/interpolate_walk.go index ead3d102e1..66a677d5d9 100644 --- a/config/interpolate_walk.go +++ b/config/interpolate_walk.go @@ -271,9 +271,7 @@ func (w *interpolationWalker) splitSlice() { result = append(result, val.Value) } case []interface{}: - for _, element := range val { - result = append(result, element) - } + result = append(result, val...) default: result = append(result, v) } diff --git a/config/merge.go b/config/merge.go index 23798d652f..55fc864f7a 100644 --- a/config/merge.go +++ b/config/merge.go @@ -144,12 +144,8 @@ func Merge(c1, c2 *Config) (*Config, error) { // Explicit length check above because we want c.Locals to remain // nil if the result would be empty. c.Locals = make([]*Local, 0, len(c1.Locals)+len(c2.Locals)) - for _, v := range c1.Locals { - c.Locals = append(c.Locals, v) - } - for _, v := range c2.Locals { - c.Locals = append(c.Locals, v) - } + c.Locals = append(c.Locals, c1.Locals...) + c.Locals = append(c.Locals, c2.Locals...) } return c, nil diff --git a/terraform/resource_address.go b/terraform/resource_address.go index 3537258445..a64f5d846c 100644 --- a/terraform/resource_address.go +++ b/terraform/resource_address.go @@ -42,9 +42,9 @@ func (r *ResourceAddress) Copy() *ResourceAddress { Type: r.Type, Mode: r.Mode, } - for _, p := range r.Path { - n.Path = append(n.Path, p) - } + + n.Path = append(n.Path, r.Path...) + return n }