Skip to content

Commit a929637

Browse files
committed
Added Go 1.17 to Travis, update server deps, fix staticcheck reports
Signed-off-by: Ivan Kozlovic <[email protected]>
1 parent ebcdff6 commit a929637

File tree

10 files changed

+47
-32
lines changed

10 files changed

+47
-32
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: go
22
go:
3+
- 1.17.x
34
- 1.16.x
4-
- 1.15.x
55
go_import_path: github.com/nats-io/nats.go
66
install:
77
- go get -t ./...
@@ -13,9 +13,9 @@ before_script:
1313
- $(exit $(go fmt ./... | wc -l))
1414
- go vet -modfile=go_test.mod ./...
1515
- find . -type f -name "*.go" | xargs misspell -error -locale US
16-
- staticcheck ./...
16+
- GOFLAGS="-mod=mod -modfile=go_test.mod" staticcheck ./...
1717
script:
1818
- go test -modfile=go_test.mod -v -run=TestNoRace -p=1 ./... --failfast -vet=off
19-
- if [[ "$TRAVIS_GO_VERSION" =~ 1.16 ]]; then ./scripts/cov.sh TRAVIS; else go test -modfile=go_test.mod -race -v -p=1 ./... --failfast -vet=off; fi
19+
- if [[ "$TRAVIS_GO_VERSION" =~ 1.17 ]]; then ./scripts/cov.sh TRAVIS; else go test -modfile=go_test.mod -race -v -p=1 ./... --failfast -vet=off; fi
2020
after_success:
21-
- if [[ "$TRAVIS_GO_VERSION" =~ 1.16 ]]; then $HOME/gopath/bin/goveralls -coverprofile=acc.out -service travis-ci; fi
21+
- if [[ "$TRAVIS_GO_VERSION" =~ 1.17 ]]; then $HOME/gopath/bin/goveralls -coverprofile=acc.out -service travis-ci; fi

enc_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2020 The NATS Authors
1+
// Copyright 2012-2022 The NATS Authors
22
// Licensed under the Apache License, Version 2.0 (the "License");
33
// you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at
@@ -226,9 +226,7 @@ func TestRequest(t *testing.T) {
226226
if err := c.Request("foo", &testdata.Person{Name: sentName}, response, 2*time.Second); err != nil {
227227
t.Fatalf("Unable to publish: %v", err)
228228
}
229-
if response == nil {
230-
t.Fatal("No response received")
231-
} else if response.Name != recvName {
229+
if response.Name != recvName {
232230
t.Fatalf("Wrong response: %v instead of %v", response.Name, recvName)
233231
}
234232

go_test.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.16
44

55
require (
66
github.com/golang/protobuf v1.4.2
7-
github.com/nats-io/nats-server/v2 v2.6.3-0.20211014173021-3fbf9ddcbc6a
7+
github.com/nats-io/nats-server/v2 v2.6.7-0.20220107190315-08ff14a24e37
88
github.com/nats-io/nkeys v0.3.0
99
github.com/nats-io/nuid v1.0.1
1010
google.golang.org/protobuf v1.23.0

go_test.sum

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,28 @@ github.com/klauspost/compress v1.13.4 h1:0zhec2I8zGnjWcKyLl6i3gPqKANCCn5e9xmviEE
1515
github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
1616
github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0=
1717
github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY=
18-
github.com/nats-io/jwt/v2 v2.1.0 h1:1UbfD5g1xTdWmSeRV8bh/7u+utTiBsRtWhLl1PixZp4=
19-
github.com/nats-io/jwt/v2 v2.1.0/go.mod h1:0tqz9Hlu6bCBFLWAASKhE5vUA4c24L9KPUUgvwumE/k=
20-
github.com/nats-io/nats-server/v2 v2.6.3-0.20211014173021-3fbf9ddcbc6a h1:9cFe3XP6CAOBUIPFPV3/KmTPyL/PWU1INdsnPabQmrw=
21-
github.com/nats-io/nats-server/v2 v2.6.3-0.20211014173021-3fbf9ddcbc6a/go.mod h1:CNi6dJQ5H+vWqaoWKjCGtqBt7ai/xOTLiocUqhK6ews=
22-
github.com/nats-io/nats.go v1.13.0/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w=
18+
github.com/nats-io/jwt/v2 v2.2.0 h1:Yg/4WFK6vsqMudRg91eBb7Dh6XeVcDMPHycDE8CfltE=
19+
github.com/nats-io/jwt/v2 v2.2.0/go.mod h1:0tqz9Hlu6bCBFLWAASKhE5vUA4c24L9KPUUgvwumE/k=
20+
github.com/nats-io/nats-server/v2 v2.6.7-0.20220107190315-08ff14a24e37 h1:b7OzfjaxsMT75QqLo0SXAbfAWv0DWQr+CbCLiFiWNzA=
21+
github.com/nats-io/nats-server/v2 v2.6.7-0.20220107190315-08ff14a24e37/go.mod h1:Un2z192KV1RW8fsnOntcsK/tEI/jBq8JTvnJaycf4s4=
22+
github.com/nats-io/nats.go v1.13.1-0.20211122170419-d7c1d78a50fc/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w=
2323
github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8=
2424
github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4=
2525
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
2626
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
2727
golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
28-
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e h1:gsTQYXdTw2Gq7RBsWvlQ91b+aEQ6bXFUngBGuR8sPpI=
29-
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
28+
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e h1:MUP6MR3rJ7Gk9LEia0LP2ytiH6MuCfs7qYz+47jGdD8=
29+
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
3030
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
31+
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
3132
golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
3233
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
34+
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3335
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
3436
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
3537
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
3638
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
39+
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
3740
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI=
3841
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
3942
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

norace_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019-2020 The NATS Authors
1+
// Copyright 2019-2022 The NATS Authors
22
// Licensed under the Apache License, Version 2.0 (the "License");
33
// you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at
@@ -11,6 +11,7 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14+
//go:build !race
1415
// +build !race
1516

1617
package nats

test/context_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2019 The NATS Authors
1+
// Copyright 2012-2022 The NATS Authors
22
// Licensed under the Apache License, Version 2.0 (the "License");
33
// you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at
@@ -11,6 +11,7 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14+
//go:build go1.7
1415
// +build go1.7
1516

1617
package test

test/norace_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019-2020 The NATS Authors
1+
// Copyright 2019-2022 The NATS Authors
22
// Licensed under the Apache License, Version 2.0 (the "License");
33
// you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at
@@ -11,6 +11,7 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14+
//go:build !race
1415
// +build !race
1516

1617
package test

util/tls.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017-2018 The NATS Authors
1+
// Copyright 2017-2022 The NATS Authors
22
// Licensed under the Apache License, Version 2.0 (the "License");
33
// you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at
@@ -11,6 +11,7 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14+
//go:build go1.8
1415
// +build go1.8
1516

1617
package util

util/tls_go17.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2016-2018 The NATS Authors
1+
// Copyright 2016-2022 The NATS Authors
22
// Licensed under the Apache License, Version 2.0 (the "License");
33
// you may not use this file except in compliance with the License.
44
// You may obtain a copy of the License at
@@ -11,6 +11,7 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14+
//go:build go1.7 && !go1.8
1415
// +build go1.7,!go1.8
1516

1617
package util

ws_test.go

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -952,16 +952,6 @@ func TestWSStress(t *testing.T) {
952952
s := RunServerWithOptions(sopts)
953953
defer s.Shutdown()
954954

955-
createConn := func() *Conn {
956-
t.Helper()
957-
nc, err := Connect(fmt.Sprintf("ws://127.0.0.1:%d", sopts.Websocket.Port),
958-
Compression(test.compress))
959-
if err != nil {
960-
t.Fatalf("Error connecting: %v", err)
961-
}
962-
return nc
963-
}
964-
965955
var count int64
966956
consDoneCh := make(chan struct{}, 1)
967957
errCh := make(chan error, 1)
@@ -974,6 +964,22 @@ func TestWSStress(t *testing.T) {
974964
}
975965
}
976966

967+
createConn := func() *Conn {
968+
t.Helper()
969+
nc, err := Connect(fmt.Sprintf("ws://127.0.0.1:%d", sopts.Websocket.Port),
970+
Compression(test.compress),
971+
ErrorHandler(func(_ *Conn, sub *Subscription, err error) {
972+
if sub != nil {
973+
err = fmt.Errorf("Subscription on %q - err=%v", sub.Subject, err)
974+
}
975+
pushErr(err)
976+
}))
977+
if err != nil {
978+
t.Fatalf("Error connecting: %v", err)
979+
}
980+
return nc
981+
}
982+
977983
cb := func(m *Msg) {
978984
if len(m.Data) < 4 {
979985
pushErr(fmt.Errorf("Message payload too small: %+v", m.Data))
@@ -998,9 +1004,11 @@ func TestWSStress(t *testing.T) {
9981004
for i := 0; i < 2; i++ {
9991005
nc := createConn()
10001006
defer nc.Close()
1001-
if _, err := nc.Subscribe(subj, cb); err != nil {
1007+
sub, err := nc.Subscribe(subj, cb)
1008+
if err != nil {
10021009
t.Fatalf("Error on subscribe: %v", err)
10031010
}
1011+
sub.SetPendingLimits(-1, -1)
10041012
if err := nc.Flush(); err != nil {
10051013
t.Fatalf("Error on flush: %v", err)
10061014
}
@@ -1032,6 +1040,7 @@ func TestWSStress(t *testing.T) {
10321040
return
10331041
}
10341042
}
1043+
nc.Flush()
10351044
}(subj)
10361045
}
10371046
}

0 commit comments

Comments
 (0)