diff --git a/cmd/deduplicate.go b/cmd/deduplicate.go index 54b21ab..a55653a 100644 --- a/cmd/deduplicate.go +++ b/cmd/deduplicate.go @@ -4,7 +4,6 @@ import ( "context" "flag" "fmt" - "io" "strings" "github.com/peterbourgon/ff/v3/ffcli" @@ -16,10 +15,8 @@ import ( type DeduplicateConfig struct { rootConfig *RootConfig - out io.Writer database string - table string final bool by columnList except columnList diff --git a/cmd/run.go b/cmd/run.go index bc287e1..26f9c91 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -144,5 +144,7 @@ func startServer(ctx context.Context, cfg config.Server, ctl *controller.Control ReadinessCheck: func() error { return ctl.CheckReadiness(ctx) }, }) - go srv.Serve(ctx) + if err := srv.Serve(ctx); err != nil { + log.Printf("error during server shutdown: %v\n", err) + } } diff --git a/justfile b/justfile index 7cd2f83..e3497a1 100644 --- a/justfile +++ b/justfile @@ -17,6 +17,9 @@ default: fmt: go fmt ./... +lint: + golangci-lint run ./... + # vet code vet: go vet ./... diff --git a/pkg/models/trace.go b/pkg/models/trace.go index 89c5ee8..34ee766 100644 --- a/pkg/models/trace.go +++ b/pkg/models/trace.go @@ -281,9 +281,6 @@ func jobSpanAttributes(job *Job) map[string]string { func sectionSpanAttributes(section *Section) map[string]string { attr := map[string]string{} - if section != nil { - } - return attr } diff --git a/pkg/server/server.go b/pkg/server/server.go index 09b6a58..9c74871 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -71,10 +71,6 @@ func (s *Server) Serve(ctx context.Context) error { } }() - select { - case <-ctx.Done(): - srv.Shutdown(ctx) - } - - return nil + <-ctx.Done() + return srv.Shutdown(ctx) } diff --git a/pkg/tasks/deduplicate.go b/pkg/tasks/deduplicate.go index c9db433..b218ab9 100644 --- a/pkg/tasks/deduplicate.go +++ b/pkg/tasks/deduplicate.go @@ -32,7 +32,7 @@ func DeduplicateTable(ctx context.Context, opt DeduplicateTableOptions, ch *clic func PrepareDeduplicateQuery(opt DeduplicateTableOptions) (string, map[string]string) { var ( - query = "" + query string params = map[string]string{} ) diff --git a/pkg/worker/worker.go b/pkg/worker/worker.go index 97ff439..8c68862 100644 --- a/pkg/worker/worker.go +++ b/pkg/worker/worker.go @@ -31,7 +31,7 @@ func (w *worker) Done() <-chan struct{} { return w.done } -func newWorker(run func(context.Context)) Worker { +func NewWorker(run func(context.Context)) Worker { return &worker{ done: make(chan struct{}), run: run,