Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions go/hack/ensure_swiss_map.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build !goexperiment.swissmap
//go:build !goexperiment.swissmap && !go1.26
Copy link
Member

Choose a reason for hiding this comment

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

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.


/*
Copyright (c) 2009 The Go Authors. All rights reserved.
Expand Down Expand Up @@ -32,7 +32,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// This is invalid Go code, and it will fail to compile if you disable
// Swiss maps when building Vitess. Our runtime memory accounting system
// expects the map implementation in Go 1.24 to be Swiss.
// expects the map implementation in Go 1.24 and 1.25 to be Swiss.
// In Go 1.26 and later, Swiss maps are always enabled.

package hack

Expand Down
Loading