-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
golang/website
#341Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
Go version
go version go1.25.5 darwin/arm64
Output of go env in your module/workspace:
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/haasken/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/haasken/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/yq/6fymkty53zg6s1w7xjlppbtc0000gp/T/go-build1247617356=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/Users/haasken/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/haasken/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/haasken/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.25.5'
GOWORK=''
PKG_CONFIG='pkg-config'What did you do?
I'm new to Go, and I'm going through the Tour of Go in offline mode as described in Go offline. I attempted to run the Type parameters code snippet.
Here are the steps I ran:
- Install the tour offline:
go install golang.org/x/website/tour@latest - Start the local tour:
tour - Navigate to the "Type Parameters" lesson under "Generics"
- Attempt to run the example code in the browser
What did you see happen?
Compilation errors:
./prog.go:6:12: type parameter requires go1.18 or later (-lang was set to go1.16; check go.mod)
./prog.go:6:14: predeclared comparable requires go1.18 or later (-lang was set to go1.16; check go.mod)
./prog.go:10:6: invalid operation: v == x (incomparable types in type set)
./prog.go:20:14: implicit function instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
./prog.go:24:14: implicit function instantiation requires go1.18 or later (-lang was set to go1.16; check go.mod)
What did you expect to see?
The generics example should compile and run successfully, printing:
2
-1
Workaround
Adding the following to the beginning of the code snippet is a workaround:
-- go.mod --
module example
go 1.25
-- main.go --Metadata
Metadata
Assignees
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.