feat: refactor go.mod.

This commit is contained in:
tx7do
2024-11-14 15:25:58 +08:00
parent 62ee65a36b
commit f3d17b9d34
9 changed files with 46 additions and 15 deletions

View File

@@ -1,9 +1,9 @@
package zookeeper
import (
zookeeperKratos "github.com/go-kratos/kratos/contrib/registry/zookeeper/v2"
"github.com/go-kratos/kratos/v2/log"
zookeeperKratos "github.com/go-kratos/kratos/contrib/registry/zookeeper/v2"
"github.com/go-zookeeper/zk"
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
@@ -11,6 +11,10 @@ import (
// NewRegistry 创建一个注册发现客户端 - ZooKeeper
func NewRegistry(c *conf.Registry) *zookeeperKratos.Registry {
if c == nil || c.Zookeeper == nil {
return nil
}
conn, _, err := zk.Connect(c.Zookeeper.Endpoints, c.Zookeeper.Timeout.AsDuration())
if err != nil {
log.Fatal(err)