Go: Update to 1.27 - #22042
Merged
Merged
Conversation
jketema
force-pushed
the
jketema/go-1.27
branch
3 times, most recently
from
June 30, 2026 15:20
f0842b5 to
91e1d28
Compare
owen-mc
reviewed
Jul 2, 2026
jketema
force-pushed
the
jketema/go-1.27
branch
7 times, most recently
from
July 14, 2026 12:10
ecdd643 to
48c57e3
Compare
jketema
force-pushed
the
jketema/go-1.27
branch
from
August 19, 2026 21:07
48c57e3 to
072b298
Compare
owen-mc
approved these changes
Aug 19, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates CodeQL’s Go support to Go 1.27, including generic method extraction.
Changes:
- Updates SDK, toolchain, CI, and supported-version documentation.
- Handles Go 1.27 generic method type parameters and receivers.
- Adds generic method fixtures and expected results.
Show a summary per file
| File | Description |
|---|---|
MODULE.bazel |
Pins Go SDK 1.27.0. |
go/extractor/go.mod |
Updates Go and toolchain versions. |
go/extractor/extractor.go |
Handles instantiated generic method parameters. |
go/extractor/trap/labels.go |
Resolves originating receiver objects. |
go/extractor/autobuilder/build-environment.go |
Raises maximum supported Go version. |
go/extractor/toolchain/toolchain_test.go |
Applies Go 1.27 formatting. |
go/actions/test/action.yml |
Runs tests with Go 1.27.0. |
go/ql/test/library-tests/semmle/go/Function/go.mod |
Enables Go 1.27 test syntax. |
go/ql/test/library-tests/semmle/go/Function/genericMethods.go |
Adds generic method fixtures. |
go/ql/test/library-tests/semmle/go/Function/TypeParamType.expected |
Updates type-parameter results. |
go/ql/test/library-tests/semmle/go/Function/getTypeParameter.expected |
Updates declaration results. |
go/ql/test/library-tests/semmle/go/Function/getParameter.expected |
Updates method parameter results. |
go/ql/test/library-tests/semmle/go/Function/GenericFunctionInstantiationExpr.expected |
Updates instantiation results. |
go/ql/lib/change-notes/2026-06-25-go-1.27.md |
Announces Go 1.27 support. |
docs/codeql/reusables/supported-versions-compilers.rst |
Documents Go 1.27 support. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 14/15 changed files
- Comments generated: 1
- Review effort level: Balanced
Comment on lines
+1676
to
+1683
| // As a parent we use the origin method. This suffices, as the name | ||
| // and index of the type parameter in the instantiation will be | ||
| // identical to those of the uninstantiated method, and as only | ||
| // these two properties will be extracted for a type parameter. | ||
| if tp.Method(i) != meth { | ||
| signature := tp.Method(i).Type().(*types.Signature) | ||
| populateTypeParamParents(signature.TypeParams(), meth, false) | ||
| } |
Contributor
Author
There was a problem hiding this comment.
There is indeed an issues here. Consider the following:
type StructWithDependentBound[P any] struct{}
func (*StructWithDependentBound[P]) GenericMethodWithDependentBound[Q ~[]P](x Q) {}
func genericMethodDependentBounds(
withInt StructWithDependentBound[int],
withString StructWithDependentBound[string],
) {
withInt.GenericMethodWithDependentBound([]int{})
withString.GenericMethodWithDependentBound([]string{})
}then
from TypeParamType parameter
select parameter.getParamName(), parameter.getConstraint().pp()produces:
| P | interface { } |
| Q | interface { ~[]P } |
| Q | interface { ~[]int } |
| Q | interface { ~[]string } |
and there are dataset check errors:
[INVALID_KEY_SET] predicate typeparam(@typeparamtype tp, string name, @compositetype bound, @typeparamparentobject parent, int idx, boolean is_from_recv): The key set {parent, idx, is_from_recv} does not functionally determine all fields.
Here is a pair of tuples that agree on the key set but differ at index 2:
Tuple 1 in row 2: (81,"Q",87,52,0,false)
Tuple 2 in row 3: (81,"Q",155,52,0,false)
Relevant element: tp=81
Full ID for 81: @"(53),0,false,Q;typeparamtype". The ID may expand to @"{@"{@"{@"(50)"},GenericMethodWithDependentBound;method"}"},0,false,Q;typeparamtype"
Relevant element: Tuple 1: bound=87
Full ID for 87: @";(86);interfacetype". The ID may expand to @";{@"{@"~{@"(83)"};typesetliteraltype"}"};interfacetype"
Relevant element: Tuple 2: bound=155
Full ID for 155: @";(154);interfacetype". The ID may expand to @";{@"{@"~{@"(147)"};typesetliteraltype"}"};interfacetype"
Relevant element: parent=52
Full ID for 52: @"(51),GenericMethodWithDependentBound;method". The ID may expand to @"{@"{@"{@"(47)"};pointertype"}"},GenericMethodWithDependentBound;method"
[INVALID_KEY] predicate typeparam(@typeparamtype tp, string name, @compositetype bound, @typeparamparentobject parent, int idx, boolean is_from_recv): The key set {tp} does not functionally determine all fields.
Here is a pair of tuples that agree on the key set but differ at index 2:
Tuple 1 in row 2: (81,"Q",87,52,0,false)
Tuple 2 in row 3: (81,"Q",155,52,0,false)
Relevant element: tp=81
Full ID for 81: @"(53),0,false,Q;typeparamtype". The ID may expand to @"{@"{@"{@"(50)"},GenericMethodWithDependentBound;method"}"},0,false,Q;typeparamtype"
Relevant element: Tuple 1: bound=87
Full ID for 87: @";(86);interfacetype". The ID may expand to @";{@"{@"~{@"(83)"};typesetliteraltype"}"};interfacetype"
Relevant element: Tuple 2: bound=155
Full ID for 155: @";(154);interfacetype". The ID may expand to @";{@"{@"~{@"(147)"};typesetliteraltype"}"};interfacetype"
Relevant element: parent=52
Full ID for 52: @"(51),GenericMethodWithDependentBound;method". The ID may expand to @"{@"{@"{@"(47)"};pointertype"}"},GenericMethodWithDependentBound;method"
Copilot's proposed fix is not near being correct.
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note that all tests failing here pass on the internal PR.