remove excessive type assertions
Assigned type switch var to avoid type assertions inside type switch clauses. Signed-off-by: Iskander Sharipov <quasilyte@gmail.com>
This commit is contained in:
parent
360ee5cab8
commit
3e95e5cfdc
|
@ -258,11 +258,11 @@ func (p *ProjectsServiceOp) AssignResources(ctx context.Context, projectID strin
|
|||
}
|
||||
|
||||
for i, resource := range resources {
|
||||
switch resource.(type) {
|
||||
switch resource := resource.(type) {
|
||||
case ResourceWithURN:
|
||||
ar.Resources[i] = resource.(ResourceWithURN).URN()
|
||||
ar.Resources[i] = resource.URN()
|
||||
case string:
|
||||
ar.Resources[i] = resource.(string)
|
||||
ar.Resources[i] = resource
|
||||
default:
|
||||
return nil, nil, fmt.Errorf("%T must either be a string or have a valid URN method", resource)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue