From 8a3b7235cf59bd0987bfe562a8eb987411a2d5e8 Mon Sep 17 00:00:00 2001 From: ICHINOSE Shogo Date: Sun, 7 Dec 2025 00:34:15 +0900 Subject: [PATCH 1/3] bump GitHub Actions --- .github/workflows/build-lambda-zip.yml | 2 +- .github/workflows/codeql-analysis.yml | 8 ++++---- .github/workflows/lint.yml | 6 +++--- .github/workflows/tests.yml | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-lambda-zip.yml b/.github/workflows/build-lambda-zip.yml index 59a64936..b3b76c4f 100644 --- a/.github/workflows/build-lambda-zip.yml +++ b/.github/workflows/build-lambda-zip.yml @@ -16,7 +16,7 @@ jobs: platform: [ubuntu-latest, macos-latest, windows-latest] steps: - name: Setup Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v6 with: go-version: ${{ matrix.go-version }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 505465d4..781015c8 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -38,11 +38,11 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v6 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -53,7 +53,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v4 # â„šī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -67,4 +67,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v4 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a39b921b..fa23f4f0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,11 +16,11 @@ jobs: name: run golangci-golint on the project runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + - uses: actions/checkout@v6 + - uses: actions/setup-go@v6 with: go-version: 'stable' - name: golangci-golint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v9 with: version: v1.64.5 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5295cf0d..8c7e54f0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Set up Go ${{ matrix.go }} - uses: actions/setup-go@v3 + uses: actions/setup-go@v6 with: go-version: ${{ matrix.go }} @@ -38,7 +38,7 @@ jobs: - run: chmod +x /usr/local/bin/aws-lambda-rie - name: Check out code into the Go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v6 - name: Edit the go.mod file to allow tests to run for versions of go before 1.16 run: > @@ -60,7 +60,7 @@ jobs: - "1.25" steps: - name: Set up Go ${{ matrix.go }} - uses: actions/setup-go@v3 + uses: actions/setup-go@v6 with: go-version: ${{ matrix.go }} @@ -69,15 +69,15 @@ jobs: - run: chmod +x /usr/local/bin/aws-lambda-rie - name: Check out code into the Go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v6 - name: go test run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: - file: ./coverage.txt + files: ./coverage.txt env_vars: GO env: GO: ${{ matrix.go }} From 961b3fed3953042ed08bb2ca3ef7e73745f6ec65 Mon Sep 17 00:00:00 2001 From: ICHINOSE Shogo Date: Sun, 7 Dec 2025 00:34:55 +0900 Subject: [PATCH 2/3] bump golangci-lint v2.7.1 --- .github/workflows/lint.yml | 2 +- .golangci.yml | 146 ++++++++++++++++++++----------------- 2 files changed, 79 insertions(+), 69 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fa23f4f0..09109d25 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,4 +23,4 @@ jobs: - name: golangci-golint uses: golangci/golangci-lint-action@v9 with: - version: v1.64.5 + version: v2.7.1 diff --git a/.golangci.yml b/.golangci.yml index e7736085..73859ff0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,75 +1,85 @@ +version: "2" linters: - disable-all: true + default: none enable: - - gofmt - errcheck - - gosimple - govet - ineffassign - staticcheck - - typecheck - unused - - stylecheck - -issues: - exclude-dirs: - # These were code-generated, and cannot be changed without breaking RPC compatibility. - - lambda/messages - -linters-settings: - staticcheck: - checks: - - all - - '-SA1029' - stylecheck: - checks: - - "all" - initialisms: - - "ACL" - - "AMQP" - - "API" - - "ARN" - - "ASCII" - - "AWS" - - "CPU" - - "CSS" - - "DB" - - "DNS" - - "EOF" - - "GID" - - "GUID" - - "HTML" - - "HTTP" - - "HTTPS" - - "IAM" - - "ID" - - "IP" - - "JSON" - - "MQTT" - - "OTF" - - "QPS" - - "RAM" - - "RPC" - - "RTP" - - "SIP" - - "SLA" - - "SMTP" - - "SQL" - - "SSH" - - "TCP" - - "TLS" - - "TS" - - "TTL" - - "UDP" - - "UI" - - "UID" - - "URI" - - "URL" - - "UTF8" - - "UUID" - - "VM" - - "VPC" - - "XML" - - "XMPP" - - "XSRF" - - "XSS" + settings: + staticcheck: + checks: + - all + - -SA1029 + initialisms: + - ACL + - AMQP + - API + - ARN + - ASCII + - AWS + - CPU + - CSS + - DB + - DNS + - EOF + - GID + - GUID + - HTML + - HTTP + - HTTPS + - IAM + - ID + - IP + - JSON + - MQTT + - OTF + - QPS + - RAM + - RPC + - RTP + - SIP + - SLA + - SMTP + - SQL + - SSH + - TCP + - TLS + - TS + - TTL + - UDP + - UI + - UID + - URI + - URL + - UTF8 + - UUID + - VM + - VPC + - XML + - XMPP + - XSRF + - XSS + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - lambda/messages + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + exclusions: + generated: lax + paths: + - lambda/messages + - third_party$ + - builtin$ + - examples$ From e4d48bd41388c77f6bafc27271275d4b60675f90 Mon Sep 17 00:00:00 2001 From: ICHINOSE Shogo Date: Sun, 7 Dec 2025 00:42:39 +0900 Subject: [PATCH 3/3] fix golangci-lint warnings --- events/alb.go | 2 +- events/apigw.go | 10 +++++----- events/attributevalue.go | 2 +- events/code_commit.go | 2 +- events/config.go | 6 +++--- events/dynamodb.go | 2 +- events/firehose.go | 4 ++-- events/kinesis.go | 6 +++--- events/s3.go | 2 +- events/sns.go | 4 ++-- events/sqs.go | 2 +- events/test/assert.go | 4 ++-- events/test/jsonblobs.go | 2 +- events/test/jsonsyntax.go | 2 +- lambda/handler_test.go | 2 +- lambda/messages/messages.go | 14 +++++++------- lambdacontext/context.go | 4 ++-- 17 files changed, 35 insertions(+), 35 deletions(-) diff --git a/events/alb.go b/events/alb.go index ec5ee282..393c9956 100644 --- a/events/alb.go +++ b/events/alb.go @@ -20,7 +20,7 @@ type ALBTargetGroupRequestContext struct { // ELBContext contains the information to identify the ARN invoking the lambda type ELBContext struct { - TargetGroupArn string `json:"targetGroupArn"` //nolint: stylecheck + TargetGroupArn string `json:"targetGroupArn"` //nolint: staticcheck } // ALBTargetGroupResponse configures the response to be returned by the ALB Lambda target group for the request diff --git a/events/apigw.go b/events/apigw.go index 7aa48932..b77c58e2 100644 --- a/events/apigw.go +++ b/events/apigw.go @@ -208,7 +208,7 @@ type APIGatewayRequestIdentity struct { SourceIP string `json:"sourceIp"` CognitoAuthenticationType string `json:"cognitoAuthenticationType,omitempty"` CognitoAuthenticationProvider string `json:"cognitoAuthenticationProvider,omitempty"` - UserArn string `json:"userArn,omitempty"` //nolint: stylecheck + UserArn string `json:"userArn,omitempty"` //nolint: staticcheck UserAgent string `json:"userAgent"` User string `json:"user,omitempty"` ClientCert *APIGatewayCustomAuthorizerRequestTypeRequestIdentityClientCert `json:"clientCert,omitempty"` @@ -317,7 +317,7 @@ type APIGatewayV2CustomAuthorizerV1RequestTypeRequestContext struct { type APIGatewayV2CustomAuthorizerV1Request struct { Version string `json:"version"` Type string `json:"type"` - MethodArn string `json:"methodArn"` //nolint: stylecheck + MethodArn string `json:"methodArn"` //nolint: staticcheck IdentitySource string `json:"identitySource"` AuthorizationToken string `json:"authorizationToken"` Resource string `json:"resource"` @@ -333,7 +333,7 @@ type APIGatewayV2CustomAuthorizerV1Request struct { type APIGatewayV2CustomAuthorizerV2Request struct { Version string `json:"version"` Type string `json:"type"` - RouteArn string `json:"routeArn"` //nolint: stylecheck + RouteArn string `json:"routeArn"` //nolint: staticcheck IdentitySource []string `json:"identitySource"` RouteKey string `json:"routeKey"` RawPath string `json:"rawPath"` @@ -372,13 +372,13 @@ type APIGatewayCustomAuthorizerRequestTypeRequestContext struct { type APIGatewayCustomAuthorizerRequest struct { Type string `json:"type"` AuthorizationToken string `json:"authorizationToken"` - MethodArn string `json:"methodArn"` //nolint: stylecheck + MethodArn string `json:"methodArn"` //nolint: staticcheck } // APIGatewayCustomAuthorizerRequestTypeRequest contains data coming in to a custom API Gateway authorizer function. type APIGatewayCustomAuthorizerRequestTypeRequest struct { Type string `json:"type"` - MethodArn string `json:"methodArn"` //nolint: stylecheck + MethodArn string `json:"methodArn"` //nolint: staticcheck Resource string `json:"resource"` Path string `json:"path"` HTTPMethod string `json:"httpMethod"` diff --git a/events/attributevalue.go b/events/attributevalue.go index f582d30f..609bce77 100644 --- a/events/attributevalue.go +++ b/events/attributevalue.go @@ -20,7 +20,7 @@ type DynamoDBAttributeValue struct { // This struct represents DynamoDBAttributeValue which doesn't // implement fmt.Stringer interface and safely `fmt.Sprintf`able -type dynamoDbAttributeValue DynamoDBAttributeValue //nolint: stylecheck +type dynamoDbAttributeValue DynamoDBAttributeValue //nolint: staticcheck // Binary provides access to an attribute of type Binary. // Method panics if the attribute is not of type Binary. diff --git a/events/code_commit.go b/events/code_commit.go index 9d5e071c..a286200f 100644 --- a/events/code_commit.go +++ b/events/code_commit.go @@ -52,7 +52,7 @@ type CodeCommitRecord struct { EventPartNumber uint64 `json:"eventPartNumber"` CodeCommit CodeCommitCodeCommit `json:"codecommit"` EventName string `json:"eventName"` - EventTriggerConfigId string `json:"eventTriggerConfigId"` //nolint: stylecheck + EventTriggerConfigId string `json:"eventTriggerConfigId"` //nolint: staticcheck EventSourceARN string `json:"eventSourceARN"` UserIdentityARN string `json:"userIdentityARN"` EventSource string `json:"eventSource"` diff --git a/events/config.go b/events/config.go index 816b684f..cd9157af 100644 --- a/events/config.go +++ b/events/config.go @@ -7,13 +7,13 @@ type ConfigEvent struct { // The ID of the AWS account that owns the rule AccountID string `json:"accountId"` // The ARN that AWS Config assigned to the rule - ConfigRuleArn string `json:"configRuleArn"` //nolint:stylecheck - ConfigRuleID string `json:"configRuleId"` //nolint:stylecheck + ConfigRuleArn string `json:"configRuleArn"` //nolint:staticcheck + ConfigRuleID string `json:"configRuleId"` //nolint:staticcheck // The name that you assigned to the rule that caused AWS Config to publish the event ConfigRuleName string `json:"configRuleName"` // A boolean value that indicates whether the AWS resource to be evaluated has been removed from the rule's scope EventLeftScope bool `json:"eventLeftScope"` - ExecutionRoleArn string `json:"executionRoleArn"` //nolint:stylecheck + ExecutionRoleArn string `json:"executionRoleArn"` //nolint:staticcheck // If the event is published in response to a resource configuration change, this value contains a JSON configuration item InvokingEvent string `json:"invokingEvent"` // A token that the function must pass to AWS Config with the PutEvaluations call diff --git a/events/dynamodb.go b/events/dynamodb.go index d5eeeeef..66754c40 100644 --- a/events/dynamodb.go +++ b/events/dynamodb.go @@ -56,7 +56,7 @@ type DynamoDBEventRecord struct { EventVersion string `json:"eventVersion"` // The event source ARN of DynamoDB - EventSourceArn string `json:"eventSourceARN"` //nolint: stylecheck + EventSourceArn string `json:"eventSourceARN"` //nolint: staticcheck // Items that are deleted by the Time to Live process after expiration have // the following fields: diff --git a/events/firehose.go b/events/firehose.go index 350c5b31..024ec037 100644 --- a/events/firehose.go +++ b/events/firehose.go @@ -5,8 +5,8 @@ package events // KinesisFirehoseEvent represents the input event from Amazon Kinesis Firehose. It is used as the input parameter. type KinesisFirehoseEvent struct { InvocationID string `json:"invocationId"` - DeliveryStreamArn string `json:"deliveryStreamArn"` //nolint: stylecheck - SourceKinesisStreamArn string `json:"sourceKinesisStreamArn"` //nolint: stylecheck + DeliveryStreamArn string `json:"deliveryStreamArn"` //nolint: staticcheck + SourceKinesisStreamArn string `json:"sourceKinesisStreamArn"` //nolint: staticcheck Region string `json:"region"` Records []KinesisFirehoseEventRecord `json:"records"` } diff --git a/events/kinesis.go b/events/kinesis.go index 41bae7a9..44c4d6d1 100644 --- a/events/kinesis.go +++ b/events/kinesis.go @@ -20,13 +20,13 @@ type KinesisTimeWindowEventResponse struct { } type KinesisEventRecord struct { - AwsRegion string `json:"awsRegion"` //nolint: stylecheck + AwsRegion string `json:"awsRegion"` //nolint: staticcheck EventID string `json:"eventID"` EventName string `json:"eventName"` EventSource string `json:"eventSource"` - EventSourceArn string `json:"eventSourceARN"` //nolint: stylecheck + EventSourceArn string `json:"eventSourceARN"` //nolint: staticcheck EventVersion string `json:"eventVersion"` - InvokeIdentityArn string `json:"invokeIdentityArn"` //nolint: stylecheck + InvokeIdentityArn string `json:"invokeIdentityArn"` //nolint: staticcheck Kinesis KinesisRecord `json:"kinesis"` } diff --git a/events/s3.go b/events/s3.go index 74c9daab..15677997 100644 --- a/events/s3.go +++ b/events/s3.go @@ -44,7 +44,7 @@ type S3Entity struct { type S3Bucket struct { Name string `json:"name"` OwnerIdentity S3UserIdentity `json:"ownerIdentity"` - Arn string `json:"arn"` //nolint: stylecheck + Arn string `json:"arn"` //nolint: staticcheck } type S3Object struct { diff --git a/events/sns.go b/events/sns.go index 6c75df79..c486681c 100644 --- a/events/sns.go +++ b/events/sns.go @@ -12,7 +12,7 @@ type SNSEvent struct { type SNSEventRecord struct { EventVersion string `json:"EventVersion"` - EventSubscriptionArn string `json:"EventSubscriptionArn"` //nolint: stylecheck + EventSubscriptionArn string `json:"EventSubscriptionArn"` //nolint: staticcheck EventSource string `json:"EventSource"` SNS SNSEntity `json:"Sns"` } @@ -21,7 +21,7 @@ type SNSEntity struct { Signature string `json:"Signature"` MessageID string `json:"MessageId"` Type string `json:"Type"` - TopicArn string `json:"TopicArn"` //nolint: stylecheck + TopicArn string `json:"TopicArn"` //nolint: staticcheck MessageAttributes map[string]interface{} `json:"MessageAttributes"` SignatureVersion string `json:"SignatureVersion"` Timestamp time.Time `json:"Timestamp"` diff --git a/events/sqs.go b/events/sqs.go index 1071dfe3..b173f885 100644 --- a/events/sqs.go +++ b/events/sqs.go @@ -7,7 +7,7 @@ type SQSEvent struct { } type SQSMessage struct { - MessageId string `json:"messageId"` //nolint: stylecheck + MessageId string `json:"messageId"` //nolint: staticcheck ReceiptHandle string `json:"receiptHandle"` Body string `json:"body"` Md5OfBody string `json:"md5OfBody"` diff --git a/events/test/assert.go b/events/test/assert.go index 14040740..25c9c28f 100644 --- a/events/test/assert.go +++ b/events/test/assert.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" ) -// nolint: stylecheck +// nolint: staticcheck func AssertJsonFile(t *testing.T, file string, o interface{}) { inputJSON, err := ioutil.ReadFile(file) if err != nil { @@ -17,7 +17,7 @@ func AssertJsonFile(t *testing.T, file string, o interface{}) { AssertJsonBytes(t, inputJSON, o) } -// nolint: stylecheck +// nolint: staticcheck func AssertJsonBytes(t *testing.T, inputJSON []byte, o interface{}) { // de-serialize if err := json.Unmarshal(inputJSON, o); err != nil { diff --git a/events/test/jsonblobs.go b/events/test/jsonblobs.go index 4b17f924..52ad3346 100644 --- a/events/test/jsonblobs.go +++ b/events/test/jsonblobs.go @@ -1,6 +1,6 @@ package test -// nolint: stylecheck +// nolint: staticcheck func GetMalformedJson() []byte { return []byte(`{ "Records`) } diff --git a/events/test/jsonsyntax.go b/events/test/jsonsyntax.go index 9c4b0067..a0d2b823 100644 --- a/events/test/jsonsyntax.go +++ b/events/test/jsonsyntax.go @@ -7,7 +7,7 @@ import ( "testing" ) -// nolint: stylecheck +// nolint: staticcheck func TestMalformedJson(t *testing.T, objectToDeserialize interface{}) { // 1. read JSON from file inputJson := GetMalformedJson() diff --git a/lambda/handler_test.go b/lambda/handler_test.go index 6eba8798..bca7a30e 100644 --- a/lambda/handler_test.go +++ b/lambda/handler_test.go @@ -76,7 +76,7 @@ func TestInvalidHandlers(t *testing.T) { { name: "handler returning two values does not declare error as the second return value", expected: errors.New("handler returns two values, but the second does not implement error"), - //nolint: stylecheck + //nolint: staticcheck handler: func() (error, string) { return nil, "hello" }, diff --git a/lambda/messages/messages.go b/lambda/messages/messages.go index ea63001e..c9689f4d 100644 --- a/lambda/messages/messages.go +++ b/lambda/messages/messages.go @@ -10,21 +10,21 @@ type PingRequest struct { type PingResponse struct { } -//nolint:stylecheck +//nolint:staticcheck type InvokeRequest_Timestamp struct { Seconds int64 Nanos int64 } -//nolint:stylecheck +//nolint:staticcheck type InvokeRequest struct { Payload []byte - RequestId string //nolint:stylecheck + RequestId string //nolint:staticcheck XAmznTraceId string Deadline InvokeRequest_Timestamp InvokedFunctionArn string - CognitoIdentityId string //nolint:stylecheck - CognitoIdentityPoolId string //nolint:stylecheck + CognitoIdentityId string //nolint:staticcheck + CognitoIdentityPoolId string //nolint:staticcheck ClientContext []byte } @@ -33,7 +33,7 @@ type InvokeResponse struct { Error *InvokeResponse_Error } -//nolint:stylecheck +//nolint:staticcheck type InvokeResponse_Error struct { Message string `json:"errorMessage"` Type string `json:"errorType"` @@ -45,7 +45,7 @@ func (e InvokeResponse_Error) Error() string { return fmt.Sprintf("%#v", e) } -//nolint:stylecheck +//nolint:staticcheck type InvokeResponse_Error_StackFrame struct { Path string `json:"path"` Line int32 `json:"line"` diff --git a/lambdacontext/context.go b/lambdacontext/context.go index 7b9d9c65..ae11cb47 100644 --- a/lambdacontext/context.go +++ b/lambdacontext/context.go @@ -73,8 +73,8 @@ type CognitoIdentity struct { // LambdaContext is the set of metadata that is passed for every Invoke. type LambdaContext struct { - AwsRequestID string //nolint: stylecheck - InvokedFunctionArn string //nolint: stylecheck + AwsRequestID string //nolint: staticcheck + InvokedFunctionArn string //nolint: staticcheck Identity CognitoIdentity ClientContext ClientContext TenantID string `json:",omitempty"`