Skip to content

Commit

Permalink
Use slices.ContainsFunc
Browse files Browse the repository at this point in the history
  • Loading branch information
hknutzen committed Mar 10, 2024
1 parent 4a52e83 commit 37adab5
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions go/pkg/pass1/setup-objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -1182,14 +1182,9 @@ func (c *spoc) setupRouter(v *ast.Router) {
}
if l3Name != "" {
// Check existence of layer3 interface.
seen := false
for _, a := range v.Interfaces {
if a.Name == l3Name {
seen = true
break
}
}
if !seen {
if !slices.ContainsFunc(v.Interfaces, func(a *ast.Attribute) bool {
return a.Name == l3Name
}) {
c.err("Must define %s at %s for corresponding bridge interfaces",
l3Name, name)
}
Expand Down

0 comments on commit 37adab5

Please sign in to comment.