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:
Iskander (Alex) Sharipov 2019-01-23 01:08:57 +03:00 committed by GitHub
parent 360ee5cab8
commit 3e95e5cfdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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)
}