@@ -364,35 +364,33 @@ func GetScopes(d *schema.ResourceData) []cr.Scope {
364364
365365 if scopeValue , ok := d .GetOk ("scopes" ); ok {
366366 scopeValue := scopeValue .([]interface {})
367- if scopeValue != nil {
368- for _ , item := range scopeValue {
369-
370- scopeContent := item .(map [string ]interface {})
371- connection := cr.Scope {}
372-
373- if actions , ok := scopeContent ["actions" ]; ok {
374- actions := actions .([]interface {})
375- var actionsToAdd []string
376- if actions != nil && len (actions ) > 0 {
377- for _ , action := range actions {
378- actionsToAdd = append (actionsToAdd , action .(string ))
379- }
380- }
381- connection .Actions = actionsToAdd
382- }
367+ for _ , item := range scopeValue {
383368
384- if name , ok := scopeContent ["name" ]; ok {
385- name := name .(string )
386- connection .Name = name
387- }
369+ scopeContent := item .(map [string ]interface {})
370+ connection := cr.Scope {}
388371
389- if scopeType , ok := scopeContent ["type" ]; ok {
390- scopeType := scopeType .(string )
391- connection .Type = scopeType
372+ if actions , ok := scopeContent ["actions" ]; ok {
373+ actions := actions .([]interface {})
374+ var actionsToAdd []string
375+ if len (actions ) > 0 {
376+ for _ , action := range actions {
377+ actionsToAdd = append (actionsToAdd , action .(string ))
378+ }
392379 }
380+ connection .Actions = actionsToAdd
381+ }
382+
383+ if name , ok := scopeContent ["name" ]; ok {
384+ name := name .(string )
385+ connection .Name = name
386+ }
393387
394- scopes = append (scopes , connection )
388+ if scopeType , ok := scopeContent ["type" ]; ok {
389+ scopeType := scopeType .(string )
390+ connection .Type = scopeType
395391 }
392+
393+ scopes = append (scopes , connection )
396394 }
397395
398396 }
@@ -451,7 +449,7 @@ func SetCredentials(credentials cr.Credentials) map[string]interface{} {
451449//nolint:golint
452450func SetScopes (scopes []cr.Scope ) []interface {} {
453451
454- var tokenScopes []interface {}
452+ var tokenScopes []interface {} //nolint:prealloc
455453 for _ , scope := range scopes {
456454 scopeEntry := make (map [string ]interface {})
457455
0 commit comments