Skip to content

Commit 7a81336

Browse files
build: disable the jsonv2 GOEXPERIMENT
Go 1.27 enables the jsonv2 experiment by default, reimplementing encoding/json and making json.RawMessage an alias for jsontext.Value. The repo inherited this from #122, which bumped the go directive from 1.26.6 to 1.27.0 -- that directive is a minimum toolchain requirement, so GOTOOLCHAIN =auto then builds everything with go1.27 and its default experiments. This emulator serializes customer Lambda payloads, so swapping JSON implementation should be a deliberate, tested decision rather than a side effect of a toolchain bump. Pin it off for now. There is no GODEBUG opt-out -- jsonv2 is selected at compile time via build tags -- so it must be an environment variable. Exporting it from the Makefile covers local builds, the docker targets (which re-enter this Makefile in the container) and CI, which invokes only make targets. Fixes the localstack branch, red since Aug 22, without touching the upstream test that the experiment broke.
1 parent 7ec133c commit 7a81336

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
11
# LOCALSTACK CHANGES 2022-03-10: remove linker flags and add gc flags for delve debugger
22
# LOCALSTACK CHANGES 2022-03-28: change compile src folder
33
# LOCALSTACK CHANGES 2022-11-14: add --rm flag to compile-with-docker
4+
# LOCALSTACK CHANGES 2026-08-31: disable the jsonv2 GOEXPERIMENT (see GOEXPERIMENT below)
45

56
# RELEASE_BUILD_LINKER_FLAGS disables DWARF and symbol table generation to reduce binary size
67
#RELEASE_BUILD_LINKER_FLAGS=-s -w
78

9+
# Pin encoding/json to the v1 implementation.
10+
#
11+
# Go 1.27 enables the jsonv2 GOEXPERIMENT by default. It reimplements
12+
# encoding/json and, among other things, makes json.RawMessage an alias for
13+
# jsontext.Value. This emulator serializes customer Lambda payloads, so
14+
# changing JSON implementation is a behavioural change that should be adopted
15+
# deliberately and tested -- not inherited from a toolchain bump. It arrived
16+
# via #122, which moved the go directive from 1.26.6 to 1.27.0; that directive
17+
# is a minimum toolchain requirement, so GOTOOLCHAIN=auto then builds
18+
# everything with go1.27 and its default experiments.
19+
#
20+
# There is no GODEBUG opt-out -- jsonv2 is selected at compile time via build
21+
# tags -- so this has to be an environment variable on every go invocation.
22+
# Exporting it here covers local builds, the docker targets (which re-enter
23+
# this Makefile inside the container) and CI, which runs only make targets.
24+
# Accepted by go1.26 as well, so it is safe on older toolchains.
25+
#
26+
# Remove when adopting jsonv2 is a deliberate, tested decision.
27+
export GOEXPERIMENT := nojsonv2
28+
829
BINARY_NAME=aws-lambda-rie
930
ARCH=x86_64
1031
GO_ARCH_x86_64 := amd64

0 commit comments

Comments
 (0)