Skip to content

Go: When go.mod version is above maxGoVersion request go.mod version - #22458

Open
jketema wants to merge 1 commit into
github:mainfrom
jketema:jketema/go-max-version
Open

Go: When go.mod version is above maxGoVersion request go.mod version#22458
jketema wants to merge 1 commit into
github:mainfrom
jketema:jketema/go-max-version

Conversation

@jketema

@jketema jketema commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

We currently block analysis of projects that target a Go version that is too new. If we do not do this, we get an error like the following when the user has not selected the correct Go toolchain in their workflow:

Error running go tooling: err: exit status 1: stderr: go: go.mod requires go >= 1.27 (running go 1.26.6; GOTOOLCHAIN=local)

This seems quite strict, as we could just as well download the newer version through the existing mechanisms that we have for this. This PR together with the related internal changes does just that.

Because of the version mismatch we might see some additional parse errors on projects that are too new. Given the number of syntax changes between recent Go versions this seems acceptable. Database quality might be slightly lower, but at least the won't block users until we have updated the extractor.

@jketema
jketema force-pushed the jketema/go-max-version branch 2 times, most recently from fa780b0 to 5502db8 Compare August 28, 2026 10:44
@github-actions github-actions Bot added the Go label Aug 28, 2026
@jketema
jketema force-pushed the jketema/go-max-version branch from 5502db8 to 097d278 Compare September 3, 2026 10:51
@jketema jketema added the depends on internal PR This PR should only be merged in sync with an internal Semmle PR label Sep 3, 2026
@jketema
jketema marked this pull request as ready for review September 3, 2026 12:08
@jketema
jketema requested review from a team as code owners September 3, 2026 12:08
Copilot AI balanced review requested due to automatic review settings September 3, 2026 12:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The reviewed changes have no blocking issues; only a non-blocking naming nit remains.

Review tier: Balanced
Findings: None

What changed in this PR

Updates Go environment resolution to request the version required by go.mod rather than capping it at the extractor’s maximum supported version.

Changes:

  • Revises Go toolchain selection and diagnostics.
  • Expands version-selection test coverage.
  • Updates integration-test expectations for newer Go versions.

Review note: Non-blocking nit in diagnostics.go:458: rename the emitter to include EnvVersionTooHigh and update its caller for API consistency.

File Description
go/​ql/​integration-tests/​diagnostics/​newer-go-version-needed/​build_environment.expected Expects the newer Go version to be requested.
go/​extractor/​diagnostics/​diagnostics.go Updates toolchain telemetry diagnostics.
go/​extractor/​autobuilder/​build-environment.go Revises Go toolchain selection logic.
go/​extractor/​autobuilder/​build-environment_test.go Tests the revised version-selection scenarios.
Suppressed comments (1)

go/extractor/diagnostics/diagnostics.go:458

  • This sibling uniquely drops Version from EnvVersion, even though it classifies goEnvVersion just like the adjacent emitters. Rename it to EmitGoModVersionTooHighAndEnvVersionTooHigh (and update the caller) to keep the diagnostics API consistent and unambiguous.
func EmitGoModVersionTooHighAndEnvTooHigh(msg string) {

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

depends on internal PR This PR should only be merged in sync with an internal Semmle PR Go

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants