fixed struct alignment && refactor linter
This commit is contained in:
@@ -31,10 +31,10 @@ type record struct {
|
||||
}
|
||||
|
||||
type memory struct {
|
||||
sync.RWMutex
|
||||
records map[string]services
|
||||
watchers map[string]*watcher
|
||||
opts register.Options
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
// services is a KV map with service name as the key and a map of records as the value
|
||||
@@ -100,11 +100,11 @@ func (m *memory) sendEvent(r *register.Result) {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *memory) Connect(ctx context.Context) error {
|
||||
func (m *memory) Connect(_ context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *memory) Disconnect(ctx context.Context) error {
|
||||
func (m *memory) Disconnect(_ context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ func (m *memory) Options() register.Options {
|
||||
return m.opts
|
||||
}
|
||||
|
||||
func (m *memory) Register(ctx context.Context, s *register.Service, opts ...register.RegisterOption) error {
|
||||
func (m *memory) Register(_ context.Context, s *register.Service, opts ...register.RegisterOption) error {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
|
||||
@@ -469,9 +469,7 @@ func serviceToRecord(s *register.Service, ttl time.Duration) *record {
|
||||
}
|
||||
|
||||
endpoints := make([]*register.Endpoint, len(s.Endpoints))
|
||||
for i, e := range s.Endpoints {
|
||||
endpoints[i] = e
|
||||
}
|
||||
copy(endpoints, s.Endpoints)
|
||||
|
||||
return &record{
|
||||
Name: s.Name,
|
||||
|
||||
@@ -208,9 +208,9 @@ func TestMemoryRegistryTTLConcurrent(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
//if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
// if len(os.Getenv("IN_TRAVIS_CI")) == 0 {
|
||||
// t.Logf("test will wait %v, then check TTL timeouts", waitTime)
|
||||
//}
|
||||
// }
|
||||
|
||||
errChan := make(chan error, concurrency)
|
||||
syncChan := make(chan struct{})
|
||||
@@ -290,8 +290,12 @@ func TestWatcher(t *testing.T) {
|
||||
|
||||
ctx := context.TODO()
|
||||
m := NewRegister()
|
||||
m.Init()
|
||||
m.Connect(ctx)
|
||||
if err := m.Init(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := m.Connect(ctx); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
wc, err := m.Watch(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("cant watch: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user