Skip to content

Enable go 1.27 support - #52

Merged
RaduBerinde merged 2 commits into
cockroachdb:mainfrom
jprieto-temporal:jprieto/tustpvzympyk
Aug 20, 2026
Merged

Enable go 1.27 support#52
RaduBerinde merged 2 commits into
cockroachdb:mainfrom
jprieto-temporal:jprieto/tustpvzympyk

Conversation

@jprieto-temporal

Copy link
Copy Markdown
Contributor

Adds support for Go 1.27. Follows the pattern of changes in #50.

@cockroach-teamcity

Copy link
Copy Markdown
Member

This change is Reviewable

@RaduBerinde

Copy link
Copy Markdown
Member

Thanks! Did you verify that the aliased structures in the runtime are unchanged (at least the prefix that we're using)?

@RaduBerinde

Copy link
Copy Markdown
Member

Claude checked:

⏺ Verified — and I ran it, not just read it.

Source check (github.com/golang/go @ tag go1.27.0)

internal/abi.Type — field-for-field identical to swiss's rtType: Size_, PtrBytes uintptr; Hash uint32; TFlag, Align_, FieldAlign_, Kind_ uint8; Equal func; GCData
*byte; Str NameOff; PtrToThis TypeOff. (TFlag/NameOff/TypeOff are still uint8/int32/int32; Kind_'s declared type is now abi.Kind, which is uint8 — same size, no
layout effect.)

internal/abi.MapType (src/internal/abi/map.go) — the aliased prefix is unchanged:

type MapType struct {
Type
Key *Type
Elem *Type
Group *Type // swiss calls this Bucket — same position, same type
Hasher func(unsafe.Pointer, uintptr) uintptr
... // GroupSize, KeysOff, KeyStride, ElemsOff, ElemStride, ElemOff, Flags
}

Everything past Hasher was reworked in 1.27 for the mapsplitgroup experiment, but that's all beyond the prefix swiss reads. Note internal/abi/map_swiss.go and the
old OldMapType are gone — there's now just one MapType — so the "prefix of both abi.SwissMapType and abi.OldMapType" comment in swiss is stale.

runtime.eface — still {_type *_type; data unsafe.Pointer}.

runtime.fastrand64 — still exists as a push-linknamed compat shim (src/runtime/rand.go:341, //go:linkname legacy_fastrand64 runtime.fastrand64), so swiss's pull
linkname remains legal under the 1.23+ linkname restrictions.

Empirical check

Pulled the real go1.27.0 toolchain from the module proxy and ran swiss against it with -tags untested_go_version:

  • Full suite: ok (plain, and -race -tags invariants).
  • A layout test I added (/tmp/claude-503/swiss/runtime_layout_check_test.go) that cross-checks the aliased fields against reflect ground truth for 8 key types:
    rtEface.typ == the *abi.Type reflect reports for the map type; Size_/Align_/FieldAlign_/Kind_ match reflect.Type; Equal == nil, GCData != nil; mt.Key/mt.Elem are
    pointer-identical to typePtr(rt.Key())/typePtr(rt.Elem()) — which pins every offset up to and including Elem; Bucket/Group is a plausible non-nil type; Hasher is
    callable, deterministic, seed-sensitive, and well-distributed. All pass.
  • Passes under both GOEXPERIMENT=mapsplitgroup and nomapsplitgroup.

Conclusion

Safe to widen the build tag to (go1.20 && !go1.28) || untested_go_version. This was tested on darwin/arm64 only, but since the struct definitions are textually
identical to swiss's copies, the layouts agree on every architecture. Worth also fixing the abi.SwissMapType/abi.OldMapType comment while you're in there.

MovieStoreGuy pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Aug 20, 2026
…s Go 1.27 support (#50383)

#### Description

Pins the govulncheck job's toolchain to `oldstable`. Go 1.27.0 released
and `stable` now resolves to it, but `github.com/cockroachdb/swiss` (an
indirect dependency of
`extension/tailstorage/pebbletailstorageextension` via pebble) does not
build with Go 1.27, so the `govulncheck (extension)` shard fails on
every PR. govulncheck sweeps all modules regardless of ci-scope, which
is why every PR is hit.

A comment marks the pin as temporary, to revert once swiss supports Go
1.27 (upstream fix is open at cockroachdb/swiss#52) and the dependency
is bumped.

#### Link to tracking issue

Closes #50382

#### Testing

- CI on this PR, the govulncheck shards should pass again under
oldstable (1.26), which was green until yesterday

#### Documentation

Not applicable, CI-only change.

#### Authorship

- [x] I, a human, wrote this pull request description myself.
Comment thread .github/workflows/ci.yaml Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you update these matrices to use only 1.24+? Older macos CI builds fail. Also, add fail-fast so all jobs run even if some fail. Here's a diff:

--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -10,14 +10,12 @@ on:
 jobs:
   test:
     strategy:
+      fail-fast: false
       matrix:
         os:
           - ubuntu-latest
           - macos-latest
         go:
-          - '1.21'
-          - '1.22'
-          - '1.23'
           - '1.24'
           - '1.25'
           - '>=1.26.0-rc.1'
@@ -36,6 +34,7 @@ jobs:
 
   linux-noswissmap:
     strategy:
+      fail-fast: false
       matrix:
         go:
           - '1.24'
@@ -54,6 +53,7 @@ jobs:
   linux-race:
     runs-on: ubuntu-latest
     strategy:
+      fail-fast: false
       matrix:
         go:
           - '1.24'
@@ -73,6 +73,7 @@ jobs:
   linux-32bit:
     runs-on: ubuntu-latest
     strategy:
+      fail-fast: false
       matrix:
         go:
           - '1.24'
@@ -91,6 +92,7 @@ jobs:
   linux-qemu-s390x:
     runs-on: ubuntu-latest
     strategy:
+      fail-fast: false
       matrix:
         go:
           - '1.24.4'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. Thank you!

@RaduBerinde RaduBerinde left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@RaduBerinde
RaduBerinde merged commit 3334444 into cockroachdb:main Aug 20, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants