make generate fails under Go 1.27 due to incompatible enumer dependencies
Brief summary
make generate fails under Go 1.27 because the currently pinned enumer implementations depend on versions of golang.org/x/tools that predate Go 1.27's export-data format.
This was exposed by #6398, which changed the generate-check CI job from Go 1.26 to the current version supplied by k6-ci v0.5.0: Go 1.27.
Environment
k6 version: Current master, observed in #6398
OS: Ubuntu GitHub-hosted runner
Go version: Go 1.27.1
Docker version and image: Not applicable
Steps to reproduce the problem
Check out the current k6 source.
Install and select Go 1.27.1.
Run:
make generate
The Makefile installs github.com/mstoykov/[email protected]. Three generators also invoke github.com/dmarkham/[email protected] directly.
The mstoykov/enumer fork was introduced in #4948 on July 18, 2025, replacing alvaroloes/[email protected] because that implementation did not work with Go versions newer than 1.20. PR #4943 subsequently moved the pinned installation into the Makefile.
Expected behaviour
make generate completes successfully and produces no changes when the generated files are current.
Actual behaviour
Multiple enum generators fail while loading imported package type information. Representative errors include:
enumer: internal error: package "github.com/spf13/cobra" without types was imported from "go.k6.io/k6/v2/internal/cmd"
enumer: internal error: package "context" without types was imported from "go.k6.io/k6/v2/internal/event"
enumer: internal error: package "fmt" without types was imported from "go.k6.io/k6/v2/internal/js/modules/k6/experimental/fs"Both enumer implementations are affected:
github.com/mstoykov/[email protected]usesgolang.org/x/toolsv0.35.0.github.com/dmarkham/[email protected]usesgolang.org/x/toolsv0.30.0.
Upstream dmarkham/enumer#124 reports the same Go 1.27 failure and proposes updating golang.org/x/tools to v0.47.0.
grafana/k6#6392 consolidates the remaining direct dmarkham/enumer invocations onto mstoykov/enumer. That simplifies the eventual fix, but does not solve the Go 1.27 incompatibility by itself because the currently pinned mstoykov fork is also affected.
As a temporary measure, #6398 will keep generate-check on k6-ci's previous Go version, currently Go 1.26.x. The other CI jobs can continue using the current and previous versions supplied by k6-ci.
References
- #6398
- #6392
- #4948 — introduced
github.com/mstoykov/[email protected] - #4943 — moved the pinned generator installation into the Makefile
- https://github.com/dmarkham/enumer/pull/124
- Failing job: https://github.com/grafana/k6/actions/runs/34609426257/job/103295888062
Source: grafana/k6