diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5fe27573..cfe30225 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,6 +18,6 @@ jobs: - name: golangci-golint run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.52.1 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.55.1 ./bin/golangci-lint run -v ./... diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index da219999..327f6652 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,14 +10,13 @@ jobs: strategy: matrix: go: + - "1.21" - "1.20" - "1.19" - "1.18" - "1.17" - "1.16" - "1.15" - - "1.14" - - "1.13" steps: - name: Set up Go ${{ matrix.go }} diff --git a/.golangci.yml b/.golangci.yml index dc8402d5..5b4b689f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -18,6 +18,6 @@ run: linters-settings: stylecheck: - go: "1.20" + go: "1.21" checks: ["all"] initialisms: ["AWS", "ARN", "IAM", "MQTT", "ACL", "API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP", "HTTPS", "ID", "IP", "JSON", "QPS", "RAM", "RPC", "SLA", "SMTP", "SQL", "SSH", "TCP", "TLS", "TTL", "UDP", "UI", "GID", "UID", "UUID", "URI", "URL", "UTF8", "VM", "XML", "XMPP", "XSRF", "XSS", "SIP", "RTP", "AMQP", "DB", "TS", "VPC"] diff --git a/cfn/event_test.go b/cfn/event_test.go index 9d22ad01..24066af7 100644 --- a/cfn/event_test.go +++ b/cfn/event_test.go @@ -3,7 +3,7 @@ package cfn import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" diff --git a/cfn/response.go b/cfn/response.go index 375ddcb8..83095bd3 100644 --- a/cfn/response.go +++ b/cfn/response.go @@ -4,8 +4,8 @@ package cfn import ( "bytes" - "encoding/json" "fmt" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "log" "net/http" diff --git a/cfn/wrap.go b/cfn/wrap.go index ab421a85..f0e26ded 100644 --- a/cfn/wrap.go +++ b/cfn/wrap.go @@ -4,8 +4,8 @@ package cfn import ( "context" - "encoding/json" "errors" + "github.com/segmentio/encoding/json" "log" "net/http" diff --git a/cfn/wrap_test.go b/cfn/wrap_test.go index da98f20f..517a266c 100644 --- a/cfn/wrap_test.go +++ b/cfn/wrap_test.go @@ -5,8 +5,8 @@ package cfn import ( "bytes" "context" - "encoding/json" "errors" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "net/http" "testing" diff --git a/events/README_Chime_Bots.md b/events/README_Chime_Bots.md index d5d933d8..e28e7c52 100644 --- a/events/README_Chime_Bots.md +++ b/events/README_Chime_Bots.md @@ -11,7 +11,7 @@ import ( "context" "net/http" "bytes" - "encoding/json" + "github.com/segmentio/encoding/json" "errors" "strconv" diff --git a/events/README_ClientVPN.md b/events/README_ClientVPN.md index ab8c0e39..b2ed4b08 100644 --- a/events/README_ClientVPN.md +++ b/events/README_ClientVPN.md @@ -8,7 +8,7 @@ import ( "log" "net" - "encoding/json" + "github.com/segmentio/encoding/json" "github.com/aws/aws-lambda-go/events" "github.com/aws/aws-lambda-go/lambda" diff --git a/events/README_KinesisDataAnalytics.md b/events/README_KinesisDataAnalytics.md index 6225294c..3e4b0e4a 100644 --- a/events/README_KinesisDataAnalytics.md +++ b/events/README_KinesisDataAnalytics.md @@ -10,7 +10,7 @@ package main import ( "context" - "encoding/json" + "github.com/segmentio/encoding/json" "fmt" "log" diff --git a/events/activemq_test.go b/events/activemq_test.go index 7b967893..a741b2f0 100644 --- a/events/activemq_test.go +++ b/events/activemq_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/alb_test.go b/events/alb_test.go index 56d5b963..0dc58839 100644 --- a/events/alb_test.go +++ b/events/alb_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/apigw_test.go b/events/apigw_test.go index 5957e96a..d7d24dab 100644 --- a/events/apigw_test.go +++ b/events/apigw_test.go @@ -3,7 +3,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/appsync.go b/events/appsync.go index 37682b9e..f9354a48 100644 --- a/events/appsync.go +++ b/events/appsync.go @@ -1,6 +1,6 @@ package events -import "encoding/json" +import "github.com/segmentio/encoding/json" // Deprecated: AppSyncResolverTemplate does not represent resolver events sent by AppSync. Instead directly model your input schema, or use map[string]string, json.RawMessage, interface{}, etc.. type AppSyncResolverTemplate struct { diff --git a/events/appsync_test.go b/events/appsync_test.go index 2e179261..fd5d889e 100644 --- a/events/appsync_test.go +++ b/events/appsync_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/attributevalue.go b/events/attributevalue.go index f582d30f..5cc3a642 100644 --- a/events/attributevalue.go +++ b/events/attributevalue.go @@ -5,9 +5,9 @@ package events import ( "bytes" "encoding/base64" - "encoding/json" "errors" "fmt" + "github.com/segmentio/encoding/json" "strconv" ) diff --git a/events/attributevalue_test.go b/events/attributevalue_test.go index 551c9d1c..00d97947 100644 --- a/events/attributevalue_test.go +++ b/events/attributevalue_test.go @@ -4,7 +4,7 @@ package events import ( "encoding/base64" - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/stretchr/testify/assert" diff --git a/events/autoscaling_test.go b/events/autoscaling_test.go index a41541d8..7225ec3d 100644 --- a/events/autoscaling_test.go +++ b/events/autoscaling_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/chime_bot_test.go b/events/chime_bot_test.go index 3caba67e..311e3080 100644 --- a/events/chime_bot_test.go +++ b/events/chime_bot_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "time" diff --git a/events/clientvpn_test.go b/events/clientvpn_test.go index aae58d59..4a39ba3e 100644 --- a/events/clientvpn_test.go +++ b/events/clientvpn_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/cloudwatch_events.go b/events/cloudwatch_events.go index e3201fdb..926f3077 100644 --- a/events/cloudwatch_events.go +++ b/events/cloudwatch_events.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "time" ) diff --git a/events/cloudwatch_events_test.go b/events/cloudwatch_events_test.go index 3f49caba..4bc1fcac 100644 --- a/events/cloudwatch_events_test.go +++ b/events/cloudwatch_events_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/cloudwatch_logs.go b/events/cloudwatch_logs.go index 6b74b3b2..94a3545a 100644 --- a/events/cloudwatch_logs.go +++ b/events/cloudwatch_logs.go @@ -4,7 +4,7 @@ import ( "bytes" "compress/gzip" "encoding/base64" - "encoding/json" + "github.com/segmentio/encoding/json" ) // CloudwatchLogsEvent represents raw data from a cloudwatch logs event diff --git a/events/cloudwatch_logs_test.go b/events/cloudwatch_logs_test.go index ef0b93e7..d1ef9f1a 100644 --- a/events/cloudwatch_logs_test.go +++ b/events/cloudwatch_logs_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "reflect" "testing" diff --git a/events/codebuild.go b/events/codebuild.go index 08cbb607..8490803f 100644 --- a/events/codebuild.go +++ b/events/codebuild.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "time" ) diff --git a/events/codebuild_test.go b/events/codebuild_test.go index d0e1b693..94a696f6 100644 --- a/events/codebuild_test.go +++ b/events/codebuild_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" "time" diff --git a/events/codedeploy_test.go b/events/codedeploy_test.go index c363f77d..2f5366b4 100644 --- a/events/codedeploy_test.go +++ b/events/codedeploy_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "github.com/stretchr/testify/require" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/codepipeline_cloudwatch_test.go b/events/codepipeline_cloudwatch_test.go index e1e21748..db740f11 100644 --- a/events/codepipeline_cloudwatch_test.go +++ b/events/codepipeline_cloudwatch_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "github.com/stretchr/testify/require" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/codepipeline_job_test.go b/events/codepipeline_job_test.go index c78bfa0d..e6e95101 100644 --- a/events/codepipeline_job_test.go +++ b/events/codepipeline_job_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/codepipeline_test.go b/events/codepipeline_test.go index cb7e0e6a..426ec15e 100644 --- a/events/codepipeline_test.go +++ b/events/codepipeline_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/cognito_test.go b/events/cognito_test.go index 88cb3121..202be6b2 100644 --- a/events/cognito_test.go +++ b/events/cognito_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/config_test.go b/events/config_test.go index 57b31123..a2f7ac49 100644 --- a/events/config_test.go +++ b/events/config_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/connect_test.go b/events/connect_test.go index 723f99f3..651db89d 100644 --- a/events/connect_test.go +++ b/events/connect_test.go @@ -3,7 +3,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/duration.go b/events/duration.go index 7952265d..8c071697 100644 --- a/events/duration.go +++ b/events/duration.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "math" "time" ) diff --git a/events/dynamodb_test.go b/events/dynamodb_test.go index e364cb02..18fa2204 100644 --- a/events/dynamodb_test.go +++ b/events/dynamodb_test.go @@ -3,7 +3,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/ecr_image_action_test.go b/events/ecr_image_action_test.go index 180e8030..d2beaeff 100644 --- a/events/ecr_image_action_test.go +++ b/events/ecr_image_action_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "time" diff --git a/events/ecr_scan_test.go b/events/ecr_scan_test.go index 2029dbd5..5815a11a 100644 --- a/events/ecr_scan_test.go +++ b/events/ecr_scan_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/ecs_container_instance.go b/events/ecs_container_instance.go index 4ef48b78..fe2dec2a 100644 --- a/events/ecs_container_instance.go +++ b/events/ecs_container_instance.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "time" ) diff --git a/events/ecs_container_instance_test.go b/events/ecs_container_instance_test.go index 1e7229ac..a30c6d42 100644 --- a/events/ecs_container_instance_test.go +++ b/events/ecs_container_instance_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "time" diff --git a/events/epoch_time.go b/events/epoch_time.go index 59e4e1d1..20c671be 100644 --- a/events/epoch_time.go +++ b/events/epoch_time.go @@ -3,7 +3,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "time" ) diff --git a/events/epoch_time_test.go b/events/epoch_time_test.go index 50cc0007..ad83cc6b 100644 --- a/events/epoch_time_test.go +++ b/events/epoch_time_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "time" diff --git a/events/firehose_test.go b/events/firehose_test.go index 46409965..586930cb 100644 --- a/events/firehose_test.go +++ b/events/firehose_test.go @@ -3,7 +3,7 @@ package events import ( "context" - "encoding/json" + "github.com/segmentio/encoding/json" "strings" "testing" diff --git a/events/iot_1_click_test.go b/events/iot_1_click_test.go index 7f4ffc94..3507582d 100644 --- a/events/iot_1_click_test.go +++ b/events/iot_1_click_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/iot_button_test.go b/events/iot_button_test.go index 583cb43d..46a4825f 100644 --- a/events/iot_button_test.go +++ b/events/iot_button_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/iot_preprovision_hook_test.go b/events/iot_preprovision_hook_test.go index 09d7e490..5c95068a 100644 --- a/events/iot_preprovision_hook_test.go +++ b/events/iot_preprovision_hook_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/iot_test.go b/events/iot_test.go index 38cf84e9..92588a4e 100644 --- a/events/iot_test.go +++ b/events/iot_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/kafka.go b/events/kafka.go index abbc03f3..24d17b2f 100644 --- a/events/kafka.go +++ b/events/kafka.go @@ -3,7 +3,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" ) type KafkaEvent struct { diff --git a/events/kafka_test.go b/events/kafka_test.go index f4ad6577..af499670 100644 --- a/events/kafka_test.go +++ b/events/kafka_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/kinesis_analytics_test.go b/events/kinesis_analytics_test.go index 14e91fe1..8aead1cc 100644 --- a/events/kinesis_analytics_test.go +++ b/events/kinesis_analytics_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/kinesis_test.go b/events/kinesis_test.go index 4ec2bbb1..8e9acb3f 100644 --- a/events/kinesis_test.go +++ b/events/kinesis_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/lambda_function_urls.go b/events/lambda_function_urls.go index 52a48e83..43372b4e 100644 --- a/events/lambda_function_urls.go +++ b/events/lambda_function_urls.go @@ -4,8 +4,8 @@ package events import ( "bytes" - "encoding/json" "errors" + "github.com/segmentio/encoding/json" "io" "net/http" ) diff --git a/events/lambda_function_urls_test.go b/events/lambda_function_urls_test.go index cbc15f45..10116d53 100644 --- a/events/lambda_function_urls_test.go +++ b/events/lambda_function_urls_test.go @@ -3,8 +3,8 @@ package events import ( - "encoding/json" "errors" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "net/http" "strings" diff --git a/events/lex_test.go b/events/lex_test.go index efda78ef..6cfa6848 100644 --- a/events/lex_test.go +++ b/events/lex_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/rabbitmq_test.go b/events/rabbitmq_test.go index 9935479f..9e036b19 100644 --- a/events/rabbitmq_test.go +++ b/events/rabbitmq_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/s3.go b/events/s3.go index 74c9daab..bed3ce67 100644 --- a/events/s3.go +++ b/events/s3.go @@ -3,7 +3,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "net/url" "time" ) diff --git a/events/s3_batch_job_test.go b/events/s3_batch_job_test.go index 802d38b2..17b68c71 100644 --- a/events/s3_batch_job_test.go +++ b/events/s3_batch_job_test.go @@ -3,7 +3,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/s3_test.go b/events/s3_test.go index 968bfe6b..123386c9 100644 --- a/events/s3_test.go +++ b/events/s3_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/ses_test.go b/events/ses_test.go index d0da6c7a..11b637a5 100644 --- a/events/ses_test.go +++ b/events/ses_test.go @@ -1,7 +1,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/sns_test.go b/events/sns_test.go index e084062c..c26d5ebb 100644 --- a/events/sns_test.go +++ b/events/sns_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/sqs_test.go b/events/sqs_test.go index b207d7b1..47ba4bb2 100644 --- a/events/sqs_test.go +++ b/events/sqs_test.go @@ -2,7 +2,7 @@ package events import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" "github.com/aws/aws-lambda-go/events/test" diff --git a/events/test/assert.go b/events/test/assert.go index 14040740..d13046da 100644 --- a/events/test/assert.go +++ b/events/test/assert.go @@ -1,7 +1,7 @@ package test import ( - "encoding/json" + "github.com/segmentio/encoding/json" "io/ioutil" //nolint: staticcheck "testing" diff --git a/events/test/jsonsyntax.go b/events/test/jsonsyntax.go index 9c4b0067..c609a435 100644 --- a/events/test/jsonsyntax.go +++ b/events/test/jsonsyntax.go @@ -3,7 +3,7 @@ package test import ( - "encoding/json" + "github.com/segmentio/encoding/json" "testing" ) diff --git a/go.mod b/go.mod index 456a8a6e..0932b1ad 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,16 @@ module github.com/aws/aws-lambda-go -go 1.18 +go 1.21 -require github.com/stretchr/testify v1.7.2 +require ( + github.com/segmentio/encoding v0.3.6 + github.com/stretchr/testify v1.8.4 +) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/segmentio/asm v1.2.0 // indirect + golang.org/x/sys v0.13.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 47d6d021..5f0aec74 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,17 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= -github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/segmentio/asm v1.1.3/go.mod h1:Ld3L4ZXGNcSLRg4JBsZ3//1+f/TjYl0Mzen/DQy1EJg= +github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= +github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= +github.com/segmentio/encoding v0.3.6 h1:E6lVLyDPseWEulBmCmAKPanDd3jiyGDo5gMcugCRwZQ= +github.com/segmentio/encoding v0.3.6/go.mod h1:n0JeuIqEQrQoPDGsjo8UNd1iA0U8d8+oHAA4E3G3OxM= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +golang.org/x/sys v0.0.0-20211110154304-99a53858aa08/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/lambda/extensions_api_client.go b/lambda/extensions_api_client.go index c9703891..100fb53a 100644 --- a/lambda/extensions_api_client.go +++ b/lambda/extensions_api_client.go @@ -2,11 +2,12 @@ package lambda import ( "bytes" - "encoding/json" "fmt" "io" "io/ioutil" //nolint: staticcheck "net/http" + + "github.com/segmentio/encoding/json" ) const ( diff --git a/lambda/handler.go b/lambda/handler.go index e4cfaf7a..c1917e39 100644 --- a/lambda/handler.go +++ b/lambda/handler.go @@ -5,9 +5,9 @@ package lambda import ( "bytes" "context" - "encoding/json" "errors" "fmt" + "github.com/segmentio/encoding/json" "io" "io/ioutil" // nolint:staticcheck "reflect" diff --git a/lambda/handler_test.go b/lambda/handler_test.go index 87942900..d23f4422 100644 --- a/lambda/handler_test.go +++ b/lambda/handler_test.go @@ -351,7 +351,7 @@ func TestInvokes(t *testing.T) { }, { name: "types that are not json serializable result in an error", - expected: expected{``, errors.New("json: error calling MarshalJSON for type struct { lambda.arbitraryJSON }: barf")}, + expected: expected{``, errors.New("barf")}, handler: func() (interface{}, error) { return struct { arbitraryJSON diff --git a/lambda/invoke_loop.go b/lambda/invoke_loop.go index 9e2d6598..048feab8 100644 --- a/lambda/invoke_loop.go +++ b/lambda/invoke_loop.go @@ -5,7 +5,6 @@ package lambda import ( "bytes" "context" - "encoding/json" "fmt" "io" "log" @@ -13,6 +12,8 @@ import ( "strconv" "time" + "github.com/segmentio/encoding/json" + "github.com/aws/aws-lambda-go/lambda/messages" "github.com/aws/aws-lambda-go/lambdacontext" ) @@ -36,6 +37,7 @@ func startRuntimeAPILoop(api string, handler Handler) error { if err != nil { return err } + if err = handleInvoke(invoke, h); err != nil { return err } diff --git a/lambda/invoke_loop_test.go b/lambda/invoke_loop_test.go index fab800b9..28a05f83 100644 --- a/lambda/invoke_loop_test.go +++ b/lambda/invoke_loop_test.go @@ -5,7 +5,6 @@ package lambda import ( "bytes" "context" - "encoding/json" "errors" "fmt" "io" @@ -16,6 +15,8 @@ import ( "testing" "unicode/utf8" + "github.com/segmentio/encoding/json" + "github.com/aws/aws-lambda-go/lambda/messages" "github.com/aws/aws-lambda-go/lambdacontext" "github.com/stretchr/testify/assert" @@ -239,12 +240,12 @@ func TestContextDeserializationErrors(t *testing.T) { _ = startRuntimeAPILoop(endpoint, handler) assert.JSONEq(t, `{ - "errorMessage":"failed to unmarshal client context json: invalid character 'n' looking for beginning of object key string", + "errorMessage":"failed to unmarshal client context json: json: expected '\"' at the beginning of a string value: not json }", "errorType":"errorString" }`, string(record.responses[0])) assert.JSONEq(t, `{ - "errorMessage":"failed to unmarshal cognito identity json: invalid character 'n' looking for beginning of object key string", + "errorMessage":"failed to unmarshal cognito identity json: json: expected '\"' at the beginning of a string value: not json }", "errorType":"errorString" }`, string(record.responses[1])) @@ -262,7 +263,7 @@ func (invalidPayload) MarshalJSON() ([]byte, error) { func TestSafeMarshal_SerializationError(t *testing.T) { payload := safeMarshal(invalidPayload{}) - want := `{"errorMessage":"json: error calling MarshalJSON for type lambda.invalidPayload: some error that contains '\"'","errorType":"Runtime.SerializationError"}` + want := `{"errorMessage":"some error that contains '\"'","errorType":"Runtime.SerializationError"}` assert.Equal(t, want, string(payload)) } diff --git a/lambda/rpc_function.go b/lambda/rpc_function.go index 0c8e798e..fce18107 100644 --- a/lambda/rpc_function.go +++ b/lambda/rpc_function.go @@ -7,8 +7,8 @@ package lambda import ( "context" - "encoding/json" "errors" + "github.com/segmentio/encoding/json" "log" "net" "net/rpc" diff --git a/lambda/rpc_function_test.go b/lambda/rpc_function_test.go index 515fc62a..7f278a70 100644 --- a/lambda/rpc_function_test.go +++ b/lambda/rpc_function_test.go @@ -7,8 +7,8 @@ package lambda import ( "context" - "encoding/json" "errors" + "github.com/segmentio/encoding/json" "io" "os" "strconv" diff --git a/lambdaurl/http_handler_test.go b/lambdaurl/http_handler_test.go index a6e6aa8d..f53c99c6 100644 --- a/lambdaurl/http_handler_test.go +++ b/lambdaurl/http_handler_test.go @@ -8,14 +8,15 @@ import ( "bytes" "context" _ "embed" - "encoding/json" "io" - "io/ioutil" + "io/ioutil" //nolint: staticcheck "log" "net/http" "testing" "time" + "github.com/segmentio/encoding/json" + "github.com/aws/aws-lambda-go/events" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/lambdaurl/testdata/testfunc/site/main.go b/lambdaurl/testdata/testfunc/site/main.go index 2bcf4dca..b41056bd 100644 --- a/lambdaurl/testdata/testfunc/site/main.go +++ b/lambdaurl/testdata/testfunc/site/main.go @@ -2,7 +2,7 @@ package main import ( "context" - "encoding/json" + "github.com/segmentio/encoding/json" "io" "net/http" "os"