What version of Go are you using (go version)?

$ go version
go version go1.25rc2 darwin/arm64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/bmizerany/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/bmizerany/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/db/svmm3t1x3yn4d1skpbq3ddv00000gn/T/go-build3403534159=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/bmizerany/src/foo/go.mod'
GOMODCACHE='/Users/bmizerany/go/pkg/mod'
GONOPROXY='github.com/ollama/*'
GONOSUMDB='github.com/ollama/*'
GOOS='darwin'
GOPATH='/Users/bmizerany/go'
GOPRIVATE='github.com/ollama/*'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/bmizerany/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25rc2.darwin-arm64'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTELEMETRYDIR='/Users/bmizerany/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/bmizerany/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25rc2.darwin-arm64/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.25rc2'
GOWORK=''
PKG_CONFIG='pkg-config'
GOROOT/bin/go version: go version go1.25rc2 darwin/arm64
GOROOT/bin/go tool compile -V: compile version go1.25rc2
uname -v: Darwin Kernel Version 24.5.0: Tue Apr 22 19:52:00 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6031
ProductName:        macOS
ProductVersion:     15.5
BuildVersion:       24F74
lldb --version: lldb-1700.0.9.502
Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)

What did you do?

; go env -w GOEXPERIMENT=jsonv2
; go version

What did you expect to see?

The go version printed to stdout.

What did you see instead?

Given this package:

-- go.mod --
module example

go 1.25rc2
-- example.go --
package main

func main() { println("hello world") }

The panic is reproduced like:

; go env -w GOEXPERIMENT=jsonv2
; go version                        
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x3 pc=0x103246bf0]

goroutine 1 [running]:
cmd/go/internal/fips140.Init()
    cmd/go/internal/fips140/fips140.go:117 +0x120
cmd/go/internal/modload.Init()
    cmd/go/internal/modload/init.go:419 +0x38
cmd/go/internal/toolchain.Exec({0x14000196690, 0x9})
    cmd/go/internal/toolchain/select.go:356 +0x46c
cmd/go/internal/toolchain.Select()
    cmd/go/internal/toolchain/select.go:284 +0xf28
main.main()
    cmd/go/main.go:107 +0x58

NOTE: This also happens for go env, go build, etc..

If I unset the env var (using the toolchain of a previous version of Go), it fixes the issue:

; go1.23.4 env -w GOEXPERIMENT=
; go version
go version go1.25rc2 darwin/arm64

If I move outside of the package directory (say ~), I see, unsurprisingly:

; go version
go: unknown GOEXPERIMENT jsonv2

Comment From: bmizerany

With go1.25rc2 in my path (built from source) things work as expected in and out of a go.mod directory:

; go env -w GOEXPERIMENT=jsonv2
; go version
go version go1.25rc2 darwin/arm64

Comment From: gabyhelp

Related Issues

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

Comment From: fengyoulin

Based on the line numbers in the panic stack trace you provided, it looks like your toolchain isn't built against the latest 1.25rc2 code. Otherwise, this issue should have been fixed in https://go.dev/cl/680976.

Comment From: fengyoulin

This may be a duplicate of #74111.

Comment From: bmizerany

Based on the line numbers in the panic stack trace you provided, it looks like your toolchain isn't built against the latest 1.25rc2 code. Otherwise, this issue should have been fixed in https://go.dev/cl/680976.

Correct. The toolchain I was building with was go1.24.4. I realize now go1.24.5 was released and I was behind on that.

I've confirmed bumping from minor release 4 to 5 fixes the issue:

; go1.24.5 version 
go version go1.25rc2 darwin/arm64

Thank you. Closing.