Tzu-Jung Lee fcaa545e1e lint: remove dot import (go-common)
Spell out the package explicitly.
This commit is totally textual, and does not change any logic.

The swiss-army knife package may serve a kick-start in early
stage development. But as the codebase growing, we might want
to retire it gradually:

  For simple wrapping functions, just inline it on the call site.
  For larger pice of code, make it an independent package.
2017-01-16 23:20:04 -08:00

55 lines
913 B
Go

package main
import (
"bufio"
"fmt"
"github.com/tendermint/abci/types"
common "github.com/tendermint/go-common"
)
func main() {
conn, err := common.Connect("unix://test.sock")
if err != nil {
common.Exit(err.Error())
}
// Read a bunch of responses
go func() {
counter := 0
for {
var res = &types.Response{}
err := types.ReadMessage(conn, res)
if err != nil {
common.Exit(err.Error())
}
counter += 1
if counter%1000 == 0 {
fmt.Println("Read", counter)
}
}
}()
// Write a bunch of requests
counter := 0
for i := 0; ; i++ {
var bufWriter = bufio.NewWriter(conn)
var req = types.ToRequestEcho("foobar")
err := types.WriteMessage(req, bufWriter)
if err != nil {
common.Exit(err.Error())
}
err = bufWriter.Flush()
if err != nil {
common.Exit(err.Error())
}
counter += 1
if counter%1000 == 0 {
fmt.Println("Write", counter)
}
}
}