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:
|
||||
matrix:
|
||||
go-version:
|
||||
- "1.20"
|
||||
- "1.21"
|
||||
- "1.22"
|
||||
# - "1.23"
|
||||
name: lint and test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
|
|||
|
|
@ -20,10 +20,9 @@ issues:
|
|||
linters:
|
||||
enable:
|
||||
- bodyclose
|
||||
- exportloopref
|
||||
- copyloopvar
|
||||
- gofumpt
|
||||
- goimports
|
||||
- gosec
|
||||
- gosimple
|
||||
- govet
|
||||
- ineffassign
|
||||
|
|
@ -39,6 +38,5 @@ output:
|
|||
- format: colored-line-number
|
||||
print-issued-lines: true
|
||||
print-linter-name: true
|
||||
uniq-by-line: true
|
||||
path-prefix: ""
|
||||
sort-results: true
|
||||
|
|
|
|||
|
|
@ -606,7 +606,7 @@ func ExampleWithClock() {
|
|||
),
|
||||
)
|
||||
s.Start()
|
||||
fakeClock.BlockUntil(1)
|
||||
_ = fakeClock.BlockUntilContext(context.Background(), 1)
|
||||
fakeClock.Advance(time.Second * 5)
|
||||
wg.Wait()
|
||||
_ = s.StopJobs()
|
||||
|
|
|
|||
6
go.mod
6
go.mod
|
|
@ -1,14 +1,14 @@
|
|||
module github.com/go-co-op/gocron/v2
|
||||
|
||||
go 1.20
|
||||
go 1.21.0
|
||||
|
||||
require (
|
||||
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/stretchr/testify v1.10.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 (
|
||||
|
|
|
|||
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/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/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4=
|
||||
github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc=
|
||||
github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbdFz6I=
|
||||
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/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
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=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
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-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI=
|
||||
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI=
|
||||
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 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
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 {
|
||||
name string
|
||||
runAt time.Time
|
||||
fakeClock clockwork.FakeClock
|
||||
fakeClock *clockwork.FakeClock
|
||||
assertErr require.ErrorAssertionFunc
|
||||
// asserts things about schedules, advance time and perform new assertions
|
||||
advanceAndAsserts []func(
|
||||
t *testing.T,
|
||||
j Job,
|
||||
clock clockwork.FakeClock,
|
||||
clock *clockwork.FakeClock,
|
||||
runs *atomic.Uint32,
|
||||
)
|
||||
}{
|
||||
|
|
@ -1440,8 +1440,8 @@ func TestScheduler_OneTimeJob_DoesNotCleanupNext(t *testing.T) {
|
|||
name: "exhausted run do does not cleanup next item",
|
||||
runAt: time.Date(2024, time.April, 22, 4, 5, 0, 0, time.UTC),
|
||||
fakeClock: clockwork.NewFakeClockAt(schedulerStartTime),
|
||||
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) {
|
||||
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) {
|
||||
require.Equal(t, uint32(0), runs.Load())
|
||||
|
||||
// last not initialized
|
||||
|
|
@ -2377,13 +2377,13 @@ func TestScheduler_AtTimesJob(t *testing.T) {
|
|||
tests := []struct {
|
||||
name string
|
||||
atTimes []time.Time
|
||||
fakeClock clockwork.FakeClock
|
||||
fakeClock *clockwork.FakeClock
|
||||
assertErr require.ErrorAssertionFunc
|
||||
// asserts things about schedules, advance time and perform new assertions
|
||||
advanceAndAsserts []func(
|
||||
t *testing.T,
|
||||
j Job,
|
||||
clock clockwork.FakeClock,
|
||||
clock *clockwork.FakeClock,
|
||||
runs *atomic.Uint32,
|
||||
)
|
||||
}{
|
||||
|
|
@ -2407,8 +2407,8 @@ func TestScheduler_AtTimesJob(t *testing.T) {
|
|||
name: "one run 1 millisecond in the future",
|
||||
atTimes: []time.Time{n.Add(1 * time.Millisecond)},
|
||||
fakeClock: clockwork.NewFakeClockAt(n),
|
||||
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) {
|
||||
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) {
|
||||
require.Equal(t, uint32(0), runs.Load())
|
||||
|
||||
// last not initialized
|
||||
|
|
@ -2442,8 +2442,8 @@ func TestScheduler_AtTimesJob(t *testing.T) {
|
|||
name: "one run in the past and one in the future",
|
||||
atTimes: []time.Time{n.Add(-1 * time.Millisecond), n.Add(1 * time.Millisecond)},
|
||||
fakeClock: clockwork.NewFakeClockAt(n),
|
||||
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) {
|
||||
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) {
|
||||
require.Equal(t, uint32(0), runs.Load())
|
||||
|
||||
// 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",
|
||||
atTimes: []time.Time{n.Add(3 * time.Millisecond), n.Add(1 * time.Millisecond)},
|
||||
fakeClock: clockwork.NewFakeClockAt(n),
|
||||
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) {
|
||||
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) {
|
||||
require.Equal(t, uint32(0), runs.Load())
|
||||
|
||||
// last not initialized
|
||||
|
|
@ -2503,7 +2503,7 @@ func TestScheduler_AtTimesJob(t *testing.T) {
|
|||
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
|
||||
clock.Advance(2 * time.Millisecond)
|
||||
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",
|
||||
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),
|
||||
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) {
|
||||
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) {
|
||||
require.Equal(t, uint32(0), runs.Load())
|
||||
|
||||
// last not initialized
|
||||
|
|
@ -2556,7 +2556,7 @@ func TestScheduler_AtTimesJob(t *testing.T) {
|
|||
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
|
||||
clock.Advance(2 * time.Millisecond)
|
||||
require.Eventually(t, func() bool {
|
||||
|
|
|
|||
Loading…
Reference in New Issue