From ee244ac6f546381f810e8a4ad0d74184d3308677 Mon Sep 17 00:00:00 2001 From: Elizabeth Engelman Date: Mon, 8 Jul 2019 17:52:06 -0500 Subject: [PATCH] Apply go fmt --- .../fetcher/geth_rpc_storage_fetcher.go | 10 +++---- .../fetcher/geth_rpc_storage_fetcher_test.go | 7 ++--- .../streamer/statediff_streamer_test.go | 1 - libraries/shared/test_data/statediff.go | 3 +- pkg/fakes/mock_rpc_client.go | 29 +++++++++---------- pkg/geth/client/rpc_client.go | 2 +- 6 files changed, 24 insertions(+), 28 deletions(-) diff --git a/libraries/shared/fetcher/geth_rpc_storage_fetcher.go b/libraries/shared/fetcher/geth_rpc_storage_fetcher.go index 0a46f253..1be67480 100644 --- a/libraries/shared/fetcher/geth_rpc_storage_fetcher.go +++ b/libraries/shared/fetcher/geth_rpc_storage_fetcher.go @@ -22,15 +22,15 @@ import ( "github.com/vulcanize/vulcanizedb/libraries/shared/streamer" ) -type GethRpcStorageFetcher struct{ +type GethRpcStorageFetcher struct { statediffPayloadChan chan statediff.Payload - streamer streamer.Streamer + streamer streamer.Streamer } -func NewGethRpcStorageFetcher(streamer streamer.Streamer, statediffPayloadChan chan statediff.Payload) GethRpcStorageFetcher{ +func NewGethRpcStorageFetcher(streamer streamer.Streamer, statediffPayloadChan chan statediff.Payload) GethRpcStorageFetcher { return GethRpcStorageFetcher{ statediffPayloadChan: statediffPayloadChan, - streamer: streamer, + streamer: streamer, } } @@ -64,6 +64,6 @@ func (fetcher *GethRpcStorageFetcher) FetchStorageDiffs(out chan<- utils.Storage } func getAccountDiffs(stateDiff statediff.StateDiff) []statediff.AccountDiff { - accounts :=append(stateDiff.CreatedAccounts, stateDiff.UpdatedAccounts...) + accounts := append(stateDiff.CreatedAccounts, stateDiff.UpdatedAccounts...) return append(accounts, stateDiff.DeletedAccounts...) } diff --git a/libraries/shared/fetcher/geth_rpc_storage_fetcher_test.go b/libraries/shared/fetcher/geth_rpc_storage_fetcher_test.go index a5bf3dd9..6ce2d11d 100644 --- a/libraries/shared/fetcher/geth_rpc_storage_fetcher_test.go +++ b/libraries/shared/fetcher/geth_rpc_storage_fetcher_test.go @@ -27,9 +27,9 @@ import ( ) type MockStoragediffStreamer struct { - subscribeError error + subscribeError error PassedPayloadChan chan statediff.Payload - streamPayloads []statediff.Payload + streamPayloads []statediff.Payload } func (streamer *MockStoragediffStreamer) Stream(statediffPayloadChan chan statediff.Payload) (*rpc.ClientSubscription, error) { @@ -60,7 +60,6 @@ var _ = Describe("Geth RPC Storage Fetcher", func() { var storagediffRowChan chan utils.StorageDiffRow var errorChan chan error - BeforeEach(func() { streamer = MockStoragediffStreamer{} statediffPayloadChan = make(chan statediff.Payload, 1) @@ -128,4 +127,4 @@ var _ = Describe("Geth RPC Storage Fetcher", func() { close(done) }) -}) \ No newline at end of file +}) diff --git a/libraries/shared/streamer/statediff_streamer_test.go b/libraries/shared/streamer/statediff_streamer_test.go index 97428eb8..59590c84 100644 --- a/libraries/shared/streamer/statediff_streamer_test.go +++ b/libraries/shared/streamer/statediff_streamer_test.go @@ -33,4 +33,3 @@ var _ = Describe("StateDiff Streamer", func() { client.AssertSubscribeCalledWith("statediff", payloadChan, []interface{}{"stream"}) }) }) - diff --git a/libraries/shared/test_data/statediff.go b/libraries/shared/test_data/statediff.go index 8231bbd4..d846cbb8 100644 --- a/libraries/shared/test_data/statediff.go +++ b/libraries/shared/test_data/statediff.go @@ -48,7 +48,7 @@ var ( anotherContractAddress = common.HexToAddress("0xaE9BEa628c4Ce503DcFD7E305CaB4e29E7476593") AnotherContractLeafKey = crypto.Keccak256Hash(anotherContractAddress[:]) - testAccount = state.Account{ + testAccount = state.Account{ Nonce: NewNonceValue, Balance: big.NewInt(NewBalanceValue), Root: ContractRoot, @@ -125,4 +125,3 @@ var ( Err: errors.New("mock error"), } ) - diff --git a/pkg/fakes/mock_rpc_client.go b/pkg/fakes/mock_rpc_client.go index 2adc6a62..9acfdbe8 100644 --- a/pkg/fakes/mock_rpc_client.go +++ b/pkg/fakes/mock_rpc_client.go @@ -32,21 +32,21 @@ import ( ) type MockRpcClient struct { - callContextErr error - ipcPath string - nodeType core.NodeType - passedContext context.Context - passedMethod string - passedResult interface{} - passedBatch []client.BatchElem - passedNamespace string - passedPayloadChan chan statediff.Payload + callContextErr error + ipcPath string + nodeType core.NodeType + passedContext context.Context + passedMethod string + passedResult interface{} + passedBatch []client.BatchElem + passedNamespace string + passedPayloadChan chan statediff.Payload passedSubscribeArgs []interface{} - lengthOfBatch int - returnPOAHeader core.POAHeader - returnPOAHeaders []core.POAHeader - returnPOWHeaders []*types.Header - supportedModules map[string]string + lengthOfBatch int + returnPOAHeader core.POAHeader + returnPOAHeaders []core.POAHeader + returnPOWHeaders []*types.Header + supportedModules map[string]string } func (client *MockRpcClient) Subscribe(namespace string, payloadChan interface{}, args ...interface{}) (*rpc.ClientSubscription, error) { @@ -66,7 +66,6 @@ func (client *MockRpcClient) Subscribe(namespace string, payloadChan interface{} return &subscription, nil } - func (client *MockRpcClient) AssertSubscribeCalledWith(namespace string, payloadChan chan statediff.Payload, args []interface{}) { Expect(client.passedNamespace).To(Equal(namespace)) Expect(client.passedPayloadChan).To(Equal(payloadChan)) diff --git a/pkg/geth/client/rpc_client.go b/pkg/geth/client/rpc_client.go index bdcf49f4..d6f6a738 100644 --- a/pkg/geth/client/rpc_client.go +++ b/pkg/geth/client/rpc_client.go @@ -88,4 +88,4 @@ func (client RpcClient) Subscribe(namespace string, payloadChan interface{}, arg return nil, errors.New("channel given to Subscribe must not be nil") } return client.client.Subscribe(context.Background(), namespace, payloadChan, args...) -} \ No newline at end of file +}