plugin: optimize the check for the last registration
@@ -171,15 +171,11 @@ func Register(r *Registration) {
panic(err)
}
- var last bool
for _, requires := range r.Requires {
- if requires == "*" {
- last = true
- }
- }
- if last && len(r.Requires) != 1 {
+ if requires == "*" && len(r.Requires) != 1 {
panic(ErrInvalidRequires)
}
+ }
register.r = append(register.r, r)
}
