diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8f9491cf3..15a2b2b77 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,5 +17,5 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.51.2 + version: v1.52.2 diff --git a/pkg/conduit/runtime.go b/pkg/conduit/runtime.go index 6f4b01313..3de6cc6c3 100644 --- a/pkg/conduit/runtime.go +++ b/pkg/conduit/runtime.go @@ -454,9 +454,7 @@ func (r *Runtime) serveHTTPAPI( handler := grpcutil.WithWebsockets( ctx, - grpcutil.WithDefaultGatewayMiddleware( - r.logger, allowCORS(gwmux, "http://localhost:4200"), - ), + grpcutil.WithDefaultGatewayMiddleware(allowCORS(gwmux, "http://localhost:4200")), r.logger, ) diff --git a/pkg/connector/instance.go b/pkg/connector/instance.go index 3161bdd61..0610eacac 100644 --- a/pkg/connector/instance.go +++ b/pkg/connector/instance.go @@ -108,7 +108,7 @@ func (i *Instance) Inspect(ctx context.Context) *inspector.Session { // when Open is called in the returned connector. // If a connector is already running for this Instance this method returns an // error. -func (i *Instance) Connector(ctx context.Context, dispenserFetcher PluginDispenserFetcher) (Connector, error) { +func (i *Instance) Connector(_ context.Context, dispenserFetcher PluginDispenserFetcher) (Connector, error) { if i.connector != nil { // connector is already running, might be a bug where an old connector is stuck return nil, ErrConnectorRunning diff --git a/pkg/connector/service.go b/pkg/connector/service.go index eb86c047d..bf06df3bc 100644 --- a/pkg/connector/service.go +++ b/pkg/connector/service.go @@ -69,7 +69,7 @@ func (s *Service) Check(ctx context.Context) error { // List returns a map of Instances keyed by their ID. Instances do not // necessarily have a running plugin associated with them. -func (s *Service) List(ctx context.Context) map[string]*Instance { +func (s *Service) List(context.Context) map[string]*Instance { // make a copy of the map tmp := make(map[string]*Instance, len(s.connectors)) for k, v := range s.connectors { @@ -79,7 +79,7 @@ func (s *Service) List(ctx context.Context) map[string]*Instance { } // Get retrieves a single connector instance by ID. -func (s *Service) Get(ctx context.Context, id string) (*Instance, error) { +func (s *Service) Get(_ context.Context, id string) (*Instance, error) { ins, ok := s.connectors[id] if !ok { return nil, cerrors.Errorf("%w (ID: %s)", ErrInstanceNotFound, id) diff --git a/pkg/connector/source_test.go b/pkg/connector/source_test.go index ba838a400..d74197888 100644 --- a/pkg/connector/source_test.go +++ b/pkg/connector/source_test.go @@ -101,7 +101,7 @@ func TestSource_Ack_Deadlock(t *testing.T) { // testPluginFetcher fulfills the PluginFetcher interface. type testPluginFetcher map[string]plugin.Dispenser -func (tpf testPluginFetcher) NewDispenser(logger log.CtxLogger, name string) (plugin.Dispenser, error) { +func (tpf testPluginFetcher) NewDispenser(_ log.CtxLogger, name string) (plugin.Dispenser, error) { plug, ok := tpf[name] if !ok { return nil, plugin.ErrPluginNotFound diff --git a/pkg/foundation/csync/valuewatcher.go b/pkg/foundation/csync/valuewatcher.go index 45e6435fd..513363865 100644 --- a/pkg/foundation/csync/valuewatcher.go +++ b/pkg/foundation/csync/valuewatcher.go @@ -139,6 +139,7 @@ func (vw *ValueWatcher[T]) subscribe() (chan T, func()) { func (vw *ValueWatcher[T]) unsubscribe(id string, c chan T) { // drain channel and remove it go func() { + //nolint:revive // see comment below for range c { // Do nothing, just drain channel. In case another goroutine tries // to store a new value by calling ValueWatcher.Set, this goroutine diff --git a/pkg/foundation/ctxutil/filepath.go b/pkg/foundation/ctxutil/filepath.go index a4ff01203..019e93ad2 100644 --- a/pkg/foundation/ctxutil/filepath.go +++ b/pkg/foundation/ctxutil/filepath.go @@ -44,7 +44,7 @@ func FilepathFromContext(ctx context.Context) string { type FilepathLogCtxHook struct{} // Run executes the log hook. -func (h FilepathLogCtxHook) Run(ctx context.Context, e *zerolog.Event, lvl zerolog.Level) { +func (h FilepathLogCtxHook) Run(ctx context.Context, e *zerolog.Event, _ zerolog.Level) { p := FilepathFromContext(ctx) if p != "" { e.Str(log.FilepathField, p) diff --git a/pkg/foundation/ctxutil/messageid.go b/pkg/foundation/ctxutil/messageid.go index e0d144e9a..95826aede 100644 --- a/pkg/foundation/ctxutil/messageid.go +++ b/pkg/foundation/ctxutil/messageid.go @@ -44,7 +44,7 @@ func MessageIDFromContext(ctx context.Context) string { type MessageIDLogCtxHook struct{} // Run executes the log hook. -func (h MessageIDLogCtxHook) Run(ctx context.Context, e *zerolog.Event, lvl zerolog.Level) { +func (h MessageIDLogCtxHook) Run(ctx context.Context, e *zerolog.Event, _ zerolog.Level) { p := MessageIDFromContext(ctx) if p != "" { e.Str(log.MessageIDField, p) diff --git a/pkg/foundation/ctxutil/requestid.go b/pkg/foundation/ctxutil/requestid.go index 86b859543..4f0a173c2 100644 --- a/pkg/foundation/ctxutil/requestid.go +++ b/pkg/foundation/ctxutil/requestid.go @@ -44,7 +44,7 @@ func RequestIDFromContext(ctx context.Context) string { type RequestIDLogCtxHook struct{} // Run executes the log hook. -func (h RequestIDLogCtxHook) Run(ctx context.Context, e *zerolog.Event, lvl zerolog.Level) { +func (h RequestIDLogCtxHook) Run(ctx context.Context, e *zerolog.Event, _ zerolog.Level) { p := RequestIDFromContext(ctx) if p != "" { e.Str(log.RequestIDField, p) diff --git a/pkg/foundation/database/inmemory/db.go b/pkg/foundation/database/inmemory/db.go index 48909a66d..68b6b3a8c 100644 --- a/pkg/foundation/database/inmemory/db.go +++ b/pkg/foundation/database/inmemory/db.go @@ -71,7 +71,7 @@ func (t *Txn) Discard() { // do nothing } -func (d *DB) NewTransaction(ctx context.Context, update bool) (database.Transaction, context.Context, error) { +func (d *DB) NewTransaction(ctx context.Context, _ bool) (database.Transaction, context.Context, error) { d.m.Lock() defer d.m.Unlock() diff --git a/pkg/foundation/grpcutil/gateway.go b/pkg/foundation/grpcutil/gateway.go index 3c3ea7e20..8d46c956a 100644 --- a/pkg/foundation/grpcutil/gateway.go +++ b/pkg/foundation/grpcutil/gateway.go @@ -76,7 +76,7 @@ func WithErrorHandler(logger log.CtxLogger) runtime.ServeMuxOption { // WithDefaultGatewayMiddleware wraps the handler with the default GRPC Gateway // middleware. -func WithDefaultGatewayMiddleware(logger log.CtxLogger, h http.Handler) http.Handler { +func WithDefaultGatewayMiddleware(h http.Handler) http.Handler { middleware := []func(http.Handler) http.Handler{ WithPrettyJSONHeader, WithHTTPEndpointHeader, diff --git a/pkg/foundation/grpcutil/websocket.go b/pkg/foundation/grpcutil/websocket.go index 1dece5aff..d30c59433 100644 --- a/pkg/foundation/grpcutil/websocket.go +++ b/pkg/foundation/grpcutil/websocket.go @@ -233,6 +233,7 @@ func (p *webSocketProxy) startWebSocketWrite(ctx context.Context, messages chan defer func() { ticker.Stop() cancelFn() + //nolint:revive // draining the channel for range messages { // throw away } diff --git a/pkg/foundation/log/component.go b/pkg/foundation/log/component.go index 313316988..b36bd25ef 100644 --- a/pkg/foundation/log/component.go +++ b/pkg/foundation/log/component.go @@ -26,7 +26,7 @@ type componentHook struct { } // Run executes the componentHook. -func (ch componentHook) Run(ctx context.Context, e *zerolog.Event, l zerolog.Level) { +func (ch componentHook) Run(_ context.Context, e *zerolog.Event, _ zerolog.Level) { if ch.name != "" { e.Str(ComponentField, ch.name) } diff --git a/pkg/foundation/metrics/metrics.go b/pkg/foundation/metrics/metrics.go index 39ae1baf1..d7715610d 100644 --- a/pkg/foundation/metrics/metrics.go +++ b/pkg/foundation/metrics/metrics.go @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:generate mockgen -destination=mock/metrics.go -package=mock -mock_names=Counter=Counter,LabeledCounter=LabeledCounter,Gauge=Gauge,LabeledGauge=LabeledGauge,Timer=Timer,LabeledTimer=LabeledTimer . Counter,LabeledCounter,Gauge,LabeledGauge,Timer,LabeledTimer - package metrics import ( diff --git a/pkg/foundation/metrics/mock/metrics.go b/pkg/foundation/metrics/mock/metrics.go deleted file mode 100644 index a70517a39..000000000 --- a/pkg/foundation/metrics/mock/metrics.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/conduitio/conduit/pkg/foundation/metrics (interfaces: Counter,LabeledCounter,Gauge,LabeledGauge,Timer,LabeledTimer) - -// Package mock is a generated GoMock package. -package mock - -import ( - reflect "reflect" - time "time" - - metrics "github.com/conduitio/conduit/pkg/foundation/metrics" - gomock "github.com/golang/mock/gomock" -) - -// Counter is a mock of Counter interface. -type Counter struct { - ctrl *gomock.Controller - recorder *CounterMockRecorder -} - -// CounterMockRecorder is the mock recorder for Counter. -type CounterMockRecorder struct { - mock *Counter -} - -// NewCounter creates a new mock instance. -func NewCounter(ctrl *gomock.Controller) *Counter { - mock := &Counter{ctrl: ctrl} - mock.recorder = &CounterMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *Counter) EXPECT() *CounterMockRecorder { - return m.recorder -} - -// Inc mocks base method. -func (m *Counter) Inc(arg0 ...float64) { - m.ctrl.T.Helper() - varargs := []interface{}{} - for _, a := range arg0 { - varargs = append(varargs, a) - } - m.ctrl.Call(m, "Inc", varargs...) -} - -// Inc indicates an expected call of Inc. -func (mr *CounterMockRecorder) Inc(arg0 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Inc", reflect.TypeOf((*Counter)(nil).Inc), arg0...) -} - -// LabeledCounter is a mock of LabeledCounter interface. -type LabeledCounter struct { - ctrl *gomock.Controller - recorder *LabeledCounterMockRecorder -} - -// LabeledCounterMockRecorder is the mock recorder for LabeledCounter. -type LabeledCounterMockRecorder struct { - mock *LabeledCounter -} - -// NewLabeledCounter creates a new mock instance. -func NewLabeledCounter(ctrl *gomock.Controller) *LabeledCounter { - mock := &LabeledCounter{ctrl: ctrl} - mock.recorder = &LabeledCounterMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *LabeledCounter) EXPECT() *LabeledCounterMockRecorder { - return m.recorder -} - -// WithValues mocks base method. -func (m *LabeledCounter) WithValues(arg0 ...string) metrics.Counter { - m.ctrl.T.Helper() - varargs := []interface{}{} - for _, a := range arg0 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "WithValues", varargs...) - ret0, _ := ret[0].(metrics.Counter) - return ret0 -} - -// WithValues indicates an expected call of WithValues. -func (mr *LabeledCounterMockRecorder) WithValues(arg0 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithValues", reflect.TypeOf((*LabeledCounter)(nil).WithValues), arg0...) -} - -// Gauge is a mock of Gauge interface. -type Gauge struct { - ctrl *gomock.Controller - recorder *GaugeMockRecorder -} - -// GaugeMockRecorder is the mock recorder for Gauge. -type GaugeMockRecorder struct { - mock *Gauge -} - -// NewGauge creates a new mock instance. -func NewGauge(ctrl *gomock.Controller) *Gauge { - mock := &Gauge{ctrl: ctrl} - mock.recorder = &GaugeMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *Gauge) EXPECT() *GaugeMockRecorder { - return m.recorder -} - -// Dec mocks base method. -func (m *Gauge) Dec(arg0 ...float64) { - m.ctrl.T.Helper() - varargs := []interface{}{} - for _, a := range arg0 { - varargs = append(varargs, a) - } - m.ctrl.Call(m, "Dec", varargs...) -} - -// Dec indicates an expected call of Dec. -func (mr *GaugeMockRecorder) Dec(arg0 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Dec", reflect.TypeOf((*Gauge)(nil).Dec), arg0...) -} - -// Inc mocks base method. -func (m *Gauge) Inc(arg0 ...float64) { - m.ctrl.T.Helper() - varargs := []interface{}{} - for _, a := range arg0 { - varargs = append(varargs, a) - } - m.ctrl.Call(m, "Inc", varargs...) -} - -// Inc indicates an expected call of Inc. -func (mr *GaugeMockRecorder) Inc(arg0 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Inc", reflect.TypeOf((*Gauge)(nil).Inc), arg0...) -} - -// Set mocks base method. -func (m *Gauge) Set(arg0 float64) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Set", arg0) -} - -// Set indicates an expected call of Set. -func (mr *GaugeMockRecorder) Set(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Set", reflect.TypeOf((*Gauge)(nil).Set), arg0) -} - -// LabeledGauge is a mock of LabeledGauge interface. -type LabeledGauge struct { - ctrl *gomock.Controller - recorder *LabeledGaugeMockRecorder -} - -// LabeledGaugeMockRecorder is the mock recorder for LabeledGauge. -type LabeledGaugeMockRecorder struct { - mock *LabeledGauge -} - -// NewLabeledGauge creates a new mock instance. -func NewLabeledGauge(ctrl *gomock.Controller) *LabeledGauge { - mock := &LabeledGauge{ctrl: ctrl} - mock.recorder = &LabeledGaugeMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *LabeledGauge) EXPECT() *LabeledGaugeMockRecorder { - return m.recorder -} - -// WithValues mocks base method. -func (m *LabeledGauge) WithValues(arg0 ...string) metrics.Gauge { - m.ctrl.T.Helper() - varargs := []interface{}{} - for _, a := range arg0 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "WithValues", varargs...) - ret0, _ := ret[0].(metrics.Gauge) - return ret0 -} - -// WithValues indicates an expected call of WithValues. -func (mr *LabeledGaugeMockRecorder) WithValues(arg0 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithValues", reflect.TypeOf((*LabeledGauge)(nil).WithValues), arg0...) -} - -// Timer is a mock of Timer interface. -type Timer struct { - ctrl *gomock.Controller - recorder *TimerMockRecorder -} - -// TimerMockRecorder is the mock recorder for Timer. -type TimerMockRecorder struct { - mock *Timer -} - -// NewTimer creates a new mock instance. -func NewTimer(ctrl *gomock.Controller) *Timer { - mock := &Timer{ctrl: ctrl} - mock.recorder = &TimerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *Timer) EXPECT() *TimerMockRecorder { - return m.recorder -} - -// Update mocks base method. -func (m *Timer) Update(arg0 time.Duration) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "Update", arg0) -} - -// Update indicates an expected call of Update. -func (mr *TimerMockRecorder) Update(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*Timer)(nil).Update), arg0) -} - -// UpdateSince mocks base method. -func (m *Timer) UpdateSince(arg0 time.Time) { - m.ctrl.T.Helper() - m.ctrl.Call(m, "UpdateSince", arg0) -} - -// UpdateSince indicates an expected call of UpdateSince. -func (mr *TimerMockRecorder) UpdateSince(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSince", reflect.TypeOf((*Timer)(nil).UpdateSince), arg0) -} - -// LabeledTimer is a mock of LabeledTimer interface. -type LabeledTimer struct { - ctrl *gomock.Controller - recorder *LabeledTimerMockRecorder -} - -// LabeledTimerMockRecorder is the mock recorder for LabeledTimer. -type LabeledTimerMockRecorder struct { - mock *LabeledTimer -} - -// NewLabeledTimer creates a new mock instance. -func NewLabeledTimer(ctrl *gomock.Controller) *LabeledTimer { - mock := &LabeledTimer{ctrl: ctrl} - mock.recorder = &LabeledTimerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *LabeledTimer) EXPECT() *LabeledTimerMockRecorder { - return m.recorder -} - -// WithValues mocks base method. -func (m *LabeledTimer) WithValues(arg0 ...string) metrics.Timer { - m.ctrl.T.Helper() - varargs := []interface{}{} - for _, a := range arg0 { - varargs = append(varargs, a) - } - ret := m.ctrl.Call(m, "WithValues", varargs...) - ret0, _ := ret[0].(metrics.Timer) - return ret0 -} - -// WithValues indicates an expected call of WithValues. -func (mr *LabeledTimerMockRecorder) WithValues(arg0 ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithValues", reflect.TypeOf((*LabeledTimer)(nil).WithValues), arg0...) -} diff --git a/pkg/foundation/metrics/mock/registry.go b/pkg/foundation/metrics/mock/registry.go deleted file mode 100644 index 2a764c316..000000000 --- a/pkg/foundation/metrics/mock/registry.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright © 2022 Meroxa, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package mock - -import ( - "github.com/conduitio/conduit/pkg/foundation/metrics" - "github.com/golang/mock/gomock" -) - -// Registry is a metrics registry that can build mocked metrics. -type Registry struct { - Ctrl *gomock.Controller - - SetupCounter func(source *Counter) - SetupGauge func(source *Gauge) - SetupTimer func(source *Timer) - SetupLabeledCounter func(source *LabeledCounter) - SetupLabeledGauge func(source *LabeledGauge) - SetupLabeledTimer func(source *LabeledTimer) -} - -func (r Registry) NewCounter(name, help string) metrics.Counter { - return NewCounter(r.Ctrl) -} - -func (r Registry) NewGauge(name, help string) metrics.Gauge { - return NewGauge(r.Ctrl) -} - -func (r Registry) NewTimer(name, help string) metrics.Timer { - return NewTimer(r.Ctrl) -} - -func (r Registry) NewLabeledCounter(name, help string, labels ...string) metrics.LabeledCounter { - return NewLabeledCounter(r.Ctrl) -} - -func (r Registry) NewLabeledGauge(name, help string, labels ...string) metrics.LabeledGauge { - return NewLabeledGauge(r.Ctrl) -} - -func (r Registry) NewLabeledTimer(name, help string, labels ...string) metrics.LabeledTimer { - return NewLabeledTimer(r.Ctrl) -} diff --git a/pkg/inspector/inspector_test.go b/pkg/inspector/inspector_test.go index 5c0bcd2ff..2b0a6929a 100644 --- a/pkg/inspector/inspector_test.go +++ b/pkg/inspector/inspector_test.go @@ -27,7 +27,7 @@ import ( "github.com/matryer/is" ) -func TestInspector_Send_NoSessions(t *testing.T) { +func TestInspector_Send_NoSessions(*testing.T) { underTest := New(log.Nop(), 10) underTest.Send(context.Background(), record.Record{}) } diff --git a/pkg/pipeline/lifecycle_test.go b/pkg/pipeline/lifecycle_test.go index 8479edd9b..bf490bfd2 100644 --- a/pkg/pipeline/lifecycle_test.go +++ b/pkg/pipeline/lifecycle_test.go @@ -538,7 +538,7 @@ func dummyDestination(persister *connector.Persister) *connector.Instance { // testConnectorFetcher fulfills the ConnectorFetcher interface. type testConnectorFetcher map[string]*connector.Instance -func (tcf testConnectorFetcher) Get(ctx context.Context, id string) (*connector.Instance, error) { +func (tcf testConnectorFetcher) Get(_ context.Context, id string) (*connector.Instance, error) { conn, ok := tcf[id] if !ok { return nil, connector.ErrInstanceNotFound @@ -553,7 +553,7 @@ func (tcf testConnectorFetcher) Create(context.Context, string, connector.Type, // testProcessorFetcher fulfills the ProcessorFetcher interface. type testProcessorFetcher map[string]*processor.Instance -func (tpf testProcessorFetcher) Get(ctx context.Context, id string) (*processor.Instance, error) { +func (tpf testProcessorFetcher) Get(_ context.Context, id string) (*processor.Instance, error) { proc, ok := tpf[id] if !ok { return nil, processor.ErrInstanceNotFound @@ -564,7 +564,7 @@ func (tpf testProcessorFetcher) Get(ctx context.Context, id string) (*processor. // testPluginFetcher fulfills the PluginFetcher interface. type testPluginFetcher map[string]plugin.Dispenser -func (tpf testPluginFetcher) NewDispenser(logger log.CtxLogger, name string) (plugin.Dispenser, error) { +func (tpf testPluginFetcher) NewDispenser(_ log.CtxLogger, name string) (plugin.Dispenser, error) { plug, ok := tpf[name] if !ok { return nil, plugin.ErrPluginNotFound diff --git a/pkg/pipeline/service.go b/pkg/pipeline/service.go index 02cf41b02..6fa0315a7 100644 --- a/pkg/pipeline/service.go +++ b/pkg/pipeline/service.go @@ -76,7 +76,7 @@ func (s *Service) Init(ctx context.Context) error { } // List returns all pipeline instances in the Service. -func (s *Service) List(ctx context.Context) map[string]*Instance { +func (s *Service) List(context.Context) map[string]*Instance { if len(s.instances) == 0 { return nil } @@ -91,7 +91,7 @@ func (s *Service) List(ctx context.Context) map[string]*Instance { } // Get will return a single pipeline instance or an error. -func (s *Service) Get(ctx context.Context, id string) (*Instance, error) { +func (s *Service) Get(_ context.Context, id string) (*Instance, error) { p, ok := s.instances[id] if !ok { return nil, cerrors.Errorf("%w (ID: %s)", ErrInstanceNotFound, id) diff --git a/pkg/plugin/service.go b/pkg/plugin/service.go index 44e3ba545..385010127 100644 --- a/pkg/plugin/service.go +++ b/pkg/plugin/service.go @@ -76,7 +76,7 @@ func (s *Service) NewDispenser(logger log.CtxLogger, name string) (Dispenser, er } } -func (s *Service) List(ctx context.Context) (map[string]Specification, error) { +func (s *Service) List(context.Context) (map[string]Specification, error) { builtinSpecs := s.builtin.List() standaloneSpecs := s.standalone.List() diff --git a/pkg/plugin/standalone/test/testplugin/main.go b/pkg/plugin/standalone/test/testplugin/main.go index f09b97a6f..2024fd4d4 100644 --- a/pkg/plugin/standalone/test/testplugin/main.go +++ b/pkg/plugin/standalone/test/testplugin/main.go @@ -68,7 +68,7 @@ func main() { type specifierPlugin struct{} -func (s specifierPlugin) Specify(ctx context.Context, request cpluginv1.SpecifierSpecifyRequest) (cpluginv1.SpecifierSpecifyResponse, error) { +func (s specifierPlugin) Specify(context.Context, cpluginv1.SpecifierSpecifyRequest) (cpluginv1.SpecifierSpecifyResponse, error) { return cpluginv1.SpecifierSpecifyResponse{ Name: testPluginName, Summary: testPluginSummary, diff --git a/pkg/plugin/standalone/v1/destination.go b/pkg/plugin/standalone/v1/destination.go index 1b78b8d3b..b8d44b6d5 100644 --- a/pkg/plugin/standalone/v1/destination.go +++ b/pkg/plugin/standalone/v1/destination.go @@ -40,7 +40,7 @@ func (p *GRPCDestinationPlugin) GRPCClient(_ context.Context, _ *goplugin.GRPCBr // GRPCServer always returns an error; we're only implementing the client half // of the interface. -func (p *GRPCDestinationPlugin) GRPCServer(broker *goplugin.GRPCBroker, s *grpc.Server) error { +func (p *GRPCDestinationPlugin) GRPCServer(*goplugin.GRPCBroker, *grpc.Server) error { return cerrors.New("this package only implements gRPC clients") } @@ -75,7 +75,7 @@ func (s *destinationPluginClient) Start(ctx context.Context) error { return nil } -func (s *destinationPluginClient) Write(ctx context.Context, r record.Record) error { +func (s *destinationPluginClient) Write(_ context.Context, r record.Record) error { if s.stream == nil { return plugin.ErrStreamNotOpen } @@ -96,7 +96,7 @@ func (s *destinationPluginClient) Write(ctx context.Context, r record.Record) er return nil } -func (s *destinationPluginClient) Ack(ctx context.Context) (record.Position, error) { +func (s *destinationPluginClient) Ack(_ context.Context) (record.Position, error) { if s.stream == nil { return nil, plugin.ErrStreamNotOpen } diff --git a/pkg/plugin/standalone/v1/logger.go b/pkg/plugin/standalone/v1/logger.go index 5560edab1..42a2846a2 100644 --- a/pkg/plugin/standalone/v1/logger.go +++ b/pkg/plugin/standalone/v1/logger.go @@ -144,7 +144,7 @@ func (h *hcLogger) StandardLogger(opts *hclog.StandardLoggerOptions) *stdlog.Log return stdlog.New(h.StandardWriter(opts), prefix, 0) } -func (h *hcLogger) StandardWriter(opts *hclog.StandardLoggerOptions) io.Writer { +func (h *hcLogger) StandardWriter(*hclog.StandardLoggerOptions) io.Writer { return h.logger } diff --git a/pkg/plugin/standalone/v1/source.go b/pkg/plugin/standalone/v1/source.go index f02f7e44a..a69612856 100644 --- a/pkg/plugin/standalone/v1/source.go +++ b/pkg/plugin/standalone/v1/source.go @@ -40,7 +40,7 @@ func (p *GRPCSourcePlugin) GRPCClient(_ context.Context, _ *goplugin.GRPCBroker, // GRPCServer always returns an error; we're only implementing the client half // of the interface. -func (p *GRPCSourcePlugin) GRPCServer(broker *goplugin.GRPCBroker, s *grpc.Server) error { +func (p *GRPCSourcePlugin) GRPCServer(*goplugin.GRPCBroker, *grpc.Server) error { return cerrors.New("this package only implements gRPC clients") } @@ -75,7 +75,7 @@ func (s *sourcePluginClient) Start(ctx context.Context, p record.Position) error return nil } -func (s *sourcePluginClient) Read(ctx context.Context) (record.Record, error) { +func (s *sourcePluginClient) Read(context.Context) (record.Record, error) { if s.stream == nil { return record.Record{}, plugin.ErrStreamNotOpen } @@ -94,7 +94,7 @@ func (s *sourcePluginClient) Read(ctx context.Context) (record.Record, error) { return goResp, nil } -func (s *sourcePluginClient) Ack(ctx context.Context, p record.Position) error { +func (s *sourcePluginClient) Ack(_ context.Context, p record.Position) error { if s.stream == nil { return plugin.ErrStreamNotOpen } diff --git a/pkg/plugin/standalone/v1/specifier.go b/pkg/plugin/standalone/v1/specifier.go index 148d59672..e1be59f19 100644 --- a/pkg/plugin/standalone/v1/specifier.go +++ b/pkg/plugin/standalone/v1/specifier.go @@ -38,7 +38,7 @@ func (p *GRPCSpecifierPlugin) GRPCClient(_ context.Context, _ *goplugin.GRPCBrok // GRPCServer always returns an error; we're only implementing the client half // of the interface. -func (p *GRPCSpecifierPlugin) GRPCServer(broker *goplugin.GRPCBroker, s *grpc.Server) error { +func (p *GRPCSpecifierPlugin) GRPCServer(*goplugin.GRPCBroker, *grpc.Server) error { return cerrors.New("this package only implements gRPC clients") } diff --git a/pkg/processor/procbuiltin/parsejson.go b/pkg/processor/procbuiltin/parsejson.go index 997739655..0ffcc1288 100644 --- a/pkg/processor/procbuiltin/parsejson.go +++ b/pkg/processor/procbuiltin/parsejson.go @@ -34,12 +34,12 @@ func init() { } // ParseJSONKey parses the record key from raw to structured data -func ParseJSONKey(config processor.Config) (processor.Interface, error) { +func ParseJSONKey(_ processor.Config) (processor.Interface, error) { return parseJSON(parseJSONKeyProcType, recordKeyGetSetter{}) } // ParseJSONPayload parses the record payload from raw to structured data -func ParseJSONPayload(config processor.Config) (processor.Interface, error) { +func ParseJSONPayload(_ processor.Config) (processor.Interface, error) { return parseJSON(parseJSONPayloadProcType, recordPayloadGetSetter{}) } diff --git a/pkg/processor/procbuiltin/unwrap.go b/pkg/processor/procbuiltin/unwrap.go index 275e34b9b..4449c5994 100644 --- a/pkg/processor/procbuiltin/unwrap.go +++ b/pkg/processor/procbuiltin/unwrap.go @@ -67,7 +67,7 @@ func Unwrap(config processor.Config) (processor.Interface, error) { return NewFuncWrapper(proc.Process), nil } -func (p *unwrapProcessor) Process(ctx context.Context, in record.Record) (record.Record, error) { +func (p *unwrapProcessor) Process(_ context.Context, in record.Record) (record.Record, error) { data := in.Payload.After var structData record.StructuredData switch d := data.(type) { diff --git a/pkg/provisioning/config/yaml/hooks.go b/pkg/provisioning/config/yaml/hooks.go index 50561ca72..df3586991 100644 --- a/pkg/provisioning/config/yaml/hooks.go +++ b/pkg/provisioning/config/yaml/hooks.go @@ -20,7 +20,7 @@ import ( "github.com/conduitio/yaml/v3" ) -func envDecoderHook(path []string, node *yaml.Node) { +func envDecoderHook(_ []string, node *yaml.Node) { if node.Kind == yaml.ScalarNode && node.Tag == "!!str" { node.SetString(os.ExpandEnv(node.Value)) } diff --git a/pkg/record/schema/proto/mutable.go b/pkg/record/schema/proto/mutable.go index d7a4591d4..633db81b5 100644 --- a/pkg/record/schema/proto/mutable.go +++ b/pkg/record/schema/proto/mutable.go @@ -323,7 +323,7 @@ func (d *MutableStructDescriptor) SetName(s2 string) { *d.descriptor.Name = s2 // TODO update references to this struct descriptor } -func (d *MutableStructDescriptor) SetParameters(params map[string]interface{}) { +func (d *MutableStructDescriptor) SetParameters(_ map[string]interface{}) { d.schema.changed = true // TODO parse parameters } @@ -468,7 +468,7 @@ func (d *MutableMapDescriptor) Parameters() map[string]interface{} { // TODO add parameters } } -func (d *MutableMapDescriptor) SetParameters(params map[string]interface{}) { +func (d *MutableMapDescriptor) SetParameters(_ map[string]interface{}) { d.schema.changed = true // TODO parse parameters } @@ -549,7 +549,7 @@ func (d *MutableArrayDescriptor) Parameters() map[string]interface{} { // TODO add parameters } } -func (d *MutableArrayDescriptor) SetParameters(params map[string]interface{}) { +func (d *MutableArrayDescriptor) SetParameters(_ map[string]interface{}) { d.schema.changed = true // TODO parse parameters } @@ -597,7 +597,7 @@ func (d *MutableEnumDescriptor) Parameters() map[string]interface{} { // TODO add parameters } } -func (d *MutableEnumDescriptor) SetParameters(params map[string]interface{}) { +func (d *MutableEnumDescriptor) SetParameters(_ map[string]interface{}) { d.schema.changed = true // TODO parse parameters } @@ -668,7 +668,7 @@ func (d *MutableEnumValueDescriptor) Parameters() map[string]interface{} { // TODO add parameters } } -func (d *MutableEnumValueDescriptor) SetParameters(params map[string]interface{}) { +func (d *MutableEnumValueDescriptor) SetParameters(_ map[string]interface{}) { d.schema.changed = true // TODO parse parameters } @@ -719,7 +719,7 @@ func (d *MutablePrimitiveDescriptor) Parameters() map[string]interface{} { // TODO add parameters } } -func (d *MutablePrimitiveDescriptor) SetParameters(params map[string]interface{}) { +func (d *MutablePrimitiveDescriptor) SetParameters(_ map[string]interface{}) { d.schema.changed = true // TODO parse parameters } diff --git a/pkg/record/schema/proto/schema.go b/pkg/record/schema/proto/schema.go index adea7e3aa..426c1ce54 100644 --- a/pkg/record/schema/proto/schema.go +++ b/pkg/record/schema/proto/schema.go @@ -221,7 +221,7 @@ type EnumDescriptor struct { descriptor protoreflect.EnumDescriptor } -func (d EnumDescriptor) DescriptorType(descriptor schema.EnumDescriptor) {} +func (d EnumDescriptor) DescriptorType(schema.EnumDescriptor) {} func (d EnumDescriptor) Name() string { return string(d.descriptor.Name()) } @@ -242,7 +242,7 @@ type EnumValueDescriptor struct { descriptor protoreflect.EnumValueDescriptor } -func (d EnumValueDescriptor) DescriptorType(descriptor schema.EnumValueDescriptor) {} +func (d EnumValueDescriptor) DescriptorType(schema.EnumValueDescriptor) {} func (d EnumValueDescriptor) Parameters() map[string]interface{} { return map[string]interface{}{ // TODO add parameters diff --git a/pkg/web/api/health_server.go b/pkg/web/api/health_server.go index 8fa31e6dd..7cad77022 100644 --- a/pkg/web/api/health_server.go +++ b/pkg/web/api/health_server.go @@ -64,7 +64,7 @@ func (h *HealthServer) Check(ctx context.Context, req *grpc_health_v1.HealthChec return nil, grpcstatus.Errorf(codes.NotFound, "service '%v' not found", req.Service) } -func (h *HealthServer) Watch(req *grpc_health_v1.HealthCheckRequest, server grpc_health_v1.Health_WatchServer) error { +func (h *HealthServer) Watch(_ *grpc_health_v1.HealthCheckRequest, server grpc_health_v1.Health_WatchServer) error { // should be altered to subsequently send a new message whenever the service's serving status changes. return server.Send(&grpc_health_v1.HealthCheckResponse{ Status: grpc_health_v1.HealthCheckResponse_SERVING, diff --git a/pkg/web/api/health_server_test.go b/pkg/web/api/health_server_test.go index 3490400a1..0f66b3590 100644 --- a/pkg/web/api/health_server_test.go +++ b/pkg/web/api/health_server_test.go @@ -28,7 +28,7 @@ type testChecker struct { err error } -func (t *testChecker) Check(ctx context.Context) error { +func (t *testChecker) Check(context.Context) error { return t.err } diff --git a/pkg/web/api/info.go b/pkg/web/api/info.go index ee498cd98..56b94b48d 100644 --- a/pkg/web/api/info.go +++ b/pkg/web/api/info.go @@ -27,7 +27,7 @@ type Information struct { version string } -func (i *Information) GetInfo(ctx context.Context, req *apiv1.GetInfoRequest) (*apiv1.GetInfoResponse, error) { +func (i *Information) GetInfo(context.Context, *apiv1.GetInfoRequest) (*apiv1.GetInfoResponse, error) { info := &apiv1.Info{ Version: i.version, Os: runtime.GOOS, diff --git a/pkg/web/api/pipeline_v1.go b/pkg/web/api/pipeline_v1.go index b45108698..6e46477fe 100644 --- a/pkg/web/api/pipeline_v1.go +++ b/pkg/web/api/pipeline_v1.go @@ -226,16 +226,10 @@ func (p *PipelineAPIv1) UpdateDLQ( return &apiv1.UpdateDLQResponse{Dlq: dlq}, nil } -func (p *PipelineAPIv1) ImportPipeline( - ctx context.Context, - req *apiv1.ImportPipelineRequest, -) (*apiv1.ImportPipelineResponse, error) { +func (p *PipelineAPIv1) ImportPipeline(context.Context, *apiv1.ImportPipelineRequest) (*apiv1.ImportPipelineResponse, error) { return &apiv1.ImportPipelineResponse{}, cerrors.ErrNotImpl } -func (p *PipelineAPIv1) ExportPipeline( - ctx context.Context, - req *apiv1.ExportPipelineRequest, -) (*apiv1.ExportPipelineResponse, error) { +func (p *PipelineAPIv1) ExportPipeline(context.Context, *apiv1.ExportPipelineRequest) (*apiv1.ExportPipelineResponse, error) { return &apiv1.ExportPipelineResponse{}, cerrors.ErrNotImpl }