From fe1d04c2b20549c257e172a926cf8359a0cb1495 Mon Sep 17 00:00:00 2001 From: Nabil Dakkoune Date: Wed, 18 Mar 2026 11:31:11 +0100 Subject: [PATCH 1/6] [AWSX-2115] chore(go-forwarder): init Go module, Makefile, .gitignore, basic CI and main --- .github/workflows/aws_go_forwarder.yml | 48 ++++++++++++++++++++ aws/logs_monitoring_go/.gitignore | 3 ++ aws/logs_monitoring_go/Makefile | 33 ++++++++++++++ aws/logs_monitoring_go/cmd/forwarder/main.go | 23 ++++++++++ aws/logs_monitoring_go/go.mod | 5 ++ aws/logs_monitoring_go/go.sum | 10 ++++ 6 files changed, 122 insertions(+) create mode 100644 .github/workflows/aws_go_forwarder.yml create mode 100644 aws/logs_monitoring_go/.gitignore create mode 100644 aws/logs_monitoring_go/Makefile create mode 100644 aws/logs_monitoring_go/cmd/forwarder/main.go create mode 100644 aws/logs_monitoring_go/go.mod create mode 100644 aws/logs_monitoring_go/go.sum diff --git a/.github/workflows/aws_go_forwarder.yml b/.github/workflows/aws_go_forwarder.yml new file mode 100644 index 000000000..bfb2e0903 --- /dev/null +++ b/.github/workflows/aws_go_forwarder.yml @@ -0,0 +1,48 @@ +name: Go Forwarder CI + +on: + pull_request: + paths: + - "aws/logs_monitoring_go/**" + +jobs: + lint: + runs-on: ubuntu-24.04-arm + defaults: + run: + working-directory: aws/logs_monitoring_go + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v5 + with: + go-version-file: aws/logs_monitoring_go/go.mod + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + working-directory: aws/logs_monitoring_go + + test: + runs-on: ubuntu-24.04-arm + defaults: + run: + working-directory: aws/logs_monitoring_go + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v5 + with: + go-version-file: aws/logs_monitoring_go/go.mod + - name: Run tests + run: go test -race ./... + + build: + runs-on: ubuntu-24.04-arm + defaults: + run: + working-directory: aws/logs_monitoring_go + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v5 + with: + go-version-file: aws/logs_monitoring_go/go.mod + - name: Build binary + run: GOOS=linux GOARCH=arm64 go build -o bootstrap ./cmd/forwarder/ diff --git a/aws/logs_monitoring_go/.gitignore b/aws/logs_monitoring_go/.gitignore new file mode 100644 index 000000000..de75ab822 --- /dev/null +++ b/aws/logs_monitoring_go/.gitignore @@ -0,0 +1,3 @@ +.aws-sam +samconfig.toml +template.yaml \ No newline at end of file diff --git a/aws/logs_monitoring_go/Makefile b/aws/logs_monitoring_go/Makefile new file mode 100644 index 000000000..a3878f199 --- /dev/null +++ b/aws/logs_monitoring_go/Makefile @@ -0,0 +1,33 @@ +.PHONY: build package test lint clean sam-build sam-invoke sam-deploy build-ForwarderFunction + +BINARY_NAME := bootstrap +ZIP_NAME := forwarder.zip + +build: + GOOS=linux GOARCH=arm64 go build -o $(BINARY_NAME) ./cmd/forwarder/ + +# Used by `sam build` +build-ForwarderFunction: + GOOS=linux GOARCH=arm64 go build -o $(ARTIFACTS_DIR)/bootstrap ./cmd/forwarder/ + +package: build + zip $(ZIP_NAME) $(BINARY_NAME) + +test: + go test -race ./... + +lint: + golangci-lint run ./... + +clean: + rm -f $(BINARY_NAME) $(ZIP_NAME) + +sam-build: + sam build + +EVENT ?= events/cloudwatch_logs.json +sam-invoke: sam-build + sam local invoke ForwarderFunction -e $(EVENT) + +sam-deploy: sam-build + sam deploy diff --git a/aws/logs_monitoring_go/cmd/forwarder/main.go b/aws/logs_monitoring_go/cmd/forwarder/main.go new file mode 100644 index 000000000..347a2a716 --- /dev/null +++ b/aws/logs_monitoring_go/cmd/forwarder/main.go @@ -0,0 +1,23 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2026-Present Datadog, Inc. + +package main + +import ( + "context" + "encoding/json" + "log" + + "github.com/aws/aws-lambda-go/lambda" +) + +func handleRequest(ctx context.Context, event json.RawMessage) error { + log.Printf("Received event: %s", string(event)) + return nil +} + +func main() { + lambda.Start(handleRequest) +} diff --git a/aws/logs_monitoring_go/go.mod b/aws/logs_monitoring_go/go.mod new file mode 100644 index 000000000..99422bf68 --- /dev/null +++ b/aws/logs_monitoring_go/go.mod @@ -0,0 +1,5 @@ +module github.com/DataDog/datadog-serverless-functions/aws/logs_monitoring_go + +go 1.26 + +require github.com/aws/aws-lambda-go v1.53.0 diff --git a/aws/logs_monitoring_go/go.sum b/aws/logs_monitoring_go/go.sum new file mode 100644 index 000000000..0d766f423 --- /dev/null +++ b/aws/logs_monitoring_go/go.sum @@ -0,0 +1,10 @@ +github.com/aws/aws-lambda-go v1.53.0 h1:uAMv6W/vCP/L494BAUSxe+8KVBIPK+SGPyapFt3FuMk= +github.com/aws/aws-lambda-go v1.53.0/go.mod h1:dpMpZgvWx5vuQJfBt0zqBha60q7Dd7RfgJv23DymV8A= +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/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From a454afd41e8d4659724848a2dd3456a51fe2ba38 Mon Sep 17 00:00:00 2001 From: Nabil Dakkoune Date: Wed, 18 Mar 2026 11:39:59 +0100 Subject: [PATCH 2/6] ci: skip non-go jobs and force 1.26 building --- .github/workflows/aws_go_forwarder.yml | 2 ++ .github/workflows/aws_integration_test.yml | 5 ++++- .github/workflows/aws_lint.yml | 5 ++++- .github/workflows/aws_unit_test.yml | 5 ++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/aws_go_forwarder.yml b/.github/workflows/aws_go_forwarder.yml index bfb2e0903..543a96b6f 100644 --- a/.github/workflows/aws_go_forwarder.yml +++ b/.github/workflows/aws_go_forwarder.yml @@ -20,6 +20,8 @@ jobs: uses: golangci/golangci-lint-action@v6 with: working-directory: aws/logs_monitoring_go + install-mode: goinstall + version: v2.1.6 test: runs-on: ubuntu-24.04-arm diff --git a/.github/workflows/aws_integration_test.yml b/.github/workflows/aws_integration_test.yml index 9ab4041e3..421366c10 100644 --- a/.github/workflows/aws_integration_test.yml +++ b/.github/workflows/aws_integration_test.yml @@ -13,7 +13,10 @@ permissions: repository-projects: none security-events: none -on: [pull_request] +on: + pull_request: + paths-ignore: + - "aws/logs_monitoring_go/**" jobs: build: diff --git a/.github/workflows/aws_lint.yml b/.github/workflows/aws_lint.yml index 2390a110e..9bb9bda25 100644 --- a/.github/workflows/aws_lint.yml +++ b/.github/workflows/aws_lint.yml @@ -1,6 +1,9 @@ name: Lint -on: [pull_request] +on: + pull_request: + paths-ignore: + - "aws/logs_monitoring_go/**" jobs: build: diff --git a/.github/workflows/aws_unit_test.yml b/.github/workflows/aws_unit_test.yml index fd679a76d..2033af23b 100644 --- a/.github/workflows/aws_unit_test.yml +++ b/.github/workflows/aws_unit_test.yml @@ -1,6 +1,9 @@ name: AWS Python unit tests -on: [pull_request] +on: + pull_request: + paths-ignore: + - "aws/logs_monitoring_go/**" jobs: build: From 4a82981c8530cb445cbd2457fa6249007f3ed3f3 Mon Sep 17 00:00:00 2001 From: Nabil Dakkoune Date: Wed, 18 Mar 2026 11:42:27 +0100 Subject: [PATCH 3/6] trigger --- .github/workflows/aws_go_forwarder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aws_go_forwarder.yml b/.github/workflows/aws_go_forwarder.yml index 543a96b6f..5bcddb961 100644 --- a/.github/workflows/aws_go_forwarder.yml +++ b/.github/workflows/aws_go_forwarder.yml @@ -1,4 +1,4 @@ -name: Go Forwarder CI +name: Go Forwarder on: pull_request: From f62e6180b8007316def0e4182403f288fea5309f Mon Sep 17 00:00:00 2001 From: Nabil Dakkoune Date: Wed, 18 Mar 2026 11:45:29 +0100 Subject: [PATCH 4/6] Revert "ci: skip non-go jobs and force 1.26 building" This reverts commit a454afd41e8d4659724848a2dd3456a51fe2ba38. --- .github/workflows/aws_go_forwarder.yml | 2 -- .github/workflows/aws_integration_test.yml | 5 +---- .github/workflows/aws_lint.yml | 5 +---- .github/workflows/aws_unit_test.yml | 5 +---- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/aws_go_forwarder.yml b/.github/workflows/aws_go_forwarder.yml index 5bcddb961..fa3b2ec15 100644 --- a/.github/workflows/aws_go_forwarder.yml +++ b/.github/workflows/aws_go_forwarder.yml @@ -20,8 +20,6 @@ jobs: uses: golangci/golangci-lint-action@v6 with: working-directory: aws/logs_monitoring_go - install-mode: goinstall - version: v2.1.6 test: runs-on: ubuntu-24.04-arm diff --git a/.github/workflows/aws_integration_test.yml b/.github/workflows/aws_integration_test.yml index 421366c10..9ab4041e3 100644 --- a/.github/workflows/aws_integration_test.yml +++ b/.github/workflows/aws_integration_test.yml @@ -13,10 +13,7 @@ permissions: repository-projects: none security-events: none -on: - pull_request: - paths-ignore: - - "aws/logs_monitoring_go/**" +on: [pull_request] jobs: build: diff --git a/.github/workflows/aws_lint.yml b/.github/workflows/aws_lint.yml index 9bb9bda25..2390a110e 100644 --- a/.github/workflows/aws_lint.yml +++ b/.github/workflows/aws_lint.yml @@ -1,9 +1,6 @@ name: Lint -on: - pull_request: - paths-ignore: - - "aws/logs_monitoring_go/**" +on: [pull_request] jobs: build: diff --git a/.github/workflows/aws_unit_test.yml b/.github/workflows/aws_unit_test.yml index 2033af23b..fd679a76d 100644 --- a/.github/workflows/aws_unit_test.yml +++ b/.github/workflows/aws_unit_test.yml @@ -1,9 +1,6 @@ name: AWS Python unit tests -on: - pull_request: - paths-ignore: - - "aws/logs_monitoring_go/**" +on: [pull_request] jobs: build: From 0cf38528609f44b49700f799d41da73686d039fb Mon Sep 17 00:00:00 2001 From: Nabil Dakkoune Date: Wed, 18 Mar 2026 11:49:01 +0100 Subject: [PATCH 5/6] ci: update linter version --- .github/workflows/aws_go_forwarder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aws_go_forwarder.yml b/.github/workflows/aws_go_forwarder.yml index fa3b2ec15..6e2eea8f6 100644 --- a/.github/workflows/aws_go_forwarder.yml +++ b/.github/workflows/aws_go_forwarder.yml @@ -17,7 +17,7 @@ jobs: with: go-version-file: aws/logs_monitoring_go/go.mod - name: golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v9.2 with: working-directory: aws/logs_monitoring_go From 0e29cba34bfc75d169b72c1bf9d73afb93aabfc5 Mon Sep 17 00:00:00 2001 From: Nabil Dakkoune Date: Wed, 18 Mar 2026 11:50:43 +0100 Subject: [PATCH 6/6] ci: update version --- .github/workflows/aws_go_forwarder.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aws_go_forwarder.yml b/.github/workflows/aws_go_forwarder.yml index 6e2eea8f6..28e9b2974 100644 --- a/.github/workflows/aws_go_forwarder.yml +++ b/.github/workflows/aws_go_forwarder.yml @@ -17,7 +17,7 @@ jobs: with: go-version-file: aws/logs_monitoring_go/go.mod - name: golangci-lint - uses: golangci/golangci-lint-action@v9.2 + uses: golangci/golangci-lint-action@v9 with: working-directory: aws/logs_monitoring_go