Skip to content

Commit

Permalink
Merge pull request #589 from ackleymi/go-121
Browse files Browse the repository at this point in the history
Updates project to go v1.21
  • Loading branch information
ackleymi authored Oct 30, 2023
2 parents f530238 + 59072bf commit 013d9ff
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM mcr.microsoft.com/vscode/devcontainers/go:0-1.18
FROM mcr.microsoft.com/devcontainers/go:1.21
25 changes: 9 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,22 @@ jobs:
name: Linter
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: Install golangci-lint
run: |
curl -sSLO https://github.com/golangci/golangci-lint/releases/download/v$GOLANGCI_LINT_VERSION/golangci-lint-$GOLANGCI_LINT_VERSION-linux-amd64.tar.gz
tar -xf golangci-lint-$GOLANGCI_LINT_VERSION-linux-amd64.tar.gz
sudo mv golangci-lint-$GOLANGCI_LINT_VERSION-linux-amd64/golangci-lint /usr/local/bin/golangci-lint
rm -rf golangci-lint-$GOLANGCI_LINT_VERSION-linux-amd64*
env:
GOLANGCI_LINT_VERSION: '1.50.1'
- name: Run Lint
run: make lint
go-version: '1.21'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51

build:
name: build
runs-on: ubuntu-latest
strategy:
matrix:
go: [1.18]
go: [1.21]
fix-version:
-
- fix40
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ _test/echo_server
_test/tmp
_vendor*
gen
.DS_Store
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Open Source [FIX Protocol](http://www.fixprotocol.org/) library implemented in G
<ul>
<li>100% free and open source with a liberal <a href="https://github.com/quickfixgo/quickfix/blob/master/LICENSE.txt">license</a></li>
<li>Supports FIX versions 4.0 - 5.0SP2</li>
<li>Runs on any hardware and operating system supported by Go (1.18+ required)</li>
<li>Runs on any hardware and operating system supported by Go (1.21+ required)</li>
<li>Spec driven run-time message validation</li>
<li>Spec driven code generation of type-safe FIX messages, fields, and repeating groups</li>
<li>Support for protocol customizations</li>
Expand Down
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
12 changes: 6 additions & 6 deletions cmd/generate-fix/internal/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
printerMode = printer.UseSpaces | printer.TabIndent
)

//ParseError indicates generated go source is invalid
// ParseError indicates generated go source is invalid
type ParseError struct {
path string
err error
Expand All @@ -28,12 +28,12 @@ func (e ParseError) Error() string {
return fmt.Sprintf("Error parsing %v: %v", e.path, e.err)
}

//ErrorHandler is a convenience struct for interpretting generation Errors
// ErrorHandler is a convenience struct for interpretting generation Errors
type ErrorHandler struct {
ReturnCode int
}

//Handle interprets the generation error. Proceeds with setting returnCode, or panics depending on error type
// Handle interprets the generation error. Proceeds with setting returnCode, or panics depending on error type
func (h *ErrorHandler) Handle(err error) {
switch err := err.(type) {
case nil:
Expand Down Expand Up @@ -64,9 +64,9 @@ func write(filePath string, fset *token.FileSet, f *ast.File) error {
return err
}

//WriteFile parses the generated code in fileOut and writes the code out to filePath.
//Function performs some import clean up and gofmts the code before writing
//Returns ParseError if the generated source is invalid but is written to filePath
// WriteFile parses the generated code in fileOut and writes the code out to filePath.
// Function performs some import clean up and gofmts the code before writing
// Returns ParseError if the generated source is invalid but is written to filePath
func WriteFile(filePath, fileOut string) error {
fset := token.NewFileSet()
f, pErr := parser.ParseFile(fset, "", fileOut, parser.ParseComments)
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/quickfixgo/quickfix

go 1.18
go 1.21

require (
github.com/armon/go-proxyproto v0.0.0-20210323213023-7e956b284f0a
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 013d9ff

Please sign in to comment.