Skip to content

Commit

Permalink
Use slices.Contains
Browse files Browse the repository at this point in the history
  • Loading branch information
hknutzen committed Mar 10, 2024
1 parent 843f9e1 commit 4a52e83
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions go/pkg/pass1/setup-objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,18 +593,12 @@ func (c *spoc) setupIsakmp(v *ast.TopStruct) {
c.checkDuplAttr(v.Attributes, name)
}

func (c *spoc) getAttr(a *ast.Attribute, descr map[string]attrDescr, ctx string) string {
func (c *spoc) getAttr(a *ast.Attribute, descr map[string]attrDescr, ctx string,
) string {
v := c.getSingleValue(a, ctx)
d := descr[a.Name]
if l := d.values; l != nil {
valid := false
for _, v2 := range l {
if v == v2 {
valid = true
break
}
}
if !valid {
if !slices.Contains(l, v) {
c.err("Invalid value in '%s' of %s: %s", a.Name, ctx, v)
}
}
Expand Down

0 comments on commit 4a52e83

Please sign in to comment.