Skip to content

Commit

Permalink
enable remaining linters
Browse files Browse the repository at this point in the history
  • Loading branch information
lovromazgon committed Sep 11, 2024
1 parent 46b3b41 commit 09af7f9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ linters:
- errorlint
- exhaustive
# - forbidigo
# - forcetypeassert # TODO enable
# - funlen # TODO enable
- forcetypeassert
- funlen
- gci
- ginkgolinter
- gocheckcompilerdirectives
Expand All @@ -74,7 +74,7 @@ linters:
- goconst
- gocritic
- godot
# - err113 # TODO enable
- err113
- gofmt
- gofumpt
- goheader
Expand Down Expand Up @@ -114,12 +114,12 @@ linters:
- stylecheck
- tenv
- testableexamples
# - thelper # TODO enable
- thelper
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace
# - wrapcheck # TODO enable
- wrapcheck
- zerologlint
1 change: 1 addition & 0 deletions acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func TestAcceptance(t *testing.T) {
SourceConfig: cfg,
DestinationConfig: cfg,
BeforeTest: func(t *testing.T) {
t.Helper()
subject := t.Name() + uuid.New().String()
cfg[destination.ConfigSubject] = subject
},
Expand Down
7 changes: 5 additions & 2 deletions destination/destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (d *Destination) Parameters() config.Parameters {
func (d *Destination) Configure(ctx context.Context, cfg config.Config) error {
err := sdk.Util.ParseConfig(ctx, cfg, &d.config, NewDestination().Parameters())
if err != nil {
return err
return err //nolint:wrapcheck // we don't need to wrap the error here
}

connName := d.config.GetConnectionName()
Expand Down Expand Up @@ -101,7 +101,10 @@ func (d *Destination) Write(_ context.Context, records []opencdc.Record) (int, e
// Teardown gracefully closes connections.
func (d *Destination) Teardown(context.Context) error {
if d.writer != nil {
return d.writer.Close()
err := d.writer.Close()
if err != nil {
return fmt.Errorf("failed to close writer: %w", err)
}
}

return nil
Expand Down
8 changes: 7 additions & 1 deletion destination/pubsub/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package pubsub

import (
"fmt"

"github.com/conduitio/conduit-commons/opencdc"
"github.com/nats-io/nats.go"
)
Expand Down Expand Up @@ -42,7 +44,11 @@ func NewWriter(params WriterParams) (*Writer, error) {

// Write writes directly and synchronously a record to a subject.
func (w *Writer) Write(record opencdc.Record) error {
return w.conn.Publish(w.subject, record.Payload.After.Bytes())
err := w.conn.Publish(w.subject, record.Payload.After.Bytes())
if err != nil {
return fmt.Errorf("failed to publish message: %w", err)
}
return nil
}

// Close closes the underlying NATS connection.
Expand Down
2 changes: 1 addition & 1 deletion source/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (s *Source) Parameters() config.Parameters {
func (s *Source) Configure(ctx context.Context, cfg config.Config) error {
err := sdk.Util.ParseConfig(ctx, cfg, &s.config, NewSource().Parameters())
if err != nil {
return err
return err //nolint:wrapcheck // we don't need to wrap the error here
}

connName := s.config.GetConnectionName()
Expand Down

0 comments on commit 09af7f9

Please sign in to comment.