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
+2 -2
View File
@@ -5,11 +5,11 @@ import (
"sync"
"github.com/tendermint/abci/types"
. "github.com/tendermint/go-common"
common "github.com/tendermint/go-common"
)
type Client interface {
Service
common.Service
SetResponseCallback(Callback)
Error() error
+6 -6
View File
@@ -9,13 +9,13 @@ import (
grpc "google.golang.org/grpc"
"github.com/tendermint/abci/types"
. "github.com/tendermint/go-common"
common "github.com/tendermint/go-common"
)
// A stripped copy of the remoteClient that makes
// synchronous calls using grpc
type grpcClient struct {
BaseService
common.BaseService
mustConnect bool
client types.ABCIApplicationClient
@@ -31,13 +31,13 @@ func NewGRPCClient(addr string, mustConnect bool) (*grpcClient, error) {
addr: addr,
mustConnect: mustConnect,
}
cli.BaseService = *NewBaseService(nil, "grpcClient", cli)
cli.BaseService = *common.NewBaseService(nil, "grpcClient", cli)
_, err := cli.Start() // Just start it, it's confusing for callers to remember to start.
return cli, err
}
func dialerFunc(addr string, timeout time.Duration) (net.Conn, error) {
return Connect(addr)
return common.Connect(addr)
}
func (cli *grpcClient) OnStart() error {
@@ -50,7 +50,7 @@ RETRY_LOOP:
if cli.mustConnect {
return err
} else {
log.Warn(Fmt("abci.grpcClient failed to connect to %v. Retrying...\n", cli.addr))
log.Warn(common.Fmt("abci.grpcClient failed to connect to %v. Retrying...\n", cli.addr))
time.Sleep(time.Second * 3)
continue RETRY_LOOP
}
@@ -93,7 +93,7 @@ func (cli *grpcClient) StopForError(err error) {
}
cli.mtx.Unlock()
log.Warn(Fmt("Stopping abci.grpcClient for error: %v", err.Error()))
log.Warn(common.Fmt("Stopping abci.grpcClient for error: %v", err.Error()))
cli.Stop()
}
+3 -3
View File
@@ -4,11 +4,11 @@ import (
"sync"
types "github.com/tendermint/abci/types"
. "github.com/tendermint/go-common"
common "github.com/tendermint/go-common"
)
type localClient struct {
BaseService
common.BaseService
mtx *sync.Mutex
types.Application
Callback
@@ -22,7 +22,7 @@ func NewLocalClient(mtx *sync.Mutex, app types.Application) *localClient {
mtx: mtx,
Application: app,
}
cli.BaseService = *NewBaseService(log, "localClient", cli)
cli.BaseService = *common.NewBaseService(log, "localClient", cli)
return cli
}
+8 -8
View File
@@ -11,7 +11,7 @@ import (
"time"
"github.com/tendermint/abci/types"
. "github.com/tendermint/go-common"
common "github.com/tendermint/go-common"
)
const (
@@ -27,10 +27,10 @@ const flushThrottleMS = 20 // Don't wait longer than...
// the application in general is not meant to be interfaced
// with concurrent callers.
type socketClient struct {
BaseService
common.BaseService
reqQueue chan *ReqRes
flushTimer *ThrottleTimer
flushTimer *common.ThrottleTimer
mustConnect bool
mtx sync.Mutex
@@ -45,14 +45,14 @@ type socketClient struct {
func NewSocketClient(addr string, mustConnect bool) (*socketClient, error) {
cli := &socketClient{
reqQueue: make(chan *ReqRes, reqQueueSize),
flushTimer: NewThrottleTimer("socketClient", flushThrottleMS),
flushTimer: common.NewThrottleTimer("socketClient", flushThrottleMS),
mustConnect: mustConnect,
addr: addr,
reqSent: list.New(),
resCb: nil,
}
cli.BaseService = *NewBaseService(nil, "socketClient", cli)
cli.BaseService = *common.NewBaseService(nil, "socketClient", cli)
_, err := cli.Start() // Just start it, it's confusing for callers to remember to start.
return cli, err
@@ -65,12 +65,12 @@ func (cli *socketClient) OnStart() error {
var conn net.Conn
RETRY_LOOP:
for {
conn, err = Connect(cli.addr)
conn, err = common.Connect(cli.addr)
if err != nil {
if cli.mustConnect {
return err
} else {
log.Warn(Fmt("abci.socketClient failed to connect to %v. Retrying...", cli.addr))
log.Warn(common.Fmt("abci.socketClient failed to connect to %v. Retrying...", cli.addr))
time.Sleep(time.Second * 3)
continue RETRY_LOOP
}
@@ -109,7 +109,7 @@ func (cli *socketClient) StopForError(err error) {
}
cli.mtx.Unlock()
log.Warn(Fmt("Stopping abci.socketClient for error: %v", err.Error()))
log.Warn(common.Fmt("Stopping abci.socketClient for error: %v", err.Error()))
cli.Stop()
}