Skip to content

x/website/tour: offline mode fails on generics examples #76932

Description

@haasken-hpe

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:

  1. Install the tour offline: go install golang.org/x/website/tour@latest
  2. Start the local tour: tour
  3. Navigate to the "Type Parameters" lesson under "Generics"
  4. 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

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions