Skip to content

proposal: cmd/go: warn when go get updates a replaced package #66269

@janisz

Description

@janisz

Proposal Details

Introduction:

The current behavior of go get -u PKG does not adequately handle packages that have been replaced in the go.mod file. This proposal aims to improve the user experience by providing clearer information when a replaced package is encountered during the go get -u operation.

Details:

When a user runs go get -u PKG and PKG has a replacement specified in the go.mod file, the go get command currently does not download the latest version of PKG.

Proposed Enhancement:

Modify the behavior of go get -u to detect when a package has been replaced in the go.mod file.
If PKG is replaced, display a clear message to the user indicating that PKG is not updated due to the replacement.
Provide guidance to the user, suggesting they check the go.mod file for the replacement settings.
Ideally, include a link to documentation that explains how to update replaces in the go.mod file.
The message displayed to the user should be informative and actionable, helping them understand why PKG was not updated and what steps they can take to resolve the issue.

The link provided in the message should direct users to relevant documentation that explains the concept of replaces in the go.mod file and provides instructions on updating them.

Impact:

Improved user experience: Users will receive clearer feedback when attempting to update replaced packages, reducing confusion and frustration.
Better understanding of go.mod functionality: Users will be guided to documentation that helps them understand and manage replaces in the go.mod file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions