diff --git a/register/context_test.go b/register/context_test.go index b7eff604..614a0b08 100644 --- a/register/context_test.go +++ b/register/context_test.go @@ -2,7 +2,6 @@ package register import ( "context" - "go.unistack.org/micro/v4/register/memory" "testing" ) @@ -16,7 +15,7 @@ func TestFromNilContext(t *testing.T) { func TestNewNilContext(t *testing.T) { // nolint: staticcheck - ctx := NewContext(nil, memory.NewRegister()) + ctx := NewContext(nil, NewRegister()) c, ok := FromContext(ctx) if c == nil || !ok { @@ -25,7 +24,7 @@ func TestNewNilContext(t *testing.T) { } func TestFromContext(t *testing.T) { - ctx := context.WithValue(context.TODO(), registerKey{}, memory.NewRegister()) + ctx := context.WithValue(context.TODO(), registerKey{}, NewRegister()) c, ok := FromContext(ctx) if c == nil || !ok { @@ -34,7 +33,7 @@ func TestFromContext(t *testing.T) { } func TestNewContext(t *testing.T) { - ctx := NewContext(context.TODO(), memory.NewRegister()) + ctx := NewContext(context.TODO(), NewRegister()) c, ok := FromContext(ctx) if c == nil || !ok { diff --git a/register/noop.go b/register/noop.go index e1587b13..4fb692d3 100644 --- a/register/noop.go +++ b/register/noop.go @@ -36,23 +36,19 @@ func (n *noop) Disconnect(ctx context.Context) error { } func (n *noop) Register(ctx context.Context, service *Service, option ...RegisterOption) error { - //TODO implement me - panic("implement me") + return nil } func (n *noop) Deregister(ctx context.Context, service *Service, option ...DeregisterOption) error { - //TODO implement me - panic("implement me") + return nil } func (n *noop) LookupService(ctx context.Context, s string, option ...LookupOption) ([]*Service, error) { - //TODO implement me - panic("implement me") + return nil, nil } func (n *noop) ListServices(ctx context.Context, option ...ListOption) ([]*Service, error) { - //TODO implement me - panic("implement me") + return nil, nil } func (n *noop) Watch(ctx context.Context, opts ...WatchOption) (Watcher, error) { @@ -70,8 +66,7 @@ type watcher struct { } func (m *watcher) Next() (*Result, error) { - //TODO implement me - panic("implement me") + return nil, nil } func (m *watcher) Stop() {} diff --git a/register/register.go b/register/register.go index e2b98d10..c06ccc9f 100644 --- a/register/register.go +++ b/register/register.go @@ -4,13 +4,9 @@ package register // import "go.unistack.org/micro/v4/register" import ( "context" "errors" - "go.unistack.org/micro/v4/register/memory" - "go.unistack.org/micro/v4/metadata" ) -// TODO we have cycle import!!!!! - const ( // WildcardDomain indicates any domain WildcardDomain = "*" @@ -21,7 +17,7 @@ var DefaultDomain = "micro" var ( // DefaultRegister is the global default register - DefaultRegister = memory.NewRegister() + DefaultRegister = NewRegister() // ErrNotFound returned when LookupService is called and no services found ErrNotFound = errors.New("service not found") // ErrWatcherStopped returned when when watcher is stopped