Skip to content

Commit

Permalink
Upgrade linter, add timeout (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
hariso committed Apr 11, 2023
1 parent 40bec2e commit 6b7bce2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51.2
version: v1.52.2
args: --timeout=2m
10 changes: 5 additions & 5 deletions destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (a *destinationPluginAdapter) configureWriteStrategy(ctx context.Context, c
return nil
}

func (a *destinationPluginAdapter) Start(ctx context.Context, req cpluginv1.DestinationStartRequest) (cpluginv1.DestinationStartResponse, error) {
func (a *destinationPluginAdapter) Start(ctx context.Context, _ cpluginv1.DestinationStartRequest) (cpluginv1.DestinationStartResponse, error) {
a.lastPosition = new(internal.AtomicValueWatcher[Position])

// detach context, so we can control when it's canceled
Expand Down Expand Up @@ -259,7 +259,7 @@ func (a *destinationPluginAdapter) Stop(ctx context.Context, req cpluginv1.Desti
return cpluginv1.DestinationStopResponse{}, err
}

func (a *destinationPluginAdapter) Teardown(ctx context.Context, req cpluginv1.DestinationTeardownRequest) (cpluginv1.DestinationTeardownResponse, error) {
func (a *destinationPluginAdapter) Teardown(ctx context.Context, _ cpluginv1.DestinationTeardownRequest) (cpluginv1.DestinationTeardownResponse, error) {
err := a.impl.Teardown(ctx)
if err != nil {
return cpluginv1.DestinationTeardownResponse{}, err
Expand Down Expand Up @@ -340,7 +340,7 @@ func (w *writeStrategySingle) Write(ctx context.Context, r Record, ack func(erro
return ack(err)
}

func (w *writeStrategySingle) Flush(ctx context.Context) error {
func (w *writeStrategySingle) Flush(context.Context) error {
return nil // nothing to flush
}

Expand All @@ -356,10 +356,10 @@ type writeStrategyBatch struct {
batchDelay time.Duration
}

func (w *writeStrategyBatch) Write(ctx context.Context, r Record, ack func(error) error) error {
func (w *writeStrategyBatch) Write(context.Context, Record, func(error) error) error {
panic("batching not implemented yet")
}
func (w *writeStrategyBatch) Flush(ctx context.Context) error {
func (w *writeStrategyBatch) Flush(context.Context) error {
panic("batching not implemented yet")
}

Expand Down
2 changes: 1 addition & 1 deletion internal/atomicvaluewatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (h *AtomicValueWatcher[T]) subscribe() (T, error) {
func (h *AtomicValueWatcher[T]) unsubscribe() {
// drain channel and remove it
go func(in chan T) {
for range in {
for range in { //nolint:revive // empty block for reason below
// do nothing, just drain channel in case new values come in
// while we try to unsubscribe
}
Expand Down
4 changes: 2 additions & 2 deletions source.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func (a *sourcePluginAdapter) runAck(ctx context.Context, stream cpluginv1.Sourc
}
}

func (a *sourcePluginAdapter) Stop(ctx context.Context, req cpluginv1.SourceStopRequest) (cpluginv1.SourceStopResponse, error) {
func (a *sourcePluginAdapter) Stop(context.Context, cpluginv1.SourceStopRequest) (cpluginv1.SourceStopResponse, error) {
// stop reading new messages
a.openCancel()
a.readCancel()
Expand All @@ -253,7 +253,7 @@ func (a *sourcePluginAdapter) Stop(ctx context.Context, req cpluginv1.SourceStop
}, nil
}

func (a *sourcePluginAdapter) Teardown(ctx context.Context, req cpluginv1.SourceTeardownRequest) (cpluginv1.SourceTeardownResponse, error) {
func (a *sourcePluginAdapter) Teardown(ctx context.Context, _ cpluginv1.SourceTeardownRequest) (cpluginv1.SourceTeardownResponse, error) {
var waitErr error
if a.t != nil {
// wait for at most 1 minute
Expand Down
2 changes: 1 addition & 1 deletion specifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type specifierPluginAdapter struct {
destinationParams map[string]Parameter
}

func (s *specifierPluginAdapter) Specify(ctx context.Context, req cpluginv1.SpecifierSpecifyRequest) (cpluginv1.SpecifierSpecifyResponse, error) {
func (s *specifierPluginAdapter) Specify(context.Context, cpluginv1.SpecifierSpecifyRequest) (cpluginv1.SpecifierSpecifyResponse, error) {
return cpluginv1.SpecifierSpecifyResponse{
Name: s.specs.Name,
Summary: s.specs.Summary,
Expand Down

0 comments on commit 6b7bce2

Please sign in to comment.