Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade go to 1.23 and golangci-lint to 1.64 #612

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ linters:
# - too many non-sensical warnings
# - not relevant for us
# - false positives
#
#
# "might be worth fixing" means we should investigate/fix in the mid term
- canonicalheader
- contextcheck # might be worth fixing
Expand All @@ -54,7 +54,6 @@ linters:
- godot
- godox # complains about TODO etc
- gofumpt
- gomnd
- gomoddirectives
- inamedparam
- interfacebloat
Expand All @@ -77,8 +76,6 @@ linters:
- wastedassign
- wsl
- wrapcheck
# the following linters are deprecated
- execinquery
# we don't want to change code to Go 1.22+ yet
- intrange
- copyloopvar
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SHELL = /bin/bash -eo pipefail

GORELEASER_VERSION = "v1.19.2"
GO_LICENSER_VERSION = "v0.4.0"
GOLANGCI_LINT_VERSION = "v1.59.1"
GOLANGCI_LINT_VERSION = "v1.64.4"
export DOCKER_IMAGE_NAME = observability/apm-lambda-extension
export DOCKER_REGISTRY = docker.elastic.co

Expand Down
18 changes: 11 additions & 7 deletions e2e-testing/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ import (
"go.uber.org/zap"
)

var rebuildPtr = flag.Bool("rebuild", false, "rebuild lambda functions")
var langPtr = flag.String("lang", "nodejs", "the language of the Lambda test function : Java, Node, or Python")
var timerPtr = flag.Int("timer", 20, "the timeout of the test lambda function")
var javaAgentVerPtr = flag.String("java-agent-ver", "1.28.4", "the version of the java APM agent")
var (
rebuildPtr = flag.Bool("rebuild", false, "rebuild lambda functions")
langPtr = flag.String("lang", "nodejs", "the language of the Lambda test function : Java, Node, or Python")
timerPtr = flag.Int("timer", 20, "the timeout of the test lambda function")
javaAgentVerPtr = flag.String("java-agent-ver", "1.28.4", "the version of the java APM agent")
)

func TestEndToEnd(t *testing.T) {
// Check the only mandatory environment variable
Expand Down Expand Up @@ -103,7 +105,7 @@ func TestEndToEnd(t *testing.T) {
t.Fail()
}
l.Infof("Querying the mock server for transaction bound to %s...", samServiceName)
assert.True(t, strings.Contains(mockAPMServerLog, testUUID))
assert.Contains(t, mockAPMServerLog, testUUID)
}

func runTestWithTimer(l *zap.SugaredLogger, path, serviceName, serverURL string, buildFlag bool, lambdaFuncTimeout int, resultsChan chan string) string {
Expand Down Expand Up @@ -134,10 +136,12 @@ func runTest(l *zap.SugaredLogger, path, serviceName, serverURL string, buildFla
uuidWithHyphen := uuid.New().String()
urlSlice := strings.Split(serverURL, ":")
port := urlSlice[len(urlSlice)-1]
RunCommandInDir(l, "sam", []string{"local", "invoke", "--parameter-overrides",
RunCommandInDir(l, "sam", []string{
"local", "invoke", "--parameter-overrides",
"ParameterKey=ApmServerURL,ParameterValue=http://host.docker.internal:" + port,
"ParameterKey=TestUUID,ParameterValue=" + uuidWithHyphen,
"ParameterKey=TimeoutParam,ParameterValue=" + strconv.Itoa(lambdaFuncTimeout)},
"ParameterKey=TimeoutParam,ParameterValue=" + strconv.Itoa(lambdaFuncTimeout),
},
path)
l.Infof("%s execution complete", serviceName)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/elastic/apm-aws-lambda

go 1.22
go 1.23

require (
github.com/aws/aws-sdk-go-v2 v1.36.1
Expand Down
2 changes: 1 addition & 1 deletion logsapi/model/model_json.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"net/http"
"net/http/httptest"
"os"
"regexp"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -439,7 +438,7 @@ func startLogSender(ctx context.Context, q <-chan logsapi.LogEvent, logsapiAddr
return err
}
defer resp.Body.Close()
if resp.StatusCode/100 != 2 { //nolint:usestdlibvars
if resp.StatusCode/100 != 2 {
return fmt.Errorf("received a non 2xx status code: %d", resp.StatusCode)
}
return nil
Expand Down Expand Up @@ -569,8 +568,7 @@ func TestLateFlush(t *testing.T) {
case <-runApp(t, logsapiAddr):
assert.Regexp(
t,
regexp.MustCompile(fmt.Sprintf(".*\n%s.*\n%s", TimelyResponse,
TimelyResponse)), // metadata followed by TimelyResponsex2
fmt.Sprintf(".*\n%s.*\n%s", TimelyResponse, TimelyResponse), // metadata followed by TimelyResponsex2
apmServerInternals.Data,
)
case <-time.After(timeout):
Expand Down
Loading