issue_294 #301
| @@ -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 { | ||||
|   | ||||
| @@ -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() {} | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user