Support Go 1.26 and later with Swiss maps always enabled#19088
Support Go 1.26 and later with Swiss maps always enabled#19088mattlord merged 1 commit intovitessio:mainfrom
Conversation
In Go 1.26 and later Swiss maps are enabled by default and there is no more GOEXPERIMENT=noswissmap nor GOEXPERIMENT=swissmap flag either. See: * golang/go@2ae059c * golang/go#54766 Signed-off-by: Štefan Baebler <319826+stefanb@users.noreply.github.com>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
| @@ -1,4 +1,4 @@ | |||
| //go:build !goexperiment.swissmap | |||
| //go:build !goexperiment.swissmap && !go1.26 | |||
There was a problem hiding this comment.
We should flip this flag to goexperiment.swissmap .noswissmap instead of !goexperiment.swissmap which would work also still for 1.26 if the flag is entirely gone?
There was a problem hiding this comment.
Yes, that would be much cleaner, if goexperiment.noswissmap build constraint existed.
GOEXPERIMENT=noswissmap environment setting existed in Go 1.24 and 1.25 to disable swiss maps and was negated mapped to goexperiment.swissmap build constraint. Hence the confusion.
In go 1.26 GOEXPERIMENT=noswissmap is not supported anymore and there is no way to set goexperiment.swissmap build constraint either, so the only option is to check for go1.26 build constraint.
PR ref: * Upstream vitessio/vitess#19088 * #258912
Description
Adjusts Go build flags for ensuring Swiss maps are available to not trigger false positive compile-time errors with Go 1.26 and later.
In Go 1.26 and later Swiss maps are always enabled and cannot be disabled anymore (as was the case in Go 1.24-1.25) and there is no more
GOEXPERIMENT=noswissmapflag. See:Related Issue(s)
Fixes #19087
Checklist
Deployment Notes
N/A
AI Disclosure
No AI was used for preparing this patch.