Skip to content

Commit

Permalink
golangci-lint 1.62
Browse files Browse the repository at this point in the history
Enable new linters: iface & recvcheck
  • Loading branch information
serprex committed Dec 24, 2024
1 parent f388a3f commit f5d4f62
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golang-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions flow/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ linters:
- gofumpt
- gosec
- gosimple
- iface
- ineffassign
- intrange
- lll
Expand All @@ -25,6 +26,7 @@ linters:
- nonamedreturns
- perfsprint
- prealloc
- recvcheck
- rowserrcheck
- staticcheck
- stylecheck
Expand Down
3 changes: 1 addition & 2 deletions flow/connectors/postgres/qrep_query_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion flow/e2e/bigquery/peer_flow_bq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 3 additions & 7 deletions flow/shared/telemetry/incidentio_message_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ type IncidentIoResponse struct {
}

type IncidentIoMessageSender struct {
Sender
}

type IncidentIoMessageSenderImpl struct {
http *http.Client
config IncidentIoMessageSenderConfig
}
Expand All @@ -43,7 +39,7 @@ type IncidentIoMessageSenderConfig struct {
Token string
}

func (i *IncidentIoMessageSenderImpl) SendMessage(
func (i *IncidentIoMessageSender) SendMessage(
ctx context.Context,
subject string,
body string,
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions flow/shared/telemetry/incidentio_message_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
}
Expand Down
File renamed without changes.
12 changes: 4 additions & 8 deletions flow/shared/telemetry/sns_message_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
Expand Down Expand Up @@ -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, &region)
if err != nil {
return nil, err
}
return &SNSMessageSenderImpl{
return &SNSMessageSender{
client: client,
topic: config.Topic,
}, nil
Expand Down

0 comments on commit f5d4f62

Please sign in to comment.