Skip to content

Commit 2f40631

Browse files
committed
chore: update Go version and dependencies, refactor test for timeout
- Remove support for Go versions 1.20 and 1.21 in GitHub Actions workflow - Update Go version to 1.22 in go.mod - Update the `github.com/golang-queue/queue` dependency to a newer version - Replace `github.com/goccy/go-json` with `github.com/jpillora/backoff` as an indirect dependency - Add `github.com/vmihailenco/msgpack/v5` and `github.com/vmihailenco/tagparser/v2` as indirect dependencies - Refactor test to use `job.AllowOption` with `Timeout` instead of `job.WithTimeout` in `nats_test.go` Signed-off-by: appleboy <[email protected]>
1 parent a1476be commit 2f40631

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
matrix:
2727
os: [ubuntu-latest]
28-
go: ["1.20", 1.21, 1.22, 1.23]
28+
go: [1.22, 1.23]
2929
include:
3030
- os: ubuntu-latest
3131
go-build: ~/.cache/go-build

go.mod

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
module github.com/golang-queue/nats
22

3-
go 1.20
3+
go 1.22
44

55
require (
6-
github.com/golang-queue/queue v0.1.4-0.20221230133718-0314ef173f98
6+
github.com/golang-queue/queue v0.1.4-0.20250119090927-da26ae2d9402
77
github.com/nats-io/nats.go v1.38.0
88
github.com/stretchr/testify v1.10.0
99
go.uber.org/goleak v1.3.0
1010
)
1111

1212
require (
1313
github.com/davecgh/go-spew v1.1.1 // indirect
14-
github.com/goccy/go-json v0.10.0 // indirect
14+
github.com/jpillora/backoff v1.0.0 // indirect
1515
github.com/klauspost/compress v1.17.9 // indirect
1616
github.com/nats-io/nkeys v0.4.9 // indirect
1717
github.com/nats-io/nuid v1.0.1 // indirect
1818
github.com/pmezard/go-difflib v1.0.0 // indirect
19+
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
20+
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
1921
golang.org/x/crypto v0.31.0 // indirect
2022
golang.org/x/sys v0.28.0 // indirect
2123
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
github.com/appleboy/com v0.2.1 h1:dHAHauX3eYDuheAahI83HIGFxpi0SEb2ZAu9EZ9hbUM=
2+
github.com/appleboy/com v0.2.1/go.mod h1:kByEI3/vzI5GM1+O5QdBHLsXaOsmFsJcOpCSgASi4sg=
13
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
24
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3-
github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA=
4-
github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
5-
github.com/golang-queue/queue v0.1.4-0.20221230133718-0314ef173f98 h1:T2DoUcMWZr6uSUQAr5wCEzOiwHB1zJOiATAZ4BUAefg=
6-
github.com/golang-queue/queue v0.1.4-0.20221230133718-0314ef173f98/go.mod h1:8P7IgwdxwKh0/W1I9yCuQQGI8OHIuc7fIHi4OYr1COU=
7-
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
5+
github.com/golang-queue/queue v0.1.4-0.20250119090927-da26ae2d9402 h1:swm5R5BaKi+94TPPtywkTn4wFWmE3hDlO1wVt8qkMjw=
6+
github.com/golang-queue/queue v0.1.4-0.20250119090927-da26ae2d9402/go.mod h1:eUZ3HH9GbhoEKQSlxCBQ4pPXeadbJ7QKBMZ0kIZNDHI=
7+
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
8+
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
89
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
910
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
1011
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
12+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
1113
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
14+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
1215
github.com/nats-io/nats.go v1.38.0 h1:A7P+g7Wjp4/NWqDOOP/K6hfhr54DvdDQUznt5JFg9XA=
1316
github.com/nats-io/nats.go v1.38.0/go.mod h1:IGUM++TwokGnXPs82/wCuiHS02/aKrdYUQkU8If6yjw=
1417
github.com/nats-io/nkeys v0.4.9 h1:qe9Faq2Gxwi6RZnZMXfmGMZkg3afLLOtrU+gDZJ35b0=
@@ -19,13 +22,20 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
1922
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
2023
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
2124
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
25+
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
26+
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
27+
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
28+
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
2229
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
2330
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
31+
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
32+
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
2433
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
2534
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
2635
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
2736
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
2837
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2938
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
39+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3040
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
3141
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

nats_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ func TestJobReachTimeout(t *testing.T) {
178178
assert.NoError(t, err)
179179
q.Start()
180180
time.Sleep(50 * time.Millisecond)
181-
assert.NoError(t, q.Queue(m, job.WithTimeout(20*time.Millisecond)))
181+
assert.NoError(t, q.Queue(m, job.AllowOption{
182+
Timeout: job.Time(20 * time.Millisecond),
183+
}))
182184
time.Sleep(100 * time.Millisecond)
183185
q.Shutdown()
184186
q.Wait()
@@ -217,7 +219,9 @@ func TestCancelJobAfterShutdown(t *testing.T) {
217219
assert.NoError(t, err)
218220
q.Start()
219221
time.Sleep(50 * time.Millisecond)
220-
assert.NoError(t, q.Queue(m, job.WithTimeout(150*time.Millisecond)))
222+
assert.NoError(t, q.Queue(m, job.AllowOption{
223+
Timeout: job.Time(150 * time.Millisecond),
224+
}))
221225
time.Sleep(100 * time.Millisecond)
222226
q.Shutdown()
223227
q.Wait()

0 commit comments

Comments
 (0)