Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a standardized way to manage and retrieve variable kinds across different Go versions. It adds Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces SetVarKind and VarKind functions to handle variable kinds, with build-tag-based implementations for Go 1.25+ and older versions. This is a good approach for managing version-specific logic. My review includes suggestions to improve robustness and maintainability. Specifically, for the Go 1.25+ implementation, I recommend aliasing constants from the go/types package instead of redefining them to avoid potential inconsistencies. For the legacy implementation, I've pointed out an opportunity to reduce code duplication and to replace a magic number with a named constant for better readability.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #594 +/- ##
==========================================
+ Coverage 94.07% 94.10% +0.02%
==========================================
Files 28 29 +1
Lines 7331 7364 +33
==========================================
+ Hits 6897 6930 +33
Misses 358 358
Partials 76 76 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The PR introduces
The constant re-declaration in |
|
Good direction — the
|
1474ec2 to
c794f82
Compare
aofei
left a comment
There was a problem hiding this comment.
There is also an additional inconsistency outside this diff: CodeBuilder.NewAutoVar in codebuild.go still creates a bare types.NewVar, so function-local declarations created through that builder keep the default PackageVar on Go 1.25+ instead of LocalVar.
Replace `gogen` and `xgo` with pseudo-versions that expose the new variable kind metadata and use it throughout the server. This distinguishes receivers, parameters, named results, and local variables in semantic tokens and spx definitions while keeping field checks on `IsField()` where that API is clearer. Add regression tests for `TypeInfo`, semantic tokens, hover overviews, and spx definitions. Updates goplus/gogen#594 Updates goplus/xgo#2665 Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
This distinguishes receivers, parameters, named results, and local variables in semantic tokens and spx definitions while keeping field checks on `IsField()` where that API is clearer. Add regression tests for `TypeInfo`, semantic tokens, hover overviews, and spx definitions. Updates goplus/gogen#594 Updates goplus/xgo#2665 Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
8d2fc68 to
103aebc
Compare
da47c9c to
2e4483b
Compare
package main
import (
"fmt"
"go/token"
"go/types"
"github.com/goplus/gogen"
)
func main() {
pkg := gogen.NewPackage("", "main", nil)
cb := pkg.NewFunc(nil, "main", nil, nil, false).BodyStart(pkg)
var auto *types.Var
cb.NewAutoVar(token.NoPos, token.NoPos, "auto", &auto)
cb.NewVar(types.Typ[types.Int], "normal")
normal := cb.Scope().Lookup("normal").(*types.Var)
fmt.Printf("auto: pkg.VarKind=%v, go/types.Kind=%v\n", pkg.VarKind(auto), auto.Kind())
fmt.Printf("normal: pkg.VarKind=%v, go/types.Kind=%v\n", pkg.VarKind(normal), normal.Kind())
}Should |
implement goplus/xgo#2663