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.
This commit is contained in:
Tzu-Jung Lee
2017-01-16 23:20:04 -08:00
parent c65bb21a51
commit fcaa545e1e
20 changed files with 98 additions and 99 deletions
+6 -7
View File
@@ -3,17 +3,16 @@ package main
import (
"bufio"
"fmt"
//"encoding/hex"
"github.com/tendermint/abci/types"
. "github.com/tendermint/go-common"
common "github.com/tendermint/go-common"
)
func main() {
conn, err := Connect("unix://test.sock")
conn, err := common.Connect("unix://test.sock")
if err != nil {
Exit(err.Error())
common.Exit(err.Error())
}
// Read a bunch of responses
@@ -23,7 +22,7 @@ func main() {
var res = &types.Response{}
err := types.ReadMessage(conn, res)
if err != nil {
Exit(err.Error())
common.Exit(err.Error())
}
counter += 1
if counter%1000 == 0 {
@@ -40,11 +39,11 @@ func main() {
err := types.WriteMessage(req, bufWriter)
if err != nil {
Exit(err.Error())
common.Exit(err.Error())
}
err = bufWriter.Flush()
if err != nil {
Exit(err.Error())
common.Exit(err.Error())
}
counter += 1
+5 -6
View File
@@ -6,17 +6,16 @@ import (
"fmt"
"net"
"reflect"
//"encoding/hex"
"github.com/tendermint/abci/types"
. "github.com/tendermint/go-common"
common "github.com/tendermint/go-common"
)
func main() {
conn, err := Connect("unix://test.sock")
conn, err := common.Connect("unix://test.sock")
if err != nil {
Exit(err.Error())
common.Exit(err.Error())
}
// Make a bunch of requests
@@ -25,7 +24,7 @@ func main() {
req := types.ToRequestEcho("foobar")
_, err := makeRequest(conn, req)
if err != nil {
Exit(err.Error())
common.Exit(err.Error())
}
counter += 1
if counter%1000 == 0 {
@@ -63,7 +62,7 @@ func makeRequest(conn net.Conn, req *types.Request) (*types.Response, error) {
return nil, err
}
if _, ok := resFlush.Value.(*types.Response_Flush); !ok {
return nil, errors.New(Fmt("Expected flush response but got something else: %v", reflect.TypeOf(resFlush)))
return nil, errors.New(common.Fmt("Expected flush response but got something else: %v", reflect.TypeOf(resFlush)))
}
return res, nil
+9 -9
View File
@@ -7,7 +7,7 @@ import (
"github.com/tendermint/abci/client"
"github.com/tendermint/abci/types"
. "github.com/tendermint/go-common"
common "github.com/tendermint/go-common"
"github.com/tendermint/go-process"
)
@@ -46,7 +46,7 @@ func SetOption(client abcicli.Client, key, value string) {
res := client.SetOptionSync(key, value)
_, _, log := res.Code, res.Data, res.Log
if res.IsErr() {
panic(Fmt("setting %v=%v: \nlog: %v", key, value, log))
panic(common.Fmt("setting %v=%v: \nlog: %v", key, value, log))
}
}
@@ -54,10 +54,10 @@ func Commit(client abcicli.Client, hashExp []byte) {
res := client.CommitSync()
_, data, log := res.Code, res.Data, res.Log
if res.IsErr() {
panic(Fmt("committing %v\nlog: %v", log))
panic(common.Fmt("committing %v\nlog: %v", log))
}
if !bytes.Equal(res.Data, hashExp) {
panic(Fmt("Commit hash was unexpected. Got %X expected %X",
panic(common.Fmt("Commit hash was unexpected. Got %X expected %X",
data, hashExp))
}
}
@@ -66,11 +66,11 @@ func DeliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, da
res := client.DeliverTxSync(txBytes)
code, data, log := res.Code, res.Data, res.Log
if code != codeExp {
panic(Fmt("DeliverTx response code was unexpected. Got %v expected %v. Log: %v",
panic(common.Fmt("DeliverTx response code was unexpected. Got %v expected %v. Log: %v",
code, codeExp, log))
}
if !bytes.Equal(data, dataExp) {
panic(Fmt("DeliverTx response data was unexpected. Got %X expected %X",
panic(common.Fmt("DeliverTx response data was unexpected. Got %X expected %X",
data, dataExp))
}
}
@@ -79,14 +79,14 @@ func CheckTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, data
res := client.CheckTxSync(txBytes)
code, data, log := res.Code, res.Data, res.Log
if res.IsErr() {
panic(Fmt("checking tx %X: %v\nlog: %v", txBytes, log))
panic(common.Fmt("checking tx %X: %v\nlog: %v", txBytes, log))
}
if code != codeExp {
panic(Fmt("CheckTx response code was unexpected. Got %v expected %v. Log: %v",
panic(common.Fmt("CheckTx response code was unexpected. Got %v expected %v. Log: %v",
code, codeExp, log))
}
if !bytes.Equal(data, dataExp) {
panic(Fmt("CheckTx response data was unexpected. Got %X expected %X",
panic(common.Fmt("CheckTx response data was unexpected. Got %X expected %X",
data, dataExp))
}
}