documentation: mention Register functions should be call at init time (#1975)
This commit is contained in:
@ -36,9 +36,12 @@ var (
|
|||||||
m = make(map[string]Builder)
|
m = make(map[string]Builder)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Register registers the balancer builder to the balancer map.
|
// Register registers the balancer builder to the balancer map. b.Name
|
||||||
// b.Name (lowercased) will be used as the name registered with
|
// (lowercased) will be used as the name registered with this builder.
|
||||||
// this builder.
|
//
|
||||||
|
// NOTE: this function must only be called during initialization time (i.e. in
|
||||||
|
// an init() function), and is not thread-safe. If multiple Balancers are
|
||||||
|
// registered with the same name, the one registered last will take effect.
|
||||||
func Register(b Builder) {
|
func Register(b Builder) {
|
||||||
m[strings.ToLower(b.Name())] = b
|
m[strings.ToLower(b.Name())] = b
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,12 @@ var (
|
|||||||
|
|
||||||
// TODO(bar) install dns resolver in init(){}.
|
// TODO(bar) install dns resolver in init(){}.
|
||||||
|
|
||||||
// Register registers the resolver builder to the resolver map.
|
// Register registers the resolver builder to the resolver map. b.Scheme will be
|
||||||
// b.Scheme will be used as the scheme registered with this builder.
|
// used as the scheme registered with this builder.
|
||||||
|
//
|
||||||
|
// NOTE: this function must only be called during initialization time (i.e. in
|
||||||
|
// an init() function), and is not thread-safe. If multiple Resolvers are
|
||||||
|
// registered with the same name, the one registered last will take effect.
|
||||||
func Register(b Builder) {
|
func Register(b Builder) {
|
||||||
m[b.Scheme()] = b
|
m[b.Scheme()] = b
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user