fix: fix nacos.Register many endpoint metadata kind error (#1664)

* fix: fix nacos.Register metadata map type reference bug --user=sxpsxp12

* fix: fix golangci-link error

Co-authored-by: songxiaopeng <xiaopeng.song@infwaves.com>
pull/1670/head
sxpsxp12 3 years ago committed by GitHub
parent 2471f1d955
commit 63a7ffae04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      contrib/registry/nacos/registry.go

@ -101,6 +101,10 @@ func (r *Registry) Register(ctx context.Context, si *registry.ServiceInstance) e
} }
si.Metadata["kind"] = u.Scheme si.Metadata["kind"] = u.Scheme
si.Metadata["version"] = si.Version si.Metadata["version"] = si.Version
rmd := make(map[string]string)
for k, v := range si.Metadata {
rmd[k] = v
}
_, e := r.cli.RegisterInstance(vo.RegisterInstanceParam{ _, e := r.cli.RegisterInstance(vo.RegisterInstanceParam{
Ip: host, Ip: host,
Port: uint64(p), Port: uint64(p),
@ -109,7 +113,7 @@ func (r *Registry) Register(ctx context.Context, si *registry.ServiceInstance) e
Enable: true, Enable: true,
Healthy: true, Healthy: true,
Ephemeral: true, Ephemeral: true,
Metadata: si.Metadata, Metadata: rmd,
ClusterName: r.opts.cluster, ClusterName: r.opts.cluster,
GroupName: r.opts.group, GroupName: r.opts.group,
}) })

Loading…
Cancel
Save