Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
fix formatting with gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Eckardt authored and NickEckardt committed Jan 17, 2021
1 parent 5196f1e commit e2a2ab2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 34 deletions.
6 changes: 3 additions & 3 deletions chat-with-mdns/main_test.go
Original file line number Diff line number Diff line change
@@ -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
}
}
6 changes: 3 additions & 3 deletions chat-with-rendezvous/chat-with-rendezvous_test.go
Original file line number Diff line number Diff line change
@@ -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
}
}
16 changes: 7 additions & 9 deletions chat/chat_test.go
Original file line number Diff line number Diff line change
@@ -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
}


36 changes: 18 additions & 18 deletions echo/main_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
2 changes: 1 addition & 1 deletion libp2p-host/host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import (
"testing"
)

func TestMain(t *testing.M){
func TestMain(t *testing.M) {
go main()
}

0 comments on commit e2a2ab2

Please sign in to comment.