package allowlist import "fmt" type Allowlist struct { owners map[string]struct{} } func New(owners []string) *Allowlist { m := make(map[string]struct{}, len(owners)) for _, o := range owners { m[o] = struct{}{} } return &Allowlist{owners: m} } func (a *Allowlist) Check(owner string) error { if owner == "" { return fmt.Errorf("owner required") } if _, ok := a.owners[owner]; !ok { return fmt.Errorf("owner %q not in allowlist", owner) } return nil }