Skip to content

Conversation

@tsingbx
Copy link

@tsingbx tsingbx commented Nov 5, 2025

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @tsingbx, 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 addresses an issue where the goxls language server was unable to locate the xgo executable, causing functionality problems. The core change involves modifying the language server's startup sequence to prioritize finding xgo and gracefully falling back to gop if xgo is unavailable. Additionally, the .gitignore file has been updated to prevent the inclusion of .vscode configuration files in the repository.

Highlights

  • Language Server Command Lookup Priority: The language server's initialization logic has been updated to first attempt to locate the "xgo" command. If "xgo" is not found, it will then fall back to using the "gop" command, resolving an issue where the language server might fail to find the correct executable.
  • Git Ignore Update: The ".gitignore" file has been updated to include "*/.vscode/", ensuring that VS Code specific configuration directories are not committed to the repository.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to fix an issue where the language server fails to find the xgo command by attempting to locate xgo first and falling back to gop. It also adds the .vscode directory to .gitignore. The .gitignore change is appropriate. However, the logic for falling back from xgo to gop is flawed because the condition to check if xgo was found is incorrect. This will prevent the fallback from ever executing. I've provided a critical comment with a suggested fix to correctly implement the fallback behavior.

Comment on lines 65 to 67
if len(cmd) == 0 {
cmd = lookupCmd("gop")
}

Choose a reason for hiding this comment

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

critical

The condition len(cmd) == 0 to check if xgo was found is incorrect. The lookupCmd function returns the original command name string if the command is not found, so its length will not be zero. Consequently, the fallback to gop will never be triggered.

A better approach is to check if lookupCmd returned an absolute path, which it does on success via exec.LookPath. You can use filepath.IsAbs for this check.

Suggested change
if len(cmd) == 0 {
cmd = lookupCmd("gop")
}
if !filepath.IsAbs(cmd) {
cmd = lookupCmd("gop")
}
Comment on lines 64 to 67
onceInit.Do(func() {
cmd := lookupCmd("gop")
cmd, err := lookupCmd("xgo")
if err != nil {
cmd, _ = lookupCmd("gop")
Copy link

Choose a reason for hiding this comment

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

Critical: Fallback logic is broken

The condition if len(cmd) == 0 will never be true because lookupCmd() returns the command name itself when not found (line 59: return cmd). This means:

  • If "xgo" is not found, lookupCmd("xgo") returns "xgo" (not "")
  • The fallback to "gop" never executes
  • The language server will fail to start when only "gop" is available

Recommended fix:

cmd := lookupCmd("xgo")
// Verify the command actually exists
if _, err := exec.LookPath(cmd); err != nil {
    cmd = lookupCmd("gop")
}

This also fixes the performance issue of potentially calling lookupCmd() twice unnecessarily.

Comment on lines 62 to 67

func Get() langserver.Client {
onceInit.Do(func() {
cmd := lookupCmd("gop")
cmd, err := lookupCmd("xgo")
if err != nil {
cmd, _ = lookupCmd("gop")
}
Copy link

Choose a reason for hiding this comment

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

Missing documentation for behavior change

This change switches from "gop" to "xgo" as the primary language server command, which is a significant behavior change. Please add a comment explaining:

  • Why "xgo" is now preferred over "gop"
  • What the fallback strategy is
  • Impact on users with only "gop" installed

Example:

// Get returns the language server client, initializing it on first call.
// Prefers xgo command over gop for improved functionality.
// Falls back to gop for backward compatibility.
func Get() langserver.Client {
@xgopilot
Copy link

xgopilot bot commented Nov 5, 2025

Review Summary

The .gitignore change looks good. However, there's a critical logic bug in the langserver.go fallback mechanism that prevents it from working as intended. The fallback to "gop" will never execute because lookupCmd() doesn't return an empty string when commands aren't found. Please see inline comments for details and recommended fixes.

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.45%. Comparing base (255da51) to head (71fa4fe).
⚠️ Report is 9 commits behind head on goplus.

Additional details and impacted files
@@           Coverage Diff           @@
##           goplus     #373   +/-   ##
=======================================
  Coverage   46.45%   46.45%           
=======================================
  Files          12       12           
  Lines        1610     1610           
=======================================
  Hits          748      748           
  Misses        784      784           
  Partials       78       78           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant