Don't add to defaults in func init, just add them to cmd
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/micro/go-micro/cmd"
|
||||
"github.com/micro/go-micro/registry"
|
||||
"github.com/micro/go-micro/selector"
|
||||
)
|
||||
@@ -27,7 +26,6 @@ type blackListSelector struct {
|
||||
}
|
||||
|
||||
func init() {
|
||||
cmd.DefaultSelectors["blacklist"] = NewSelector
|
||||
rand.Seed(time.Now().Unix())
|
||||
}
|
||||
|
||||
|
@@ -1,14 +1,9 @@
|
||||
package random
|
||||
|
||||
import (
|
||||
"github.com/micro/go-micro/cmd"
|
||||
"github.com/micro/go-micro/selector"
|
||||
)
|
||||
|
||||
func init() {
|
||||
cmd.DefaultSelectors["random"] = NewSelector
|
||||
}
|
||||
|
||||
func NewSelector(opts ...selector.Option) selector.Selector {
|
||||
return selector.NewSelector(opts...)
|
||||
}
|
||||
|
@@ -3,7 +3,6 @@ package roundrobin
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/micro/go-micro/cmd"
|
||||
"github.com/micro/go-micro/registry"
|
||||
"github.com/micro/go-micro/selector"
|
||||
)
|
||||
@@ -12,10 +11,6 @@ type roundRobinSelector struct {
|
||||
so selector.Options
|
||||
}
|
||||
|
||||
func init() {
|
||||
cmd.DefaultSelectors["roundrobin"] = NewSelector
|
||||
}
|
||||
|
||||
func (r *roundRobinSelector) Init(opts ...selector.Option) error {
|
||||
for _, o := range opts {
|
||||
o(&r.so)
|
||||
|
Reference in New Issue
Block a user