diff --git a/.github/workflows/pipeline.yaml b/.github/workflows/pipeline.yaml index be4bbff..bebf14a 100644 --- a/.github/workflows/pipeline.yaml +++ b/.github/workflows/pipeline.yaml @@ -30,6 +30,7 @@ env: # prod "sam package" and "sam deploy" commands. # PROD_IMAGE_REPOSITORY = '0123456789.dkr.ecr.region.amazonaws.com/repository-name' PROD_REGION: us-east-1 + GOEXPERIMENT: loopvar # https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-cloud-providers permissions: diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index d6010cb..b03e92a 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -2,6 +2,9 @@ name: Run Tests on: [workflow_call, pull_request] +env: + GOEXPERIMENT: loopvar + jobs: ci: name: "Run Tests" diff --git a/.vscode/settings.json b/.vscode/settings.json index b2a7cf0..f511174 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,6 @@ { - "go.buildTags": "all_tests" + "go.buildTags": "all_tests", + "go.testEnvVars": { + "GOEXPERIMENT": "loopvar" + } } diff --git a/Makefile b/Makefile index cdee7f6..0e5620d 100644 --- a/Makefile +++ b/Makefile @@ -10,29 +10,30 @@ SHELL := /bin/bash # https://github.com/aws-samples/sessions-with-aws-sam/tree/master/go-al2 # https://aws.amazon.com/blogs/compute/migrating-aws-lambda-functions-from-the-go1-x-runtime-to-the-custom-runtime-on-amazon-linux-2/ build-Function: - GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-s -w" \ - -tags lambda.norpc -o $(ARTIFACTS_DIR)/bootstrap lambda/main.go + GOEXPERIMENT=loopvar GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build \ + -ldflags="-s -w" -tags lambda.norpc \ + -o $(ARTIFACTS_DIR)/bootstrap lambda/main.go static-checks: go vet -tags=all_tests ./... go run honnef.co/go/tools/cmd/staticcheck -tags=all_tests ./... - go build -tags=all_tests ./... + GOEXPERIMENT=loopvar go build -tags=all_tests ./... small-tests: - go test -tags=small_tests ./... + GOEXPERIMENT=loopvar go test -tags=small_tests ./... medium-tests: - go test -tags=medium_tests -count=1 ./... + GOEXPERIMENT=loopvar go test -tags=medium_tests -count=1 ./... contract-tests-aws: - go test -tags=contract_tests -count=1 ./db -args -awsdb + GOEXPERIMENT=loopvar go test -tags=contract_tests -count=1 ./db -args -awsdb test: static-checks small-tests medium-tests contract-tests-aws coverage: - go test -covermode=count -coverprofile=coverage.out \ + GOEXPERIMENT=loopvar go test -covermode=count -coverprofile=coverage.out \ -tags=small_tests,coverage_tests ./... - go tool cover -html=coverage.out + GOEXPERIMENT=loopvar go tool cover -html=coverage.out sam-build: template.yml sam validate