Skip to content

Commit

Permalink
go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Nov 1, 2019
1 parent 96c5d3f commit 41d2c0c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ func (d *mockDiscoveryClient) FindPeers(ctx context.Context, ns string, opts ...
return d.server.FindPeers(ns, options.Limit)
}

type dummyDiscovery struct {}
type dummyDiscovery struct{}

func (d *dummyDiscovery) Advertise(ctx context.Context, ns string, opts ...discovery.Option) (time.Duration, error) {
return time.Hour, nil
}

func (d *dummyDiscovery) FindPeers(ctx context.Context, ns string, opts ...discovery.Option) (<-chan peer.AddrInfo, error) {
retCh := make(chan peer.AddrInfo)
go func (){
go func() {
time.Sleep(time.Second)
close(retCh)
}()
Expand Down
4 changes: 2 additions & 2 deletions topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Topic struct {
evtHandlerMux sync.RWMutex
evtHandlers map[*TopicEventHandler]struct{}

mux sync.RWMutex
mux sync.RWMutex
closed bool
}

Expand All @@ -37,7 +37,7 @@ func (t *Topic) EventHandler(opts ...TopicEventHandlerOpt) (*TopicEventHandler,

h := &TopicEventHandler{
topic: t,
err: nil,
err: nil,

evtLog: make(map[peer.ID]EventType),
evtLogCh: make(chan struct{}, 1),
Expand Down
18 changes: 9 additions & 9 deletions topic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ func TestTopicCloseWithOpenSubscription(t *testing.T) {
var sub *Subscription
var err error
testTopicCloseWithOpenResource(t,
func (topic *Topic) {
sub , err = topic.Subscribe()
func(topic *Topic) {
sub, err = topic.Subscribe()
if err != nil {
t.Fatal(err)
}
},
func (){
func() {
sub.Cancel()
},
)
Expand All @@ -59,13 +59,13 @@ func TestTopicCloseWithOpenEventHandler(t *testing.T) {
var evts *TopicEventHandler
var err error
testTopicCloseWithOpenResource(t,
func (topic *Topic) {
evts , err = topic.EventHandler()
func(topic *Topic) {
evts, err = topic.EventHandler()
if err != nil {
t.Fatal(err)
}
},
func (){
func() {
evts.Cancel()
},
)
Expand Down Expand Up @@ -170,7 +170,7 @@ func TestTopicReuse(t *testing.T) {
t.Fatal(err)
}

timeoutCtx, timeoutCancel := context.WithTimeout(ctx, time.Second * 2)
timeoutCtx, timeoutCancel := context.WithTimeout(ctx, time.Second*2)
defer timeoutCancel()
msg, err = sub.Next(timeoutCtx)
if err != context.DeadlineExceeded {
Expand All @@ -194,7 +194,7 @@ func TestTopicReuse(t *testing.T) {
t.Fatal(err)
}

timeoutCtx, timeoutCancel = context.WithTimeout(ctx, time.Second * 2)
timeoutCtx, timeoutCancel = context.WithTimeout(ctx, time.Second*2)
defer timeoutCancel()
msg, err = sub.Next(ctx)
if err != nil {
Expand Down Expand Up @@ -225,7 +225,7 @@ func TestTopicEventHandlerCancel(t *testing.T) {
t.Fatal(err)
}
evts.Cancel()
timeoutCtx, timeoutCancel := context.WithTimeout(ctx, time.Second * 2)
timeoutCtx, timeoutCancel := context.WithTimeout(ctx, time.Second*2)
defer timeoutCancel()
connectAll(t, hosts)
_, err = evts.NextPeerEvent(timeoutCtx)
Expand Down

0 comments on commit 41d2c0c

Please sign in to comment.