import ( "github.com/micro/go-micro/registry" "github.com/micro/go-plugins/registry/etcdv3" // other code ... ) // other code ... func main() { // etcdv3 registerDrive registerDrive := etcdv3.NewRegistry(func(options *registry.Options) { // etcd 地址 options.Addrs = []string{"127.0.0.1:2379"} // etcd 用户名密码,如果设置的话 etcdv3.Auth("root","password")(options) }) service := micro.NewService( micro.Name(microName), micro.Registry(registerDrive), ) // other code ... }……

阅读全文