Skip to content

Commit

Permalink
remove example that imports dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRoesler committed May 5, 2023
1 parent 30bc017 commit 75b8c4c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 33 deletions.
31 changes: 15 additions & 16 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"time"

"github.com/go-co-op/gocron"
"github.com/redis/go-redis/v9"
)

var task = func() {}
Expand Down Expand Up @@ -925,21 +924,21 @@ func ExampleScheduler_Weeks() {
}

func ExampleScheduler_WithDistributedLocker() {
redisOptions := &redis.Options{
Addr: "localhost:6379",
}
redisClient := redis.NewClient(redisOptions)
locker, err := gocron.NewRedisLocker(redisClient)
if err != nil {
// handle the error
}

s := gocron.NewScheduler(time.UTC)
s.WithDistributedLocker(locker)
_, err = s.Every("500ms").Do(task)
if err != nil {
// handle the error
}
//redisOptions := &redis.Options{
// Addr: "localhost:6379",
//}
//redisClient := redis.NewClient(redisOptions)
//locker, err := redislock.NewRedisLocker(redisClient)
//if err != nil {
// // handle the error
//}
//
//s := gocron.NewScheduler(time.UTC)
//s.WithDistributedLocker(locker)
//_, err = s.Every("500ms").Do(task)
//if err != nil {
// // handle the error
//}
}

// ---------------------------------------------------------------------
Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ module github.com/go-co-op/gocron
go 1.20

require (
github.com/redis/go-redis/v9 v9.0.2
github.com/robfig/cron/v3 v3.0.1
github.com/stretchr/testify v1.8.2
)

require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
Expand Down
8 changes: 0 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
github.com/bsm/ginkgo/v2 v2.5.0 h1:aOAnND1T40wEdAtkGSkvSICWeQ8L3UASX7YVCqQx+eQ=
github.com/bsm/gomega v1.20.0 h1:JhAwLmtRzXFTx2AkALSLa8ijZafntmhSoU63Ok18Uq8=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
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/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
Expand All @@ -19,8 +13,6 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/redis/go-redis/v9 v9.0.2 h1:BA426Zqe/7r56kCcvxYLWe1mkaz71LKF77GwgFzSxfE=
github.com/redis/go-redis/v9 v9.0.2/go.mod h1:/xDTe9EF1LM61hek62Poq2nzQSGj0xSrEtEHbBQevps=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
Expand Down
4 changes: 2 additions & 2 deletions lockers/redislock/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ require (
github.com/go-redsync/redsync/v4 v4.8.1
github.com/redis/go-redis/v9 v9.0.4
github.com/stretchr/testify v1.8.2
github.com/testcontainers/testcontainers-go/modules/redis v0.0.0-20230424150504-5185956fa1de
github.com/testcontainers/testcontainers-go/modules/redis v0.0.0-20230503220718-0df60de8ccd8
)

replace github.com/testcontainers/testcontainers-go v0.19.0 => github.com/testcontainers/testcontainers-go v0.0.0-20230424150504-5185956fa1de
replace github.com/testcontainers/testcontainers-go v0.19.0 => github.com/testcontainers/testcontainers-go v0.0.0-20230503220718-0df60de8ccd8

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
Expand Down
8 changes: 4 additions & 4 deletions lockers/redislock/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203 h1:QVqDTf3h2WHt08YuiTGPZLls0Wq99X9bWd0Q5ZSBesM=
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8=
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/testcontainers/testcontainers-go v0.0.0-20230424150504-5185956fa1de h1:gaOmmytMpo7biJeedaBb/A+C+yylPxRBTxEzxsleIVQ=
github.com/testcontainers/testcontainers-go v0.0.0-20230424150504-5185956fa1de/go.mod h1:06ElgudaiCzj7oHlKy2f/Osmsr2kaLK+bfWU4CdiUqY=
github.com/testcontainers/testcontainers-go/modules/redis v0.0.0-20230424150504-5185956fa1de h1:7PhmUZ/ldTX/6KVrr71aKvhFF+y6h+6FCGORW1AlFzg=
github.com/testcontainers/testcontainers-go/modules/redis v0.0.0-20230424150504-5185956fa1de/go.mod h1:qwEVNfsWRS1JPM4liD82b8UXD1tVQ0rI791uLYnZJNg=
github.com/testcontainers/testcontainers-go v0.0.0-20230503220718-0df60de8ccd8 h1:atmQux3l6blXSWP4HA4UiUO0VASfsLQr5A1uRtDdg/A=
github.com/testcontainers/testcontainers-go v0.0.0-20230503220718-0df60de8ccd8/go.mod h1:LTa6q4eygL67Y8LvAmjaUGIiFZlZ+VYvHOWjXLWP8Vg=
github.com/testcontainers/testcontainers-go/modules/redis v0.0.0-20230503220718-0df60de8ccd8 h1:kEUyp6sS3XIvtfSou6+XJMUBzB9qXUHgnRdzjPPgTqQ=
github.com/testcontainers/testcontainers-go/modules/redis v0.0.0-20230503220718-0df60de8ccd8/go.mod h1:kOYoiN2wIJsIxSyrfGYvsw5v2HgHRSTlyj0R44L3JFM=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
Expand Down

0 comments on commit 75b8c4c

Please sign in to comment.