Skip to content

chore(go.mod): remove ineffective replace directives#1155

Merged
joeykchen merged 1 commit intogoplus:devfrom
aofei:go.mod
Jan 19, 2026
Merged

chore(go.mod): remove ineffective replace directives#1155
joeykchen merged 1 commit intogoplus:devfrom
aofei:go.mod

Conversation

@aofei
Copy link
Copy Markdown
Member

@aofei aofei commented Jan 16, 2026

As a library, spx's replace directives have no effect when imported by other Go programs, because spx is not the main module in that context.

As documented in https://go.dev/ref/mod#go-mod-file-replace:

replace directives only apply in the main module's go.mod file and
are ignored in other modules.

As a library, spx's replace directives have no effect when imported by
other Go programs, because spx is not the main module in that context.

As documented in https://go.dev/ref/mod#go-mod-file-replace:

> replace directives only apply in the main module's go.mod file and
> are ignored in other modules.

Signed-off-by: Aofei Sheng <aofei@aofeisheng.com>
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @aofei, 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 streamlines the Go module configuration by removing replace directives from the go.mod files. These directives are explicitly stated by Go documentation to be ineffective for libraries when they are consumed by other modules, as they only apply to the main module's go.mod file. The change eliminates redundant and non-functional configurations, leading to a cleaner and more accurate representation of the project's dependency graph.

Highlights

  • Dependency Management Cleanup: Removed ineffective replace directives from the main go.mod file, as these directives are ignored when the module is used as a library.
  • Codegen Module Cleanup: Removed identical ineffective replace directives from the pkg/gdspx/cmd/codegen/go.mod file.
  • Checksums Update: Updated the go.sum file to reflect the correct module checksums and versions after the removal of the replace directives, ensuring consistency with actual dependencies.

🧠 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.

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
Copy Markdown

@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 correctly removes ineffective replace directives from the go.mod files. For a library project, these directives are ignored when the library is used as a dependency, so removing them makes the development environment better reflect how consumers will use the package. This change improves dependency management and helps prevent discrepancies between developer and consumer environments. The corresponding updates to go.sum are expected and correct. Overall, this is a good maintenance change.

@aofei aofei marked this pull request as ready for review January 16, 2026 07:14
Copilot AI review requested due to automatic review settings January 16, 2026 07:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes ineffective replace directives from go.mod files in the spx library. As documented in the Go modules reference, replace directives only apply in the main module's go.mod file and are ignored when spx is imported as a dependency by other Go programs.

Changes:

  • Removed replace directives from the root go.mod file
  • Removed replace directives from pkg/gdspx/cmd/codegen/go.mod
  • Updated go.sum to reflect natural dependency resolution without replace overrides

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
go.mod Removed 4 replace directives for golang.org/x/* packages
pkg/gdspx/cmd/codegen/go.mod Removed 4 replace directives for golang.org/x/* packages
go.sum Updated checksums to reflect natural dependency versions (golang.org/x/image v0.23.0, golang.org/x/mobile v0.0.0-20220518205345-8578da9835fd, and various transitive dependencies)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@xgopilot
Copy link
Copy Markdown
Contributor

xgopilot bot commented Jan 16, 2026

Code Review Summary

The PR correctly removes ineffective replace directives from library modules. All automated checks pass and the changes align with Go module best practices.

One area for consideration:

cmd/igox/go.mod:36-37 still contains replace directives pinning to the same old versions:

golang.org/x/image => golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d
golang.org/x/mobile => golang.org/x/mobile v0.0.0-20210902104108-5d9a33257ab5

While these are effective in a main module, they create version inconsistency with the rest of the codebase (which now uses newer versions). Consider updating cmd/igox/go.mod for consistency unless there's a specific reason igox requires these older versions.

@joeykchen joeykchen merged commit d9db124 into goplus:dev Jan 19, 2026
7 checks passed
@aofei aofei deleted the go.mod branch January 19, 2026 09:52
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