Merge pull request #5440 from Iceber/optimize-last-registration

plugin: optimize the check for the last registration
This commit is contained in:
Fu Wei 2021-05-13 10:51:36 +08:00 committed by GitHub
commit b9e1d0cd27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}