From f494576ca2265cef0cd6b2ee304092b95955fae3 Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Thu, 19 Dec 2019 16:40:44 +0100 Subject: [PATCH] Run `gofmt -s -w` --- eth-node/bridge/nimbus/node.go | 8 ++-- protocol/message_processor_test.go | 2 +- protocol/messenger.go | 4 +- protocol/messenger_test.go | 38 +++++++++---------- protocol/persistence_legacy_test.go | 2 +- .../status-im/status-go/protocol/messenger.go | 4 +- whisper/rate_limiter_test.go | 2 +- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/eth-node/bridge/nimbus/node.go b/eth-node/bridge/nimbus/node.go index 1419fa6d611..3c2762cda5b 100644 --- a/eth-node/bridge/nimbus/node.go +++ b/eth-node/bridge/nimbus/node.go @@ -33,12 +33,12 @@ import ( type nimbusNodeWrapper struct { mu sync.Mutex - routineQueue *RoutineQueue - tid int + routineQueue *RoutineQueue + tid int nodeStarted bool cancelPollingChan chan struct{} - w types.Whisper + w types.Whisper } type Node interface { @@ -122,7 +122,7 @@ func (n *nimbusNodeWrapper) poll() { panic("poll called from wrong thread") } - if (n.nodeStarted) { + if n.nodeStarted { C.nimbus_poll() } diff --git a/protocol/message_processor_test.go b/protocol/message_processor_test.go index 098280cdf85..d0a258edd9c 100644 --- a/protocol/message_processor_test.go +++ b/protocol/message_processor_test.go @@ -190,7 +190,7 @@ func (s *MessageProcessorSuite) TestHandleDecodedMessagesDatasyncEncrypted() { dataSyncMessage := datasyncproto.Payload{ Messages: []*datasyncproto.Message{ - &datasyncproto.Message{Body: wrappedPayload}, + {Body: wrappedPayload}, }, } marshalledDataSyncMessage, err := proto.Marshal(&dataSyncMessage) diff --git a/protocol/messenger.go b/protocol/messenger.go index b0cf326d50a..42014446818 100644 --- a/protocol/messenger.go +++ b/protocol/messenger.go @@ -1468,11 +1468,11 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte } } - for id, _ := range modifiedChats { + for id := range modifiedChats { response.Chats = append(response.Chats, m.allChats[id]) } - for id, _ := range modifiedContacts { + for id := range modifiedContacts { response.Contacts = append(response.Contacts, m.allContacts[id]) } diff --git a/protocol/messenger_test.go b/protocol/messenger_test.go index d5136e5062b..d657a8cddb0 100644 --- a/protocol/messenger_test.go +++ b/protocol/messenger_test.go @@ -1097,17 +1097,17 @@ func (s *MessengerSuite) TestChatPersistencePrivateGroupChat() { ChatType: ChatTypePrivateGroupChat, Timestamp: 10, Members: []ChatMember{ - ChatMember{ + { ID: "1", Admin: false, Joined: true, }, - ChatMember{ + { ID: "2", Admin: true, Joined: false, }, - ChatMember{ + { ID: "3", Admin: true, Joined: true, @@ -1157,12 +1157,12 @@ func (s *MessengerSuite) TestBlockContact() { LastUpdated: 20, SystemTags: []string{"1", "2"}, DeviceInfo: []ContactDeviceInfo{ - ContactDeviceInfo{ + { InstallationID: "1", Timestamp: 2, FCMToken: "token", }, - ContactDeviceInfo{ + { InstallationID: "2", Timestamp: 3, FCMToken: "token-2", @@ -1216,7 +1216,7 @@ func (s *MessengerSuite) TestBlockContact() { contact.Name = "blocked" messages := []*Message{ - &Message{ + { ID: "test-1", LocalChatID: chat2.ID, ChatMessage: protobuf.ChatMessage{ @@ -1226,7 +1226,7 @@ func (s *MessengerSuite) TestBlockContact() { }, From: contact.ID, }, - &Message{ + { ID: "test-2", LocalChatID: chat2.ID, ChatMessage: protobuf.ChatMessage{ @@ -1236,7 +1236,7 @@ func (s *MessengerSuite) TestBlockContact() { }, From: contact.ID, }, - &Message{ + { ID: "test-3", LocalChatID: chat2.ID, ChatMessage: protobuf.ChatMessage{ @@ -1247,7 +1247,7 @@ func (s *MessengerSuite) TestBlockContact() { Seen: false, From: "test", }, - &Message{ + { ID: "test-4", LocalChatID: chat2.ID, ChatMessage: protobuf.ChatMessage{ @@ -1258,7 +1258,7 @@ func (s *MessengerSuite) TestBlockContact() { Seen: false, From: "test", }, - &Message{ + { ID: "test-5", LocalChatID: chat2.ID, ChatMessage: protobuf.ChatMessage{ @@ -1269,7 +1269,7 @@ func (s *MessengerSuite) TestBlockContact() { Seen: true, From: "test", }, - &Message{ + { ID: "test-6", LocalChatID: chat3.ID, ChatMessage: protobuf.ChatMessage{ @@ -1280,7 +1280,7 @@ func (s *MessengerSuite) TestBlockContact() { Seen: false, From: contact.ID, }, - &Message{ + { ID: "test-7", LocalChatID: chat3.ID, ChatMessage: protobuf.ChatMessage{ @@ -1346,12 +1346,12 @@ func (s *MessengerSuite) TestContactPersistence() { LastUpdated: 20, SystemTags: []string{"1", "2"}, DeviceInfo: []ContactDeviceInfo{ - ContactDeviceInfo{ + { InstallationID: "1", Timestamp: 2, FCMToken: "token", }, - ContactDeviceInfo{ + { InstallationID: "2", Timestamp: 3, FCMToken: "token-2", @@ -1388,17 +1388,17 @@ func (s *MessengerSuite) TestVerifyENSNames() { PublicKeyString: pk1, }, // Not matching pk -> name - enstypes.ENSDetails{ + { Name: "pedro.stateofus.eth", PublicKeyString: pk2, }, // Not existing name - enstypes.ENSDetails{ + { Name: "definitelynotpedro.stateofus.eth", PublicKeyString: pk3, }, // Malformed pk - enstypes.ENSDetails{ + { Name: "pedro.stateofus.eth", PublicKeyString: pk4, }, @@ -1454,12 +1454,12 @@ func (s *MessengerSuite) TestContactPersistenceUpdate() { LastUpdated: 20, SystemTags: []string{"1", "2"}, DeviceInfo: []ContactDeviceInfo{ - ContactDeviceInfo{ + { InstallationID: "1", Timestamp: 2, FCMToken: "token", }, - ContactDeviceInfo{ + { InstallationID: "2", Timestamp: 3, FCMToken: "token-2", diff --git a/protocol/persistence_legacy_test.go b/protocol/persistence_legacy_test.go index 62765043f13..30cdff1a24c 100644 --- a/protocol/persistence_legacy_test.go +++ b/protocol/persistence_legacy_test.go @@ -364,7 +364,7 @@ func openTestDB() (*sql.DB, error) { } func insertMinimalMessage(p sqlitePersistence, id string) error { - return p.SaveMessagesLegacy([]*Message{&Message{ + return p.SaveMessagesLegacy([]*Message{{ ID: id, LocalChatID: "chat-id", ChatMessage: protobuf.ChatMessage{Text: "some-text"}, diff --git a/vendor/github.com/status-im/status-go/protocol/messenger.go b/vendor/github.com/status-im/status-go/protocol/messenger.go index b0cf326d50a..42014446818 100644 --- a/vendor/github.com/status-im/status-go/protocol/messenger.go +++ b/vendor/github.com/status-im/status-go/protocol/messenger.go @@ -1468,11 +1468,11 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte } } - for id, _ := range modifiedChats { + for id := range modifiedChats { response.Chats = append(response.Chats, m.allChats[id]) } - for id, _ := range modifiedContacts { + for id := range modifiedContacts { response.Contacts = append(response.Contacts, m.allContacts[id]) } diff --git a/whisper/rate_limiter_test.go b/whisper/rate_limiter_test.go index 4ca63920b36..b083894a9b4 100644 --- a/whisper/rate_limiter_test.go +++ b/whisper/rate_limiter_test.go @@ -99,7 +99,7 @@ func TestPeerLimiterHandlerWithWhitelisting(t *testing.T) { LimitPerSecIP: 1, LimitPerSecPeerID: 1, WhitelistedIPs: []string{""}, // no IP is represented as string - WhitelistedPeerIDs: []enode.ID{enode.ID{0xaa, 0xbb, 0xcc}}, + WhitelistedPeerIDs: []enode.ID{{0xaa, 0xbb, 0xcc}}, }, h) p := &Peer{ peer: p2p.NewPeer(enode.ID{0xaa, 0xbb, 0xcc}, "test-peer", nil),