Skip to content

Commit

Permalink
Make golinter happy
Browse files Browse the repository at this point in the history
Fix some code styling to make golint pass.

Signed-off-by: Liran Rotenberg <[email protected]>
  • Loading branch information
liranr23 authored and ahadas committed Jan 2, 2024
1 parent 747258b commit ada61b5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions pkg/controller/provider/web/ovirt/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,26 @@ func (r *PathBuilder) Path(m model.Model) (path string) {
if r.cache == nil {
r.cache = map[string]string{}
}
switch m.(type) {
switch obj := m.(type) {
case *model.DataCenter:
path = m.(*model.DataCenter).Name
path = obj.Name
case *model.Cluster:
object := m.(*model.Cluster)
object := obj
path, err = r.forDataCenter(object.DataCenter, object.Name)
case *model.ServerCpu:
object := m.(*model.ServerCpu)
object := obj
path, err = r.forDataCenter(object.DataCenter, object.Name)
case *model.Network:
object := m.(*model.Network)
object := obj
path, err = r.forDataCenter(object.DataCenter, object.Name)
case *model.StorageDomain:
object := m.(*model.StorageDomain)
object := obj
path, err = r.forDataCenter(object.DataCenter, object.Name)
case *model.Host:
object := m.(*model.Host)
object := obj
path, err = r.forCluster(object.Cluster, object.Name)
case *model.VM:
object := m.(*model.VM)
object := obj
path, err = r.forCluster(object.Cluster, object.Name)
}

Expand Down
16 changes: 8 additions & 8 deletions pkg/controller/provider/web/ovirt/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (r *Finder) With(client base.Client) base.Finder {
// NotFoundErr
// RefNotUniqueErr
func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) {
switch resource.(type) {
switch res := resource.(type) {
case *Network:
id := ref.ID
if id != "" {
Expand Down Expand Up @@ -129,7 +129,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) {
err = liberr.Wrap(RefNotUniqueError{Ref: ref})
break
}
*resource.(*Network) = list[0]
*res = list[0]
}
case *StorageDomain:
id := ref.ID
Expand Down Expand Up @@ -161,7 +161,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) {
err = liberr.Wrap(RefNotUniqueError{Ref: ref})
break
}
*resource.(*StorageDomain) = list[0]
*res = list[0]
}
case *Host:
id := ref.ID
Expand Down Expand Up @@ -193,7 +193,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) {
err = liberr.Wrap(RefNotUniqueError{Ref: ref})
break
}
*resource.(*Host) = list[0]
*res = list[0]
}
case *VM:
id := ref.ID
Expand Down Expand Up @@ -225,7 +225,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) {
err = liberr.Wrap(RefNotUniqueError{Ref: ref})
break
}
*resource.(*VM) = list[0]
*res = list[0]
}
case *Cluster:
id := ref.ID
Expand Down Expand Up @@ -257,7 +257,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) {
err = liberr.Wrap(RefNotUniqueError{Ref: ref})
break
}
*resource.(*Cluster) = list[0]
*res = list[0]
}
case *ServerCpu:
id := ref.ID
Expand Down Expand Up @@ -289,7 +289,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) {
err = liberr.Wrap(RefNotUniqueError{Ref: ref})
break
}
*resource.(*ServerCpu) = list[0]
*res = list[0]
}
case *Workload:
id := ref.ID
Expand Down Expand Up @@ -321,7 +321,7 @@ func (r *Finder) ByRef(resource interface{}, ref base.Ref) (err error) {
err = liberr.Wrap(RefNotUniqueError{Ref: ref})
break
}
*resource.(*Workload) = list[0]
*res = list[0]
}
default:
err = liberr.Wrap(
Expand Down

0 comments on commit ada61b5

Please sign in to comment.