Skip to content

Commit

Permalink
Corrects ioutil pkg usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ackleymi committed Oct 30, 2023
1 parent a332c80 commit afed0b7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions _test/test-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"bytes"
"fmt"
"io/ioutil"
"io"
"log"
"os"
"os/signal"
Expand Down Expand Up @@ -92,7 +92,7 @@ func copyMessage(msg *quickfix.Message) *quickfix.Message {

func main() {
app := &EchoApplication{}
app.log = log.New(ioutil.Discard, "", log.LstdFlags)
app.log = log.New(io.Discard, "", log.LstdFlags)
//app.log = log.New(os.Stdout, "", log.LstdFlags)

router.AddRoute(quickfix.BeginStringFIX40, "D", app.processMsg)
Expand Down
7 changes: 3 additions & 4 deletions filestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package quickfix
import (
"fmt"
"io"
"io/ioutil"
"os"
"path"
"strconv"
Expand Down Expand Up @@ -205,23 +204,23 @@ func (store *fileStore) populateCache() (creationTimePopulated bool, err error)
}
}

if timeBytes, err := ioutil.ReadFile(store.sessionFname); err == nil {
if timeBytes, err := os.ReadFile(store.sessionFname); err == nil {
var ctime time.Time
if err := ctime.UnmarshalText(timeBytes); err == nil {
store.cache.creationTime = ctime
creationTimePopulated = true
}
}

if senderSeqNumBytes, err := ioutil.ReadFile(store.senderSeqNumsFname); err == nil {
if senderSeqNumBytes, err := os.ReadFile(store.senderSeqNumsFname); err == nil {
if senderSeqNum, err := strconv.Atoi(strings.Trim(string(senderSeqNumBytes), "\r\n")); err == nil {
if err = store.cache.SetNextSenderMsgSeqNum(senderSeqNum); err != nil {
return creationTimePopulated, errors.Wrap(err, "cache set next sender")
}
}
}

if targetSeqNumBytes, err := ioutil.ReadFile(store.targetSeqNumsFname); err == nil {
if targetSeqNumBytes, err := os.ReadFile(store.targetSeqNumsFname); err == nil {
if targetSeqNum, err := strconv.Atoi(strings.Trim(string(targetSeqNumBytes), "\r\n")); err == nil {
if err = store.cache.SetNextTargetMsgSeqNum(targetSeqNum); err != nil {
return creationTimePopulated, errors.Wrap(err, "cache set next target")
Expand Down
3 changes: 1 addition & 2 deletions sqlstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package quickfix
import (
"database/sql"
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -50,7 +49,7 @@ func (suite *SQLStoreTestSuite) SetupTest() {
ddlFnames, err := filepath.Glob(fmt.Sprintf("_sql/%s/*.sql", sqlDriver))
require.Nil(suite.T(), err)
for _, fname := range ddlFnames {
sqlBytes, err := ioutil.ReadFile(fname)
sqlBytes, err := os.ReadFile(fname)
require.Nil(suite.T(), err)
_, err = db.Exec(string(sqlBytes))
require.Nil(suite.T(), err)
Expand Down
4 changes: 2 additions & 2 deletions tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"os"

"github.com/quickfixgo/quickfix/config"
)
Expand Down Expand Up @@ -95,7 +95,7 @@ func loadTLSConfig(settings *SessionSettings) (tlsConfig *tls.Config, err error)
return
}

pem, err := ioutil.ReadFile(caFile)
pem, err := os.ReadFile(caFile)
if err != nil {
return
}
Expand Down

0 comments on commit afed0b7

Please sign in to comment.