diff --git a/.github/workflows/golang-lint.yml b/.github/workflows/golang-lint.yml index 2a176a077e..9b4e558a75 100644 --- a/.github/workflows/golang-lint.yml +++ b/.github/workflows/golang-lint.yml @@ -29,6 +29,6 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6 with: - version: v1.61 + version: v1.62 working-directory: ./flow args: --timeout=10m diff --git a/flow/.golangci.yml b/flow/.golangci.yml index 745c15ee50..b4b00b30ff 100644 --- a/flow/.golangci.yml +++ b/flow/.golangci.yml @@ -15,6 +15,7 @@ linters: - gofumpt - gosec - gosimple + - iface - ineffassign - intrange - lll @@ -25,6 +26,7 @@ linters: - nonamedreturns - perfsprint - prealloc + - recvcheck - rowserrcheck - staticcheck - stylecheck diff --git a/flow/connectors/postgres/qrep_query_executor_test.go b/flow/connectors/postgres/qrep_query_executor_test.go index eaa015c1cf..78f82b07ea 100644 --- a/flow/connectors/postgres/qrep_query_executor_test.go +++ b/flow/connectors/postgres/qrep_query_executor_test.go @@ -186,8 +186,7 @@ func TestAllDataTypes(t *testing.T) { expectedBytea := []byte("bytea") require.Equal(t, expectedBytea, record[6].Value(), "expected 'bytea'") - expectedJSON := `{"key":"value"}` - require.Equal(t, expectedJSON, record[7].Value(), "expected '{\"key\":\"value\"}'") + require.JSONEq(t, `{"key":"value"}`, record[7].Value().(string), "expected '{\"key\":\"value\"}'") actualUUID := record[8].Value().(uuid.UUID) require.Equal(t, savedUUID[:], actualUUID[:], "expected savedUUID: %v", savedUUID) diff --git a/flow/e2e/bigquery/peer_flow_bq_test.go b/flow/e2e/bigquery/peer_flow_bq_test.go index 674a21ebf5..8fcb263694 100644 --- a/flow/e2e/bigquery/peer_flow_bq_test.go +++ b/flow/e2e/bigquery/peer_flow_bq_test.go @@ -55,7 +55,7 @@ func (s PeerFlowE2ETestSuiteBQ) attachSuffix(input string) string { return fmt.Sprintf("%s_%s", input, s.bqSuffix) } -func (s *PeerFlowE2ETestSuiteBQ) checkPeerdbColumns(dstQualified string, softDelete bool) error { +func (s PeerFlowE2ETestSuiteBQ) checkPeerdbColumns(dstQualified string, softDelete bool) error { qualifiedTableName := fmt.Sprintf("`%s.%s`", s.bqHelper.Config.DatasetId, dstQualified) selector := "`_PEERDB_SYNCED_AT`" if softDelete { diff --git a/flow/shared/telemetry/incidentio_message_sender.go b/flow/shared/telemetry/incidentio_message_sender.go index 53e05628fa..ead24dd9a6 100644 --- a/flow/shared/telemetry/incidentio_message_sender.go +++ b/flow/shared/telemetry/incidentio_message_sender.go @@ -30,10 +30,6 @@ type IncidentIoResponse struct { } type IncidentIoMessageSender struct { - Sender -} - -type IncidentIoMessageSenderImpl struct { http *http.Client config IncidentIoMessageSenderConfig } @@ -43,7 +39,7 @@ type IncidentIoMessageSenderConfig struct { Token string } -func (i *IncidentIoMessageSenderImpl) SendMessage( +func (i *IncidentIoMessageSender) SendMessage( ctx context.Context, subject string, body string, @@ -117,12 +113,12 @@ func (i *IncidentIoMessageSenderImpl) SendMessage( return incidentResponse.Status, nil } -func NewIncidentIoMessageSender(_ context.Context, config IncidentIoMessageSenderConfig) (Sender, error) { +func NewIncidentIoMessageSender(_ context.Context, config IncidentIoMessageSenderConfig) (*IncidentIoMessageSender, error) { client := &http.Client{ Timeout: time.Second * 5, } - return &IncidentIoMessageSenderImpl{ + return &IncidentIoMessageSender{ config: config, http: client, }, nil diff --git a/flow/shared/telemetry/incidentio_message_sender_test.go b/flow/shared/telemetry/incidentio_message_sender_test.go index ce629abcde..c872935a8c 100644 --- a/flow/shared/telemetry/incidentio_message_sender_test.go +++ b/flow/shared/telemetry/incidentio_message_sender_test.go @@ -16,7 +16,7 @@ import ( "github.com/stretchr/testify/require" ) -func TestIncidentIoMessageSenderImpl_SendMessage(t *testing.T) { +func TestIncidentIoMessageSender_SendMessage(t *testing.T) { tests := []struct { serverResponse IncidentIoResponse name string @@ -168,7 +168,7 @@ func TestIncidentIoMessageSenderImpl_SendMessage(t *testing.T) { URL: fakeIncidentIoServer.URL, Token: "test-token", } - sender := &IncidentIoMessageSenderImpl{ + sender := &IncidentIoMessageSender{ http: &http.Client{Timeout: time.Second * 5}, config: config, } diff --git a/flow/shared/telemetry/interface.go b/flow/shared/telemetry/sender.go similarity index 100% rename from flow/shared/telemetry/interface.go rename to flow/shared/telemetry/sender.go diff --git a/flow/shared/telemetry/sns_message_sender.go b/flow/shared/telemetry/sns_message_sender.go index 193f47c525..2a4798e3ed 100644 --- a/flow/shared/telemetry/sns_message_sender.go +++ b/flow/shared/telemetry/sns_message_sender.go @@ -15,11 +15,7 @@ import ( "github.com/PeerDB-io/peer-flow/shared/aws_common" ) -type SNSMessageSender interface { - Sender -} - -type SNSMessageSenderImpl struct { +type SNSMessageSender struct { client *sns.Client topic string } @@ -28,7 +24,7 @@ type SNSMessageSenderConfig struct { Topic string `json:"topic"` } -func (s *SNSMessageSenderImpl) SendMessage(ctx context.Context, subject string, body string, attributes Attributes) (string, error) { +func (s *SNSMessageSender) SendMessage(ctx context.Context, subject string, body string, attributes Attributes) (string, error) { activityInfo := activity.Info{} if activity.IsActivity(ctx) { activityInfo = activity.GetInfo(ctx) @@ -92,14 +88,14 @@ func (s *SNSMessageSenderImpl) SendMessage(ctx context.Context, subject string, return *publish.MessageId, nil } -func NewSNSMessageSenderWithNewClient(ctx context.Context, config *SNSMessageSenderConfig) (SNSMessageSender, error) { +func NewSNSMessageSenderWithNewClient(ctx context.Context, config *SNSMessageSenderConfig) (*SNSMessageSender, error) { // Topic Region must match client region region := strings.Split(strings.TrimPrefix(config.Topic, "arn:aws:sns:"), ":")[0] client, err := newSnsClient(ctx, ®ion) if err != nil { return nil, err } - return &SNSMessageSenderImpl{ + return &SNSMessageSender{ client: client, topic: config.Topic, }, nil