Skip to content

Commit

Permalink
update iso8583 version (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
alovak authored Jul 17, 2024
1 parent b151908 commit 05f665f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
5 changes: 3 additions & 2 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

"github.com/moov-io/iso8583"
iso8583Errors "github.com/moov-io/iso8583/errors"
"github.com/moov-io/iso8583/utils"
)

Expand Down Expand Up @@ -580,7 +581,7 @@ func (c *Connection) writeLoop() {
if err != nil {
c.handleError(fmt.Errorf("writing message: %w", err))

var packErr *iso8583.PackError
var packErr *iso8583Errors.PackError
if errors.As(err, &packErr) {
// let caller know that the message was not sent because of pack error.
// We don't set all type of errors to errCh as this case is handled
Expand Down Expand Up @@ -646,7 +647,7 @@ func (c *Connection) readLoop() {

// if err is UnpackError, we can still continue reading
// from the connection
var unpackErr *iso8583.UnpackError
var unpackErr *iso8583Errors.UnpackError
if errors.As(err, &unpackErr) {
continue
}
Expand Down
5 changes: 3 additions & 2 deletions connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/moov-io/iso8583"
connection "github.com/moov-io/iso8583-connection"
"github.com/moov-io/iso8583/encoding"
iso8583Errors "github.com/moov-io/iso8583/errors"
"github.com/moov-io/iso8583/field"
"github.com/moov-io/iso8583/prefix"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -390,7 +391,7 @@ func TestClient_Send(t *testing.T) {
// then Send should return PackError
require.Error(t, err)

var packError *iso8583.PackError
var packError *iso8583Errors.PackError
require.ErrorAs(t, err, &packError)
})

Expand Down Expand Up @@ -468,7 +469,7 @@ func TestClient_Send(t *testing.T) {
mu.Lock()
defer mu.Unlock()

var unpackErr *iso8583.UnpackError
var unpackErr *iso8583Errors.UnpackError
if errors.As(handledError, &unpackErr) {
require.EqualError(t, handledError, "failed to read message from connection")
require.EqualError(t, unpackErr, "failed to unpack field 63: no specification found")
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/moov-io/iso8583-connection
go 1.21

require (
github.com/moov-io/iso8583 v0.21.2
github.com/moov-io/iso8583 v0.22.0
github.com/stretchr/testify v1.9.0
)

Expand All @@ -12,6 +12,6 @@ require (
github.com/kr/text v0.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/yerden/go-util v1.1.4 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/text v0.16.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ github.com/moov-io/iso8583 v0.21.1 h1:2SnBom/yw2XJSPP4tUZVgKsNfICz5BKubd8Q33JRsH
github.com/moov-io/iso8583 v0.21.1/go.mod h1:vvlp3liWXnH5pI9dl5PvrtpjS7ZxcdxyYWvd4FpI66A=
github.com/moov-io/iso8583 v0.21.2 h1:FHHbFXFOfEK9yA8siupnmUei77ZNB/74o4NsANu9me8=
github.com/moov-io/iso8583 v0.21.2/go.mod h1:DePfPe8TCTrSUETPpMq1LQdfSuFj4qxZPkYyb9/cS7I=
github.com/moov-io/iso8583 v0.22.0 h1:iFniftFGVfRtEHU2EtTQ2KzwNYlZrN6wiQmfwMwFPZE=
github.com/moov-io/iso8583 v0.22.0/go.mod h1:seEv9uPMu6ESrBFLpMLXb4wpXg2iEeF4PIOzqpetbOA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
Expand All @@ -31,6 +33,8 @@ golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
10 changes: 5 additions & 5 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import (
"io"
"net"
"sync"
"sync/atomic"
"testing"
"time"

"sync/atomic"

"github.com/moov-io/iso8583"
connection "github.com/moov-io/iso8583-connection"
"github.com/moov-io/iso8583-connection/server"
Expand Down Expand Up @@ -66,7 +65,7 @@ func TestServer_WithConnectionFactory(t *testing.T) {
defer s.Close()

var isCalled atomic.Bool
var expectedErr = fmt.Errorf("error from connection factory")
expectedErr := fmt.Errorf("error from connection factory")
var gotErr error
var mu sync.Mutex

Expand Down Expand Up @@ -95,7 +94,9 @@ func TestServer_WithConnectionFactory(t *testing.T) {
err = conn.Connect()
require.NoError(t, err)

conn.Close()
err = conn.Close()
require.NoError(t, err)

s.Close()

require.Eventually(t, func() bool {
Expand All @@ -104,7 +105,6 @@ func TestServer_WithConnectionFactory(t *testing.T) {

require.ErrorIs(t, gotErr, expectedErr)
})

}

type lengthHeader struct {
Expand Down

0 comments on commit 05f665f

Please sign in to comment.