mirror of https://github.com/go-co-op/gocron.git
go to 1.21, upgrade deps (#822)
* go to 1.21, upgrade deps * test without 1.23
This commit is contained in:
parent
5b49603168
commit
d736ca28f5
|
|
@ -12,9 +12,9 @@
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version:
|
go-version:
|
||||||
- "1.20"
|
|
||||||
- "1.21"
|
- "1.21"
|
||||||
- "1.22"
|
- "1.22"
|
||||||
|
# - "1.23"
|
||||||
name: lint and test
|
name: lint and test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,9 @@ issues:
|
||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
- bodyclose
|
- bodyclose
|
||||||
- exportloopref
|
- copyloopvar
|
||||||
- gofumpt
|
- gofumpt
|
||||||
- goimports
|
- goimports
|
||||||
- gosec
|
|
||||||
- gosimple
|
- gosimple
|
||||||
- govet
|
- govet
|
||||||
- ineffassign
|
- ineffassign
|
||||||
|
|
@ -39,6 +38,5 @@ output:
|
||||||
- format: colored-line-number
|
- format: colored-line-number
|
||||||
print-issued-lines: true
|
print-issued-lines: true
|
||||||
print-linter-name: true
|
print-linter-name: true
|
||||||
uniq-by-line: true
|
|
||||||
path-prefix: ""
|
path-prefix: ""
|
||||||
sort-results: true
|
sort-results: true
|
||||||
|
|
|
||||||
|
|
@ -606,7 +606,7 @@ func ExampleWithClock() {
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
s.Start()
|
s.Start()
|
||||||
fakeClock.BlockUntil(1)
|
_ = fakeClock.BlockUntilContext(context.Background(), 1)
|
||||||
fakeClock.Advance(time.Second * 5)
|
fakeClock.Advance(time.Second * 5)
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
_ = s.StopJobs()
|
_ = s.StopJobs()
|
||||||
|
|
|
||||||
6
go.mod
6
go.mod
|
|
@ -1,14 +1,14 @@
|
||||||
module github.com/go-co-op/gocron/v2
|
module github.com/go-co-op/gocron/v2
|
||||||
|
|
||||||
go 1.20
|
go 1.21.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/jonboulle/clockwork v0.4.0
|
github.com/jonboulle/clockwork v0.5.0
|
||||||
github.com/robfig/cron/v3 v3.0.1
|
github.com/robfig/cron/v3 v3.0.1
|
||||||
github.com/stretchr/testify v1.10.0
|
github.com/stretchr/testify v1.10.0
|
||||||
go.uber.org/goleak v1.3.0
|
go.uber.org/goleak v1.3.0
|
||||||
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8
|
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|
|
||||||
8
go.sum
8
go.sum
|
|
@ -3,8 +3,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4=
|
github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbdFz6I=
|
||||||
github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc=
|
github.com/jonboulle/clockwork v0.5.0/go.mod h1:3mZlmanh0g2NDKO5TWZVJAfofYk64M7XN3SzBPjZF60=
|
||||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
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
|
||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY=
|
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI=
|
||||||
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
|
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
|
|
|
||||||
|
|
@ -1426,13 +1426,13 @@ func TestScheduler_OneTimeJob_DoesNotCleanupNext(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
runAt time.Time
|
runAt time.Time
|
||||||
fakeClock clockwork.FakeClock
|
fakeClock *clockwork.FakeClock
|
||||||
assertErr require.ErrorAssertionFunc
|
assertErr require.ErrorAssertionFunc
|
||||||
// asserts things about schedules, advance time and perform new assertions
|
// asserts things about schedules, advance time and perform new assertions
|
||||||
advanceAndAsserts []func(
|
advanceAndAsserts []func(
|
||||||
t *testing.T,
|
t *testing.T,
|
||||||
j Job,
|
j Job,
|
||||||
clock clockwork.FakeClock,
|
clock *clockwork.FakeClock,
|
||||||
runs *atomic.Uint32,
|
runs *atomic.Uint32,
|
||||||
)
|
)
|
||||||
}{
|
}{
|
||||||
|
|
@ -1440,8 +1440,8 @@ func TestScheduler_OneTimeJob_DoesNotCleanupNext(t *testing.T) {
|
||||||
name: "exhausted run do does not cleanup next item",
|
name: "exhausted run do does not cleanup next item",
|
||||||
runAt: time.Date(2024, time.April, 22, 4, 5, 0, 0, time.UTC),
|
runAt: time.Date(2024, time.April, 22, 4, 5, 0, 0, time.UTC),
|
||||||
fakeClock: clockwork.NewFakeClockAt(schedulerStartTime),
|
fakeClock: clockwork.NewFakeClockAt(schedulerStartTime),
|
||||||
advanceAndAsserts: []func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32){
|
advanceAndAsserts: []func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32){
|
||||||
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
|
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
|
||||||
require.Equal(t, uint32(0), runs.Load())
|
require.Equal(t, uint32(0), runs.Load())
|
||||||
|
|
||||||
// last not initialized
|
// last not initialized
|
||||||
|
|
@ -2377,13 +2377,13 @@ func TestScheduler_AtTimesJob(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
atTimes []time.Time
|
atTimes []time.Time
|
||||||
fakeClock clockwork.FakeClock
|
fakeClock *clockwork.FakeClock
|
||||||
assertErr require.ErrorAssertionFunc
|
assertErr require.ErrorAssertionFunc
|
||||||
// asserts things about schedules, advance time and perform new assertions
|
// asserts things about schedules, advance time and perform new assertions
|
||||||
advanceAndAsserts []func(
|
advanceAndAsserts []func(
|
||||||
t *testing.T,
|
t *testing.T,
|
||||||
j Job,
|
j Job,
|
||||||
clock clockwork.FakeClock,
|
clock *clockwork.FakeClock,
|
||||||
runs *atomic.Uint32,
|
runs *atomic.Uint32,
|
||||||
)
|
)
|
||||||
}{
|
}{
|
||||||
|
|
@ -2407,8 +2407,8 @@ func TestScheduler_AtTimesJob(t *testing.T) {
|
||||||
name: "one run 1 millisecond in the future",
|
name: "one run 1 millisecond in the future",
|
||||||
atTimes: []time.Time{n.Add(1 * time.Millisecond)},
|
atTimes: []time.Time{n.Add(1 * time.Millisecond)},
|
||||||
fakeClock: clockwork.NewFakeClockAt(n),
|
fakeClock: clockwork.NewFakeClockAt(n),
|
||||||
advanceAndAsserts: []func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32){
|
advanceAndAsserts: []func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32){
|
||||||
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
|
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
|
||||||
require.Equal(t, uint32(0), runs.Load())
|
require.Equal(t, uint32(0), runs.Load())
|
||||||
|
|
||||||
// last not initialized
|
// last not initialized
|
||||||
|
|
@ -2442,8 +2442,8 @@ func TestScheduler_AtTimesJob(t *testing.T) {
|
||||||
name: "one run in the past and one in the future",
|
name: "one run in the past and one in the future",
|
||||||
atTimes: []time.Time{n.Add(-1 * time.Millisecond), n.Add(1 * time.Millisecond)},
|
atTimes: []time.Time{n.Add(-1 * time.Millisecond), n.Add(1 * time.Millisecond)},
|
||||||
fakeClock: clockwork.NewFakeClockAt(n),
|
fakeClock: clockwork.NewFakeClockAt(n),
|
||||||
advanceAndAsserts: []func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32){
|
advanceAndAsserts: []func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32){
|
||||||
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
|
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
|
||||||
require.Equal(t, uint32(0), runs.Load())
|
require.Equal(t, uint32(0), runs.Load())
|
||||||
|
|
||||||
// last not initialized
|
// last not initialized
|
||||||
|
|
@ -2473,8 +2473,8 @@ func TestScheduler_AtTimesJob(t *testing.T) {
|
||||||
name: "two runs in the future - order is maintained even if times are provided out of order",
|
name: "two runs in the future - order is maintained even if times are provided out of order",
|
||||||
atTimes: []time.Time{n.Add(3 * time.Millisecond), n.Add(1 * time.Millisecond)},
|
atTimes: []time.Time{n.Add(3 * time.Millisecond), n.Add(1 * time.Millisecond)},
|
||||||
fakeClock: clockwork.NewFakeClockAt(n),
|
fakeClock: clockwork.NewFakeClockAt(n),
|
||||||
advanceAndAsserts: []func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32){
|
advanceAndAsserts: []func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32){
|
||||||
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
|
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
|
||||||
require.Equal(t, uint32(0), runs.Load())
|
require.Equal(t, uint32(0), runs.Load())
|
||||||
|
|
||||||
// last not initialized
|
// last not initialized
|
||||||
|
|
@ -2503,7 +2503,7 @@ func TestScheduler_AtTimesJob(t *testing.T) {
|
||||||
require.Equal(t, n.Add(3*time.Millisecond), nextRunAt)
|
require.Equal(t, n.Add(3*time.Millisecond), nextRunAt)
|
||||||
},
|
},
|
||||||
|
|
||||||
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
|
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
|
||||||
// advance and eventually run
|
// advance and eventually run
|
||||||
clock.Advance(2 * time.Millisecond)
|
clock.Advance(2 * time.Millisecond)
|
||||||
require.Eventually(t, func() bool {
|
require.Eventually(t, func() bool {
|
||||||
|
|
@ -2526,8 +2526,8 @@ func TestScheduler_AtTimesJob(t *testing.T) {
|
||||||
name: "two runs in the future - order is maintained even if times are provided out of order - deduplication",
|
name: "two runs in the future - order is maintained even if times are provided out of order - deduplication",
|
||||||
atTimes: []time.Time{n.Add(3 * time.Millisecond), n.Add(1 * time.Millisecond), n.Add(1 * time.Millisecond), n.Add(3 * time.Millisecond)},
|
atTimes: []time.Time{n.Add(3 * time.Millisecond), n.Add(1 * time.Millisecond), n.Add(1 * time.Millisecond), n.Add(3 * time.Millisecond)},
|
||||||
fakeClock: clockwork.NewFakeClockAt(n),
|
fakeClock: clockwork.NewFakeClockAt(n),
|
||||||
advanceAndAsserts: []func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32){
|
advanceAndAsserts: []func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32){
|
||||||
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
|
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
|
||||||
require.Equal(t, uint32(0), runs.Load())
|
require.Equal(t, uint32(0), runs.Load())
|
||||||
|
|
||||||
// last not initialized
|
// last not initialized
|
||||||
|
|
@ -2556,7 +2556,7 @@ func TestScheduler_AtTimesJob(t *testing.T) {
|
||||||
require.Equal(t, n.Add(3*time.Millisecond), nextRunAt)
|
require.Equal(t, n.Add(3*time.Millisecond), nextRunAt)
|
||||||
},
|
},
|
||||||
|
|
||||||
func(t *testing.T, j Job, clock clockwork.FakeClock, runs *atomic.Uint32) {
|
func(t *testing.T, j Job, clock *clockwork.FakeClock, runs *atomic.Uint32) {
|
||||||
// advance and eventually run
|
// advance and eventually run
|
||||||
clock.Advance(2 * time.Millisecond)
|
clock.Advance(2 * time.Millisecond)
|
||||||
require.Eventually(t, func() bool {
|
require.Eventually(t, func() bool {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue