Skip to content

Commit 2721cc4

Browse files
committed
Formatting
1 parent f5aaf15 commit 2721cc4

File tree

9 files changed

+16
-42
lines changed

9 files changed

+16
-42
lines changed

fileutil.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import (
1919
"fmt"
2020
"os"
2121
"strings"
22-
23-
"github.com/pkg/errors"
2422
)
2523

2624
func sessionIDFilenamePrefix(s SessionID) string {
@@ -47,26 +45,6 @@ func sessionIDFilenamePrefix(s SessionID) string {
4745
return strings.Join(fname, "-")
4846
}
4947

50-
// closeFile behaves like Close, except that no error is returned if the file does not exist.
51-
func closeFile(f *os.File) error {
52-
if f != nil {
53-
if err := f.Close(); err != nil {
54-
if !os.IsNotExist(err) {
55-
return err
56-
}
57-
}
58-
}
59-
return nil
60-
}
61-
62-
// removeFile behaves like os.Remove, except that no error is returned if the file does not exist.
63-
func removeFile(fname string) error {
64-
if err := os.Remove(fname); (err != nil) && !os.IsNotExist(err) {
65-
return errors.Wrapf(err, "remove %v", fname)
66-
}
67-
return nil
68-
}
69-
7048
// openOrCreateFile opens a file for reading and writing, creating it if necessary.
7149
func openOrCreateFile(fname string, perm os.FileMode) (f *os.File, err error) {
7250
if f, err = os.OpenFile(fname, os.O_RDWR, perm); err != nil {

internal/testsuite/store_suite.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ type StoreTestSuite struct {
2929
MsgStore quickfix.MessageStore
3030
}
3131

32-
33-
func (s *StoreTestSuite) TestMessageStore_SetNextMsgSeqNum_Refresh_IncrNextMsgSeqNum() {
32+
func (s *StoreTestSuite) TestMessageStoreSetNextMsgSeqNumRefreshIncrNextMsgSeqNum() {
3433
// Given a MessageStore with the following sender and target seqnums
3534
s.Require().Nil(s.MsgStore.SetNextSenderMsgSeqNum(867))
3635
s.Require().Nil(s.MsgStore.SetNextTargetMsgSeqNum(5309))
@@ -58,7 +57,7 @@ func (s *StoreTestSuite) TestMessageStore_SetNextMsgSeqNum_Refresh_IncrNextMsgSe
5857
s.Equal(5310, s.MsgStore.NextTargetMsgSeqNum())
5958
}
6059

61-
func (s *StoreTestSuite) TestMessageStore_Reset() {
60+
func (s *StoreTestSuite) TestMessageStoreReset() {
6261
// Given a MessageStore with the following sender and target seqnums
6362
s.Require().Nil(s.MsgStore.SetNextSenderMsgSeqNum(1234))
6463
s.Require().Nil(s.MsgStore.SetNextTargetMsgSeqNum(5678))
@@ -78,7 +77,7 @@ func (s *StoreTestSuite) TestMessageStore_Reset() {
7877
s.Equal(1, s.MsgStore.NextTargetMsgSeqNum())
7978
}
8079

81-
func (s *StoreTestSuite) TestMessageStore_SaveMessage_GetMessage() {
80+
func (s *StoreTestSuite) TestMessageStoreSaveMessageGetMessage() {
8281
// Given the following saved messages
8382
expectedMsgsBySeqNum := map[int]string{
8483
1: "In the frozen land of Nador",
@@ -113,7 +112,7 @@ func (s *StoreTestSuite) TestMessageStore_SaveMessage_GetMessage() {
113112
s.Equal(expectedMsgsBySeqNum[3], string(actualMsgs[2]))
114113
}
115114

116-
func (s *StoreTestSuite) TestMessageStore_SaveMessage_AndIncrement_GetMessage() {
115+
func (s *StoreTestSuite) TestMessageStoreSaveMessageAndIncrementGetMessage() {
117116
s.Require().Nil(s.MsgStore.SetNextSenderMsgSeqNum(420))
118117

119118
// Given the following saved messages
@@ -153,7 +152,7 @@ func (s *StoreTestSuite) TestMessageStore_SaveMessage_AndIncrement_GetMessage()
153152
s.Equal(expectedMsgsBySeqNum[3], string(actualMsgs[2]))
154153
}
155154

156-
func (s *StoreTestSuite) TestMessageStore_GetMessages_EmptyStore() {
155+
func (s *StoreTestSuite) TestMessageStoreGetMessagesEmptyStore() {
157156
// When messages are retrieved from an empty store
158157
messages, err := s.MsgStore.GetMessages(1, 2)
159158
require.Nil(s.T(), err)
@@ -162,7 +161,7 @@ func (s *StoreTestSuite) TestMessageStore_GetMessages_EmptyStore() {
162161
require.Empty(s.T(), messages, "Did not expect messages from empty store")
163162
}
164163

165-
func (s *StoreTestSuite) TestMessageStore_GetMessages_VariousRanges() {
164+
func (s *StoreTestSuite) TestMessageStoreGetMessagesVariousRanges() {
166165
t := s.T()
167166

168167
// Given the following saved messages
@@ -197,7 +196,7 @@ func (s *StoreTestSuite) TestMessageStore_GetMessages_VariousRanges() {
197196
}
198197
}
199198

200-
func (s *StoreTestSuite) TestMessageStore_CreationTime() {
199+
func (s *StoreTestSuite) TestMessageStoreCreationTime() {
201200
s.False(s.MsgStore.CreationTime().IsZero())
202201

203202
t0 := time.Now()

memorystore.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"github.com/pkg/errors"
2222
)
2323

24-
2524
type memoryStore struct {
2625
senderMsgSeqNum, targetMsgSeqNum int
2726
creationTime time.Time

store.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ type MessageStore interface {
3131
SetNextTargetMsgSeqNum(next int) error
3232

3333
CreationTime() time.Time
34-
SetCreationTime(time.Time)
35-
34+
SetCreationTime(time.Time)
3635

3736
SaveMessage(seqNum int, msg []byte) error
3837
SaveMessageAndIncrNextSenderMsgSeqNum(seqNum int, msg []byte) error

store/file/filestore.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ func newFileStore(sessionID quickfix.SessionID, dirname string, fileSync bool) (
103103
memStore, memErr := quickfix.NewMemoryStoreFactory().Create(sessionID)
104104
if memErr != nil {
105105
return nil, errors.Wrap(memErr, "cache creation")
106-
}
106+
}
107107

108108
store := &fileStore{
109109
sessionID: sessionID,
110-
cache: memStore,
110+
cache: memStore,
111111
offsets: make(map[int]msgDef),
112112
bodyFname: path.Join(dirname, fmt.Sprintf("%s.%s", sessionPrefix, "body")),
113113
headerFname: path.Join(dirname, fmt.Sprintf("%s.%s", sessionPrefix, "header")),
@@ -322,7 +322,7 @@ func (store *fileStore) CreationTime() time.Time {
322322
}
323323

324324
// SetCreationTime is a no-op for FileStore.
325-
func (store *fileStore) SetCreationTime(_ time.Time) {
325+
func (store *fileStore) SetCreationTime(_ time.Time) {
326326
}
327327

328328
func (store *fileStore) SaveMessage(seqNum int, msg []byte) error {

store/file/util.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"github.com/quickfixgo/quickfix"
2525
)
2626

27-
2827
func createFilenamePrefix(s quickfix.SessionID) string {
2928
sender := []string{s.SenderCompID}
3029
if s.SenderSubID != "" {

store/memory/ignore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package memory
22

3-
// This is a test-only package. This ignore file is intentional.
3+
// This is a test-only package. This ignore file is intentional.

store/mongo/mongostore.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func newMongoStore(sessionID quickfix.SessionID, mongoURL, mongoDatabase, mongoR
9494
if memErr != nil {
9595
err = errors.Wrap(memErr, "cache creation")
9696
return
97-
}
97+
}
9898

9999
allowTransactions := len(mongoReplicaSet) > 0
100100
store = &mongoStore{
@@ -281,7 +281,7 @@ func (store *mongoStore) CreationTime() time.Time {
281281
}
282282

283283
// SetCreationTime is a no-op for MongoStore.
284-
func (store *mongoStore) SetCreationTime(_ time.Time) {
284+
func (store *mongoStore) SetCreationTime(_ time.Time) {
285285
}
286286

287287
func (store *mongoStore) SaveMessage(seqNum int, msg []byte) (err error) {

store/sql/sqlstore.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func newSQLStore(sessionID quickfix.SessionID, driver string, dataSourceName str
104104
if memErr != nil {
105105
err = errors.Wrap(memErr, "cache creation")
106106
return
107-
}
107+
}
108108

109109
store = &sqlStore{
110110
sessionID: sessionID,
@@ -289,7 +289,7 @@ func (store *sqlStore) CreationTime() time.Time {
289289
}
290290

291291
// SetCreationTime is a no-op for SQLStore.
292-
func (store *sqlStore) SetCreationTime(_ time.Time) {
292+
func (store *sqlStore) SetCreationTime(_ time.Time) {
293293
}
294294

295295
func (store *sqlStore) SaveMessage(seqNum int, msg []byte) error {

0 commit comments

Comments
 (0)