From e2a2ab263879f9197d93b9b5b35db52fb26719e7 Mon Sep 17 00:00:00 2001 From: Nicholas Eckardt Date: Tue, 5 Jan 2021 20:48:43 -0600 Subject: [PATCH] fix formatting with gofmt --- chat-with-mdns/main_test.go | 6 ++-- .../chat-with-rendezvous_test.go | 6 ++-- chat/chat_test.go | 16 ++++----- echo/main_test.go | 36 +++++++++---------- libp2p-host/host_test.go | 2 +- 5 files changed, 32 insertions(+), 34 deletions(-) diff --git a/chat-with-mdns/main_test.go b/chat-with-mdns/main_test.go index 98096c6..12e30b6 100644 --- a/chat-with-mdns/main_test.go +++ b/chat-with-mdns/main_test.go @@ -1,13 +1,13 @@ package main -import( +import ( "testing" "time" ) //"Chat with mdns" will poll for input forever, here just run the main logic to see if there are any runtime errors -func TestMain(t *testing.M){ +func TestMain(t *testing.M) { timer1 := time.NewTimer(2 * time.Second) go main() <-timer1.C -} \ No newline at end of file +} diff --git a/chat-with-rendezvous/chat-with-rendezvous_test.go b/chat-with-rendezvous/chat-with-rendezvous_test.go index 1c9240a..9067d37 100644 --- a/chat-with-rendezvous/chat-with-rendezvous_test.go +++ b/chat-with-rendezvous/chat-with-rendezvous_test.go @@ -1,14 +1,14 @@ package main -import( +import ( "testing" "time" ) //"Chat with rendezvous" will poll for input forever, here just run the main logic to see if there are any runtime errors //FIXME: As of the time of writing, Chat with rendezvous doesn't work properly, yet this test does not fail. -func TestMain(t *testing.M){ +func TestMain(t *testing.M) { timer1 := time.NewTimer(2 * time.Second) go main() <-timer1.C -} \ No newline at end of file +} diff --git a/chat/chat_test.go b/chat/chat_test.go index 5f91486..398cf21 100644 --- a/chat/chat_test.go +++ b/chat/chat_test.go @@ -1,15 +1,13 @@ package main -import( - "testing" - "time" +import ( + "testing" + "time" ) //"Chat" will poll for input forever, here just run the main logic to see if there are any runtime errors -func TestMain(t *testing.M){ - timer1 := time.NewTimer(2 * time.Second) - go main() - <-timer1.C +func TestMain(t *testing.M) { + timer1 := time.NewTimer(2 * time.Second) + go main() + <-timer1.C } - - diff --git a/echo/main_test.go b/echo/main_test.go index 0483275..cb83129 100644 --- a/echo/main_test.go +++ b/echo/main_test.go @@ -1,29 +1,29 @@ package main import ( - "fmt" - ma "github.com/multiformats/go-multiaddr" - "log" - "testing" + "fmt" + ma "github.com/multiformats/go-multiaddr" + "log" + "testing" ) // send an echo from port 7001 to port 7000 func TestMain(m *testing.M) { - listenHost, err := makeBasicHost(7000, false, 0) - if err != nil { - log.Fatal(err) - } - // Build host multiaddress - hostAddr, _ := ma.NewMultiaddr(fmt.Sprintf("/ipfs/%s", listenHost.ID().Pretty())) - addr := listenHost.Addrs()[0] - fullAddr := addr.Encapsulate(hostAddr) + listenHost, err := makeBasicHost(7000, false, 0) + if err != nil { + log.Fatal(err) + } + // Build host multiaddress + hostAddr, _ := ma.NewMultiaddr(fmt.Sprintf("/ipfs/%s", listenHost.ID().Pretty())) + addr := listenHost.Addrs()[0] + fullAddr := addr.Encapsulate(hostAddr) - pingHost, err := makeBasicHost(7001, false, 0) - if err != nil { - log.Fatal(err) - } + pingHost, err := makeBasicHost(7001, false, 0) + if err != nil { + log.Fatal(err) + } - go echo("", listenHost) - echo(fullAddr.String(), pingHost) + go echo("", listenHost) + echo(fullAddr.String(), pingHost) } diff --git a/libp2p-host/host_test.go b/libp2p-host/host_test.go index 6ed08a0..6ace2d6 100644 --- a/libp2p-host/host_test.go +++ b/libp2p-host/host_test.go @@ -4,6 +4,6 @@ import ( "testing" ) -func TestMain(t *testing.M){ +func TestMain(t *testing.M) { go main() }