From fb04565dcad28d0647b34ab8d1492a3d083af7f3 Mon Sep 17 00:00:00 2001 From: lintanghui Date: Fri, 1 Feb 2019 18:13:47 +0800 Subject: [PATCH] update gomod and readme --- README.md | 2 +- go.mod | 1 + go.sum | 2 ++ pkg/naming/discovery/discovery.go | 6 +++--- pkg/net/netutil/breaker/breaker.go | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ee4c1dc0d..7696d6a1a 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Kratos是[bilibili](https://www.bilibili.com)开源的一套Go微服务框架, - [ ] config @志辉 - [ ] bm @佳辉 - [ ] warden @龙虾 -- [ ] naming discovery @堂辉 +- [x] naming discovery @堂辉 - [ ] cache&database @小旭 - [ ] kratos tool @普余 diff --git a/go.mod b/go.mod index 1d34460e4..f93d16e52 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/bilibili/Kratos require ( github.com/go-playground/locales v0.12.1 // indirect github.com/go-playground/universal-translator v0.16.0 // indirect + github.com/gogo/protobuf v1.2.0 github.com/golang/protobuf v1.2.0 github.com/leodido/go-urn v1.1.0 // indirect github.com/pkg/errors v0.8.1 diff --git a/go.sum b/go.sum index 5c95ccf7b..a9ac4d50c 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,8 @@ github.com/go-playground/locales v0.12.1 h1:2FITxuFt/xuCNP1Acdhv62OzaCiviiE4kotf github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rmGrCjJ8eAeUP/K/EKx4DM= github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= +github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= diff --git a/pkg/naming/discovery/discovery.go b/pkg/naming/discovery/discovery.go index 3b045aabf..e04399329 100644 --- a/pkg/naming/discovery/discovery.go +++ b/pkg/naming/discovery/discovery.go @@ -196,7 +196,7 @@ func (d *Discovery) selfproc(resolver naming.Resolver, event <-chan struct{}) { } } -func (d *Discovery) newSelf(instances naming.InstancesInfo) { +func (d *Discovery) newSelf(instances *naming.InstancesInfo) { ins, ok := instances.Instances[d.conf.Zone] if !ok { return @@ -284,12 +284,12 @@ func (r *Resolver) Watch() <-chan struct{} { } // Fetch fetch resolver instance. -func (r *Resolver) Fetch(c context.Context) (ins naming.InstancesInfo, ok bool) { +func (r *Resolver) Fetch(c context.Context) (ins *naming.InstancesInfo, ok bool) { r.d.mutex.RLock() app, ok := r.d.apps[r.id] r.d.mutex.RUnlock() if ok { - ins, ok = app.zoneIns.Load().(naming.InstancesInfo) + ins, ok = app.zoneIns.Load().(*naming.InstancesInfo) return } return diff --git a/pkg/net/netutil/breaker/breaker.go b/pkg/net/netutil/breaker/breaker.go index 43adbd560..6fe45e7e6 100644 --- a/pkg/net/netutil/breaker/breaker.go +++ b/pkg/net/netutil/breaker/breaker.go @@ -4,7 +4,7 @@ import ( "sync" "time" - xtime "go-common/library/time" + xtime "github.com/bilibili/Kratos/pkg/time" ) // Config broker config.