From dd83c80ab5e64c6327f7ada8cf0afe97224510b3 Mon Sep 17 00:00:00 2001 From: Benjamin Bollen <ben@erisindustries.com> Date: Tue, 11 Oct 2016 19:12:06 +0200 Subject: [PATCH] gofmt: full sweep on develop --- consensus/consensus.go | 1 - consensus/tendermint/tendermint.go | 8 ++++---- consensus/tendermint/version_test.go | 6 +++--- consensus/types/peer.go | 4 ++-- definitions/client_do.go | 4 ++-- definitions/pipe.go | 2 +- event/event_cache.go | 2 +- event/event_cache_test.go | 2 +- event/events.go | 4 ++-- keys/key_client.go | 2 +- manager/eris-mint/accounts.go | 1 - manager/eris-mint/state/state_test.go | 2 +- rpc/tendermint/client/client.go | 1 - rpc/tendermint/client/client_test.go | 4 ++-- rpc/tendermint/core/routes.go | 1 - rpc/tendermint/core/types/responses_util.go | 8 ++++---- rpc/v0/shared/pipes.go | 6 +++--- txs/events.go | 11 +++++------ 18 files changed, 32 insertions(+), 37 deletions(-) diff --git a/consensus/consensus.go b/consensus/consensus.go index af8bb008..f0795a5d 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -50,4 +50,3 @@ func LoadConsensusEngineInPipe(moduleConfig *config.ModuleConfig, } return nil } - diff --git a/consensus/tendermint/tendermint.go b/consensus/tendermint/tendermint.go index e9815347..237fb4a0 100644 --- a/consensus/tendermint/tendermint.go +++ b/consensus/tendermint/tendermint.go @@ -116,11 +116,11 @@ func NewTendermint(moduleConfig *config.ModuleConfig, // not running the tendermint RPC as it could lead to unexpected behaviour, // not least if we accidentally try to run it on the same address as our own if tmintConfig.GetString("rpc_laddr") != "" { - log.Warnf("Force disabling Tendermint's native RPC, which had been set to " + - "run on '%s' in the Tendermint config.", tmintConfig.GetString("rpc_laddr")) + log.Warnf("Force disabling Tendermint's native RPC, which had been set to "+ + "run on '%s' in the Tendermint config.", tmintConfig.GetString("rpc_laddr")) tmintConfig.Set("rpc_laddr", "") } - + newNode := node.NewNode(tmintConfig, privateValidator, func(_, _ string, hash []byte) proxy.AppConn { return NewLocalClient(new(sync.Mutex), application) @@ -257,7 +257,7 @@ func (tendermint *Tendermint) ListValidators() []consensus_types.Validator { func (tendermint *Tendermint) ConsensusState() *consensus_types.ConsensusState { return consensus_types.FromRoundState(tendermint.tmintNode.ConsensusState(). - GetRoundState()) + GetRoundState()) } func (tendermint *Tendermint) PeerConsensusStates() map[string]string { diff --git a/consensus/tendermint/version_test.go b/consensus/tendermint/version_test.go index 2896e8e5..25985ec1 100644 --- a/consensus/tendermint/version_test.go +++ b/consensus/tendermint/version_test.go @@ -27,10 +27,10 @@ func TestMinorVersionTendermintEqual(t *testing.T) { // assert explicitly on major and minor version number assert.Equal(t, tendermintVersionMajorConst, tendermintVersionMajor, fmt.Sprintf("Major version number for Tendermint consensus is not %v as expected: %v", - tendermintVersionMajorConst, tendermintVersionMajor)) + tendermintVersionMajorConst, tendermintVersionMajor)) assert.Equal(t, tendermintVersionMinorConst, tendermintVersionMinor, fmt.Sprintf("Minor version number for Tendermint consensus is not %v as expected: %v", - tendermintVersionMinorConst, tendermintVersionMinor)) + tendermintVersionMinorConst, tendermintVersionMinor)) // assert patch number can not regress if tendermintVersionPatchConst > tendermintVersionPatch { t.Errorf("Patch version has regressed for Tendermint consensus: expected minimally %v, got %v", @@ -55,4 +55,4 @@ func TestSemanticVersioningTendermint(t *testing.T) { t.Errorf("Failed to read Patch version from Tendermint source code: %s", err) t.Fail() } -} \ No newline at end of file +} diff --git a/consensus/types/peer.go b/consensus/types/peer.go index 81b59ee6..78ddc885 100644 --- a/consensus/types/peer.go +++ b/consensus/types/peer.go @@ -3,6 +3,6 @@ package types import "github.com/tendermint/go-p2p" type Peer struct { - NodeInfo *p2p.NodeInfo `json:"node_info"` - IsOutbound bool `json:"is_outbound"` + NodeInfo *p2p.NodeInfo `json:"node_info"` + IsOutbound bool `json:"is_outbound"` } diff --git a/definitions/client_do.go b/definitions/client_do.go index 1c103d9a..849977fa 100644 --- a/definitions/client_do.go +++ b/definitions/client_do.go @@ -52,7 +52,7 @@ func NewClientDo() *ClientDo { clientDo := new(ClientDo) clientDo.Debug = false clientDo.Verbose = false - + clientDo.SignAddrFlag = "" clientDo.NodeAddrFlag = "" clientDo.PubkeyFlag = "" @@ -75,4 +75,4 @@ func NewClientDo() *ClientDo { clientDo.HeightFlag = "" return clientDo -} \ No newline at end of file +} diff --git a/definitions/pipe.go b/definitions/pipe.go index 193eaed6..f15c60df 100644 --- a/definitions/pipe.go +++ b/definitions/pipe.go @@ -77,7 +77,7 @@ type Transactor interface { fee int64) (*txs.Receipt, error) TransactAndHold(privKey, address, data []byte, gasLimit, fee int64) (*txs.EventDataCall, error) - Send(privKey, toAddress []byte, amount int64) (*txs.Receipt, error) + Send(privKey, toAddress []byte, amount int64) (*txs.Receipt, error) SendAndHold(privKey, toAddress []byte, amount int64) (*txs.Receipt, error) TransactNameReg(privKey []byte, name, data string, amount, fee int64) (*txs.Receipt, error) diff --git a/event/event_cache.go b/event/event_cache.go index fc73a197..08db3011 100644 --- a/event/event_cache.go +++ b/event/event_cache.go @@ -2,9 +2,9 @@ package event import ( "fmt" + "github.com/eris-ltd/eris-db/txs" "sync" "time" - "github.com/eris-ltd/eris-db/txs" ) var ( diff --git a/event/event_cache_test.go b/event/event_cache_test.go index 9c1cd06e..35ce6d7e 100644 --- a/event/event_cache_test.go +++ b/event/event_cache_test.go @@ -28,7 +28,7 @@ type mockEventData struct { eventId string } -func (eventData mockEventData) AssertIsEventData() { } +func (eventData mockEventData) AssertIsEventData() {} // A mock event func newMockSub(subId, eventId string, f func(txs.EventData)) mockSub { diff --git a/event/events.go b/event/events.go index 08899c95..d5c37d8e 100644 --- a/event/events.go +++ b/event/events.go @@ -134,8 +134,8 @@ func GenerateSubId() (string, error) { b := make([]byte, 32) _, err := rand.Read(b) if err != nil { - return "", fmt.Errorf("Could not generate random bytes for a subscription" + - " id: %v", err) + return "", fmt.Errorf("Could not generate random bytes for a subscription"+ + " id: %v", err) } rStr := hex.EncodeToString(b) return strings.ToUpper(rStr), nil diff --git a/keys/key_client.go b/keys/key_client.go index 994f5a67..e841f50a 100644 --- a/keys/key_client.go +++ b/keys/key_client.go @@ -17,8 +17,8 @@ package keys import ( - "fmt" "encoding/hex" + "fmt" ) type KeyClient interface { diff --git a/manager/eris-mint/accounts.go b/manager/eris-mint/accounts.go index 76a3021a..58a09b0e 100644 --- a/manager/eris-mint/accounts.go +++ b/manager/eris-mint/accounts.go @@ -233,4 +233,3 @@ func (this *AccountBalanceFilter) Match(v interface{}) bool { func (this *accounts) matchBlock(block, fda []*event.FilterData) bool { return false } - diff --git a/manager/eris-mint/state/state_test.go b/manager/eris-mint/state/state_test.go index be619f33..dd6e07b9 100644 --- a/manager/eris-mint/state/state_test.go +++ b/manager/eris-mint/state/state_test.go @@ -11,8 +11,8 @@ import ( // tmtypes "github.com/tendermint/tendermint/types" core_types "github.com/eris-ltd/eris-db/core/types" - "github.com/eris-ltd/eris-db/txs" evm "github.com/eris-ltd/eris-db/manager/eris-mint/evm" + "github.com/eris-ltd/eris-db/txs" ) func init() { diff --git a/rpc/tendermint/client/client.go b/rpc/tendermint/client/client.go index 3da5a128..3afe9c60 100644 --- a/rpc/tendermint/client/client.go +++ b/rpc/tendermint/client/client.go @@ -28,7 +28,6 @@ func ChainId(client rpcclient.Client) (*rpc_types.ResultChainId, error) { return res.(*rpc_types.ResultChainId), nil } - func GenPrivAccount(client rpcclient.Client) (*acm.PrivAccount, error) { res, err := performCall(client, "unsafe/gen_priv_account") if err != nil { diff --git a/rpc/tendermint/client/client_test.go b/rpc/tendermint/client/client_test.go index b860fefb..2580508d 100644 --- a/rpc/tendermint/client/client_test.go +++ b/rpc/tendermint/client/client_test.go @@ -1,8 +1,8 @@ package client import ( - "testing" "github.com/stretchr/testify/assert" + "testing" ) func TestMapsAndValues(t *testing.T) { @@ -10,7 +10,7 @@ func TestMapsAndValues(t *testing.T) { Baz int } dict, vals, err := mapAndValues("Foo", aStruct{5}, - "Bar", "Nibbles") + "Bar", "Nibbles") assert.Equal(t, map[string]interface{}{ "Foo": aStruct{5}, "Bar": "Nibbles", diff --git a/rpc/tendermint/core/routes.go b/rpc/tendermint/core/routes.go index 5439eb35..718c628e 100644 --- a/rpc/tendermint/core/routes.go +++ b/rpc/tendermint/core/routes.go @@ -248,4 +248,3 @@ func (tmRoutes *TendermintRoutes) ListValidators() (ctypes.ErisDBResult, error) func (tmRoutes *TendermintRoutes) DumpConsensusState() (ctypes.ErisDBResult, error) { return tmRoutes.tendermintPipe.DumpConsensusState() } - diff --git a/rpc/tendermint/core/types/responses_util.go b/rpc/tendermint/core/types/responses_util.go index 0dcc9ddd..13b21a14 100644 --- a/rpc/tendermint/core/types/responses_util.go +++ b/rpc/tendermint/core/types/responses_util.go @@ -24,22 +24,22 @@ import ( // and expose /core/types instead. This is largely an artefact to be removed once // go-wire and go-rpc are deprecated. // This is not an efficient code, especially given Storage can be big. -func UnwrapResultDumpStorage(result *ResultDumpStorage) (*types.Storage) { +func UnwrapResultDumpStorage(result *ResultDumpStorage) *types.Storage { storageRoot := make([]byte, len(result.StorageRoot)) copy(storageRoot, result.StorageRoot) storageItems := make([]types.StorageItem, len(result.StorageItems)) for i, item := range result.StorageItems { key := make([]byte, len(item.Key)) value := make([]byte, len(item.Value)) - copy(key, item.Key) + copy(key, item.Key) copy(value, item.Value) storageItems[i] = types.StorageItem{ - Key: key, + Key: key, Value: value, } } return &types.Storage{ - StorageRoot: storageRoot, + StorageRoot: storageRoot, StorageItems: storageItems, } } diff --git a/rpc/v0/shared/pipes.go b/rpc/v0/shared/pipes.go index 2256953e..fb71aad9 100644 --- a/rpc/v0/shared/pipes.go +++ b/rpc/v0/shared/pipes.go @@ -18,9 +18,9 @@ func BlockchainInfo(pipe definitions.Pipe) *core_types.BlockchainInfo { } return &core_types.BlockchainInfo{ - ChainId: pipe.Blockchain().ChainId(), - GenesisHash: pipe.GenesisHash(), + ChainId: pipe.Blockchain().ChainId(), + GenesisHash: pipe.GenesisHash(), LatestBlockHeight: latestHeight, - LatestBlock: latestBlockMeta, + LatestBlock: latestBlockMeta, } } diff --git a/txs/events.go b/txs/events.go index f9c7e0ec..4cb7e656 100644 --- a/txs/events.go +++ b/txs/events.go @@ -38,16 +38,15 @@ func EventStringVote() string { return fmt.Sprintf("Vote") } //---------------------------------------- const ( - EventDataTypeNewBlock = byte(0x01) - EventDataTypeFork = byte(0x02) - EventDataTypeTx = byte(0x03) - EventDataTypeCall = byte(0x04) - EventDataTypeLog = byte(0x05) + EventDataTypeNewBlock = byte(0x01) + EventDataTypeFork = byte(0x02) + EventDataTypeTx = byte(0x03) + EventDataTypeCall = byte(0x04) + EventDataTypeLog = byte(0x05) EventDataTypeNewBlockHeader = byte(0x06) EventDataTypeRoundState = byte(0x11) EventDataTypeVote = byte(0x12) - ) type EventData interface { -- GitLab