Skip to content

Commit d736ca2

Browse files
authored
go to 1.21, upgrade deps (#822)
* go to 1.21, upgrade deps * test without 1.23
1 parent 5b49603 commit d736ca2

File tree

6 files changed

+26
-28
lines changed

6 files changed

+26
-28
lines changed

.github/workflows/go_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
strategy:
1313
matrix:
1414
go-version:
15-
- "1.20"
1615
- "1.21"
1716
- "1.22"
17+
# - "1.23"
1818
name: lint and test
1919
runs-on: ubuntu-latest
2020
steps:

.golangci.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ issues:
2020
linters:
2121
enable:
2222
- bodyclose
23-
- exportloopref
23+
- copyloopvar
2424
- gofumpt
2525
- goimports
26-
- gosec
2726
- gosimple
2827
- govet
2928
- ineffassign
@@ -39,6 +38,5 @@ output:
3938
- format: colored-line-number
4039
print-issued-lines: true
4140
print-linter-name: true
42-
uniq-by-line: true
4341
path-prefix: ""
4442
sort-results: true

example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ func ExampleWithClock() {
606606
),
607607
)
608608
s.Start()
609-
fakeClock.BlockUntil(1)
609+
_ = fakeClock.BlockUntilContext(context.Background(), 1)
610610
fakeClock.Advance(time.Second * 5)
611611
wg.Wait()
612612
_ = s.StopJobs()

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module github.com/go-co-op/gocron/v2
22

3-
go 1.20
3+
go 1.21.0
44

55
require (
66
github.com/google/uuid v1.6.0
7-
github.com/jonboulle/clockwork v0.4.0
7+
github.com/jonboulle/clockwork v0.5.0
88
github.com/robfig/cron/v3 v3.0.1
99
github.com/stretchr/testify v1.10.0
1010
go.uber.org/goleak v1.3.0
11-
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8
11+
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
1212
)
1313

1414
require (

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
44
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
55
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
6-
github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4=
7-
github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc=
6+
github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbdFz6I=
7+
github.com/jonboulle/clockwork v0.5.0/go.mod h1:3mZlmanh0g2NDKO5TWZVJAfofYk64M7XN3SzBPjZF60=
88
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
99
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
1010
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@@ -19,8 +19,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
1919
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
2020
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
2121
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
22-
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY=
23-
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
22+
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI=
23+
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
2424
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2525
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
2626
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

scheduler_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,22 +1426,22 @@ func TestScheduler_OneTimeJob_DoesNotCleanupNext(t *testing.T) {
14261426
tests := []struct {
14271427
name string
14281428
runAt time.Time
1429-
fakeClock clockwork.FakeClock
1429+
fakeClock *clockwork.FakeClock
14301430
assertErr require.ErrorAssertionFunc
14311431
// asserts things about schedules, advance time and perform new assertions
14321432
advanceAndAsserts []func(
14331433
t *testing.T,
14341434
j Job,
1435-
clock clockwork.FakeClock,
1435+
clock *clockwork.FakeClock,
14361436
runs *atomic.Uint32,
14371437
)
14381438
}{
14391439
{
14401440
name: "exhausted run do does not cleanup next item",
14411441
runAt: time.Date(2024, time.April, 22, 4, 5, 0, 0, time.UTC),
14421442
fakeClock: clockwork.NewFakeClockAt(schedulerStartTime),
1443-
advanceAndAsserts: []func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32){
1444-
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
1443+
advanceAndAsserts: []func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32){
1444+
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
14451445
require.Equal(t, uint32(0), runs.Load())
14461446

14471447
// last not initialized
@@ -2377,13 +2377,13 @@ func TestScheduler_AtTimesJob(t *testing.T) {
23772377
tests := []struct {
23782378
name string
23792379
atTimes []time.Time
2380-
fakeClock clockwork.FakeClock
2380+
fakeClock *clockwork.FakeClock
23812381
assertErr require.ErrorAssertionFunc
23822382
// asserts things about schedules, advance time and perform new assertions
23832383
advanceAndAsserts []func(
23842384
t *testing.T,
23852385
j Job,
2386-
clock clockwork.FakeClock,
2386+
clock *clockwork.FakeClock,
23872387
runs *atomic.Uint32,
23882388
)
23892389
}{
@@ -2407,8 +2407,8 @@ func TestScheduler_AtTimesJob(t *testing.T) {
24072407
name: "one run 1 millisecond in the future",
24082408
atTimes: []time.Time{n.Add(1 * time.Millisecond)},
24092409
fakeClock: clockwork.NewFakeClockAt(n),
2410-
advanceAndAsserts: []func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32){
2411-
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
2410+
advanceAndAsserts: []func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32){
2411+
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
24122412
require.Equal(t, uint32(0), runs.Load())
24132413

24142414
// last not initialized
@@ -2442,8 +2442,8 @@ func TestScheduler_AtTimesJob(t *testing.T) {
24422442
name: "one run in the past and one in the future",
24432443
atTimes: []time.Time{n.Add(-1 * time.Millisecond), n.Add(1 * time.Millisecond)},
24442444
fakeClock: clockwork.NewFakeClockAt(n),
2445-
advanceAndAsserts: []func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32){
2446-
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
2445+
advanceAndAsserts: []func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32){
2446+
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
24472447
require.Equal(t, uint32(0), runs.Load())
24482448

24492449
// last not initialized
@@ -2473,8 +2473,8 @@ func TestScheduler_AtTimesJob(t *testing.T) {
24732473
name: "two runs in the future - order is maintained even if times are provided out of order",
24742474
atTimes: []time.Time{n.Add(3 * time.Millisecond), n.Add(1 * time.Millisecond)},
24752475
fakeClock: clockwork.NewFakeClockAt(n),
2476-
advanceAndAsserts: []func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32){
2477-
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
2476+
advanceAndAsserts: []func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32){
2477+
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
24782478
require.Equal(t, uint32(0), runs.Load())
24792479

24802480
// last not initialized
@@ -2503,7 +2503,7 @@ func TestScheduler_AtTimesJob(t *testing.T) {
25032503
require.Equal(t, n.Add(3*time.Millisecond), nextRunAt)
25042504
},
25052505

2506-
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
2506+
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
25072507
// advance and eventually run
25082508
clock.Advance(2 * time.Millisecond)
25092509
require.Eventually(t, func() bool {
@@ -2526,8 +2526,8 @@ func TestScheduler_AtTimesJob(t *testing.T) {
25262526
name: "two runs in the future - order is maintained even if times are provided out of order - deduplication",
25272527
atTimes: []time.Time{n.Add(3 * time.Millisecond), n.Add(1 * time.Millisecond), n.Add(1 * time.Millisecond), n.Add(3 * time.Millisecond)},
25282528
fakeClock: clockwork.NewFakeClockAt(n),
2529-
advanceAndAsserts: []func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32){
2530-
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
2529+
advanceAndAsserts: []func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32){
2530+
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
25312531
require.Equal(t, uint32(0), runs.Load())
25322532

25332533
// last not initialized
@@ -2556,7 +2556,7 @@ func TestScheduler_AtTimesJob(t *testing.T) {
25562556
require.Equal(t, n.Add(3*time.Millisecond), nextRunAt)
25572557
},
25582558

2559-
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
2559+
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
25602560
// advance and eventually run
25612561
clock.Advance(2 * time.Millisecond)
25622562
require.Eventually(t, func() bool {

0 commit comments

Comments
 (0)