From 2929d958fcf8ae2828f9a7d5b8dd4da3c674dac8 Mon Sep 17 00:00:00 2001 From: Noah Lackstein Date: Mon, 31 Oct 2022 11:10:56 -0700 Subject: [PATCH 1/3] Upgrade BurntSushi/toml to avoid decoding bug --- cron/cron.go | 1 + go.mod | 2 ++ go.sum | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cron/cron.go b/cron/cron.go index 362941c..8bfe528 100644 --- a/cron/cron.go +++ b/cron/cron.go @@ -3,6 +3,7 @@ package cron import ( "encoding/json" "fmt" + "github.com/DataDog/datadog-go/statsd" "github.com/contribsys/faktory/client" "github.com/contribsys/faktory/server" diff --git a/go.mod b/go.mod index 1182e5d..930a689 100644 --- a/go.mod +++ b/go.mod @@ -24,3 +24,5 @@ require ( golang.org/x/sys v0.0.0-20211013075003-97ac67df715c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +replace github.com/BurntSushi/toml v0.4.1 => github.com/BurntSushi/toml v1.2.1 diff --git a/go.sum b/go.sum index b9a1124..032a730 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= -github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/DataDog/datadog-go v4.8.2+incompatible h1:qbcKSx29aBLD+5QLvlQZlGmRMF/FfGqFLFev/1TDzRo= github.com/DataDog/datadog-go v4.8.2+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= github.com/Microsoft/go-winio v0.5.1 h1:aPJp2QD7OOrhO5tQXqQoGSJc+DjDtWTGLOmNyAm6FgY= From d4eed664d1f393a139d37cbe9baf75b84f50a8ac Mon Sep 17 00:00:00 2001 From: Noah Lackstein Date: Mon, 31 Oct 2022 11:30:09 -0700 Subject: [PATCH 2/3] Clean up some linting errors --- cron/cron.go | 2 +- cron/cron_test.go | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cron/cron.go b/cron/cron.go index 8bfe528..e2f5c85 100644 --- a/cron/cron.go +++ b/cron/cron.go @@ -107,7 +107,7 @@ func (c *CronSubsystem) createCron() { } func (c *CronSubsystem) addCronJobs() error { - for index, _ := range c.Options.CronJobs { + for index := range c.Options.CronJobs { job := &c.Options.CronJobs[index] id, err := c.Cron.AddJob(job.Schedule, &QueueJob{ Subsystem: c, diff --git a/cron/cron_test.go b/cron/cron_test.go index 5a27061..274f007 100644 --- a/cron/cron_test.go +++ b/cron/cron_test.go @@ -24,7 +24,7 @@ const ( args = [1, 3] [cron.job.custom] testing = true - + [[ cron ]] schedule = "* * * * * *" # every second [cron.job] @@ -298,7 +298,14 @@ func TestCron(t *testing.T) { func runSystem(configDir string, runner func(s *server.Server)) { dir := "/tmp/cron_system.db" defer os.RemoveAll(dir) - opts := &cli.CliOptions{"localhost:7417", "localhost:7420", "development", configDir, "debug", dir} + opts := &cli.CliOptions{ + CmdBinding: "localhost:7417", + WebBinding: "localhost:7420", + Environment: "development", + ConfigDirectory: configDir, + LogLevel: "debug", + StorageDirectory: dir, + } s, stopper, err := cli.BuildServer(opts) defer s.Stop(nil) From 9b7f0c73089907e61ea2956338713c967ff40a5e Mon Sep 17 00:00:00 2001 From: Noah Lackstein Date: Mon, 31 Oct 2022 12:26:51 -0700 Subject: [PATCH 3/3] Update require instead of replace --- go.mod | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 930a689..08f2d51 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( ) require ( - github.com/BurntSushi/toml v0.4.1 // indirect + github.com/BurntSushi/toml v1.2.1 // indirect github.com/Microsoft/go-winio v0.5.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/justinas/nosurf v1.1.1 // indirect @@ -24,5 +24,3 @@ require ( golang.org/x/sys v0.0.0-20211013075003-97ac67df715c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) - -replace github.com/BurntSushi/toml v0.4.1 => github.com/BurntSushi/toml v1.2.1