issue_294 #301
| @@ -2,7 +2,6 @@ package register | |||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"go.unistack.org/micro/v4/register/memory" |  | ||||||
| 	"testing" | 	"testing" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -16,7 +15,7 @@ func TestFromNilContext(t *testing.T) { | |||||||
|  |  | ||||||
| func TestNewNilContext(t *testing.T) { | func TestNewNilContext(t *testing.T) { | ||||||
| 	// nolint: staticcheck | 	// nolint: staticcheck | ||||||
| 	ctx := NewContext(nil, memory.NewRegister()) | 	ctx := NewContext(nil, NewRegister()) | ||||||
|  |  | ||||||
| 	c, ok := FromContext(ctx) | 	c, ok := FromContext(ctx) | ||||||
| 	if c == nil || !ok { | 	if c == nil || !ok { | ||||||
| @@ -25,7 +24,7 @@ func TestNewNilContext(t *testing.T) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func TestFromContext(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) | 	c, ok := FromContext(ctx) | ||||||
| 	if c == nil || !ok { | 	if c == nil || !ok { | ||||||
| @@ -34,7 +33,7 @@ func TestFromContext(t *testing.T) { | |||||||
| } | } | ||||||
|  |  | ||||||
| func TestNewContext(t *testing.T) { | func TestNewContext(t *testing.T) { | ||||||
| 	ctx := NewContext(context.TODO(), memory.NewRegister()) | 	ctx := NewContext(context.TODO(), NewRegister()) | ||||||
|  |  | ||||||
| 	c, ok := FromContext(ctx) | 	c, ok := FromContext(ctx) | ||||||
| 	if c == nil || !ok { | 	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 { | func (n *noop) Register(ctx context.Context, service *Service, option ...RegisterOption) error { | ||||||
| 	//TODO implement me | 	return nil | ||||||
| 	panic("implement me") |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func (n *noop) Deregister(ctx context.Context, service *Service, option ...DeregisterOption) error { | func (n *noop) Deregister(ctx context.Context, service *Service, option ...DeregisterOption) error { | ||||||
| 	//TODO implement me | 	return nil | ||||||
| 	panic("implement me") |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func (n *noop) LookupService(ctx context.Context, s string, option ...LookupOption) ([]*Service, error) { | func (n *noop) LookupService(ctx context.Context, s string, option ...LookupOption) ([]*Service, error) { | ||||||
| 	//TODO implement me | 	return nil, nil | ||||||
| 	panic("implement me") |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func (n *noop) ListServices(ctx context.Context, option ...ListOption) ([]*Service, error) { | func (n *noop) ListServices(ctx context.Context, option ...ListOption) ([]*Service, error) { | ||||||
| 	//TODO implement me | 	return nil, nil | ||||||
| 	panic("implement me") |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func (n *noop) Watch(ctx context.Context, opts ...WatchOption) (Watcher, error) { | func (n *noop) Watch(ctx context.Context, opts ...WatchOption) (Watcher, error) { | ||||||
| @@ -70,8 +66,7 @@ type watcher struct { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (m *watcher) Next() (*Result, error) { | func (m *watcher) Next() (*Result, error) { | ||||||
| 	//TODO implement me | 	return nil, nil | ||||||
| 	panic("implement me") |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func (m *watcher) Stop() {} | func (m *watcher) Stop() {} | ||||||
|   | |||||||
| @@ -4,13 +4,9 @@ package register // import "go.unistack.org/micro/v4/register" | |||||||
| import ( | import ( | ||||||
| 	"context" | 	"context" | ||||||
| 	"errors" | 	"errors" | ||||||
| 	"go.unistack.org/micro/v4/register/memory" |  | ||||||
|  |  | ||||||
| 	"go.unistack.org/micro/v4/metadata" | 	"go.unistack.org/micro/v4/metadata" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // TODO we have cycle import!!!!! |  | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| 	// WildcardDomain indicates any domain | 	// WildcardDomain indicates any domain | ||||||
| 	WildcardDomain = "*" | 	WildcardDomain = "*" | ||||||
| @@ -21,7 +17,7 @@ var DefaultDomain = "micro" | |||||||
|  |  | ||||||
| var ( | var ( | ||||||
| 	// DefaultRegister is the global default register | 	// DefaultRegister is the global default register | ||||||
| 	DefaultRegister = memory.NewRegister() | 	DefaultRegister = NewRegister() | ||||||
| 	// ErrNotFound returned when LookupService is called and no services found | 	// ErrNotFound returned when LookupService is called and no services found | ||||||
| 	ErrNotFound = errors.New("service not found") | 	ErrNotFound = errors.New("service not found") | ||||||
| 	// ErrWatcherStopped returned when when watcher is stopped | 	// ErrWatcherStopped returned when when watcher is stopped | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user