Skip to content

Commit

Permalink
lint, network: remove appendAssign error
Browse files Browse the repository at this point in the history
By removing this extra variable, we always make use of the same slice
when appending, this removing the error below:

```
pkg/network/domainspec/generators.go:187:39: appendAssign: append result not assigned to the same slice (gocritic)
b.domain.Spec.Devices.Interfaces = append(ifaces[:i], ifaces[i+1:]...)
```

Signed-off-by: Miguel Duarte Barroso <[email protected]>
  • Loading branch information
maiqueb committed Jun 30, 2022
1 parent 261bc07 commit 015751a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/network/domainspec/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,12 @@ type SlirpLibvirtSpecGenerator struct {
func (b *SlirpLibvirtSpecGenerator) Generate() error {
// remove slirp interface from domain spec devices interfaces
var foundIfaceModelType string
ifaces := b.domain.Spec.Devices.Interfaces
for i, iface := range ifaces {
for i, iface := range b.domain.Spec.Devices.Interfaces {
if iface.Alias.GetName() == b.vmiSpecIface.Name {
b.domain.Spec.Devices.Interfaces = append(ifaces[:i], ifaces[i+1:]...)
b.domain.Spec.Devices.Interfaces = append(
b.domain.Spec.Devices.Interfaces[:i],
b.domain.Spec.Devices.Interfaces[i+1:]...,
)
foundIfaceModelType = iface.Model.Type
break
}
Expand Down

0 comments on commit 015751a

Please sign in to comment.