Conversation
start by inlining the parts of that libary we used
There was a problem hiding this comment.
Pull request overview
This PR removes the dependency on m-mizutani/golambda by switching to the upstream AWS Lambda Go runtime (aws-lambda-go/lambda) and replacing golambda-specific event/error/logging utilities with in-repo and standard-library equivalents.
Changes:
- Replaced golambda-based Lambda entrypoint with
lambda.Startand added SQS(SNS(S3)) extraction logic. - Migrated logging to
log/slogwith a newpkg/loghandler to emit JSON logs enriched with Lambda context. - Replaced golambda error helpers with
fmt.Errorf/errors.Newacross services and models; updated tests accordingly.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
uguisu.go |
Switches handler to lambda.Start, adds extractEvents, threads context.Context into processing, updates logging. |
pkg/log/handler.go |
New slog JSON handler with LOG_LEVEL parsing and Lambda request context attributes. |
pkg/service/slack.go |
Removes golambda errors/logger usage; uses stdlib errors + slog. |
pkg/service/cloudtrail.go |
Removes golambda error wrapping; uses fmt.Errorf wrapping. |
pkg/models/rule.go |
Removes golambda error construction; uses fmt.Errorf. |
filter.go |
Replaces golambda logger usage with slog. |
uguisu_test.go |
Updates tests to call new run(ctx, []events.S3Event) signature. |
rule_test.go |
Updates rule tests to call new run(ctx, []events.S3Event) signature. |
go.mod / go.sum |
Drops golambda and related transitive dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b5aa815 to
d168bdd
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
bermannoah
left a comment
There was a problem hiding this comment.
Nice one, thank you @errm !
This pull request removes the dependency on the
golambdapackage and replaces its logging and error handling with standard Go libraries and the newlog/slogpackage. It also introduces a new utility inpkg/sqsfor extracting S3 events from SQS batches, along with comprehensive unit tests. Additionally, the codebase is refactored to use clearer, more idiomatic error messages and logging, and a new logging handler is provided for AWS Lambda integration.Key changes:
Dependency and logging refactor:
golambdapackage from the codebase and replaced its logging with Go's standardlog/slogpackage, updating all affected files and import statements accordingly. (filter.go,pkg/models/rule.go,pkg/service/cloudtrail.go,pkg/service/slack.go,go.mod) [1] [2] [3] [4] [5] [6]fmt.Errorfwith descriptive messages instead ofgolambda.NewErrorandgolambda.WrapError. (pkg/models/rule.go,pkg/service/cloudtrail.go,pkg/service/slack.go) [1] [2] [3] [4] [5] [6] [7] [8]New features and utilities:
pkg/sqs/sqs.gowith anExtractEventsfunction to decode S3 event notifications from SQS batches containing SNS payloads, and provided thorough unit tests inpkg/sqs/sqs_test.go. [1] [2]pkg/log/handler.goto provide aslog.Handlerconfigured for AWS Lambda, including request metadata and configurable log levels via environment variables.Testing and consistency improvements:
pkg/service/cloudtrail_test.go,pkg/service/slack_test.go,rule_test.go) [1] [2] [3] [4] [5] [6] [7] [8] [9]