Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: go mod tidy -v does not print information about modules removed from go.sum #37924

Closed
SunRunAway opened this issue Mar 18, 2020 · 6 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@SunRunAway
Copy link

SunRunAway commented Mar 18, 2020

What version of Go are you using (go version)?

$ go version
go version go1.14 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

go help mod tidy

usage: go mod tidy [-v]

Tidy makes sure go.mod matches the source code in the module.
It adds any missing modules necessary to build the current module's
packages and dependencies, and it removes unused modules that
don't provide any relevant packages. It also adds any missing entries
to go.sum and removes any unnecessary ones.

The -v flag causes tidy to print information about removed modules
to standard error.

go mod tidy -v
echo $?

What did you expect to see?

Print information about removed modules as the documentation says

What did you see instead?

no information printed.

@bcmills
Copy link
Contributor

bcmills commented Mar 18, 2020

Duplicate of #33284

@bcmills bcmills marked this as a duplicate of #33284 Mar 18, 2020
@bcmills bcmills closed this as completed Mar 18, 2020
@bcmills bcmills reopened this Mar 18, 2020
@bcmills
Copy link
Contributor

bcmills commented Mar 18, 2020

Actually, maybe not. What information did you expect it to print?

Ideally, please provide a code sample, such as a reference to a specific repository and commit, for which go mod tidy removes modules from the dependency graph (as reported by go mod graph) but does not print that those modules have been removed.

@bcmills bcmills changed the title go mod tidy -v does not print information about removed modules cmd/go: go mod tidy -v does not print information about removed modules Mar 18, 2020
@bcmills bcmills added modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Mar 18, 2020
@SunRunAway
Copy link
Author

Hi, @bcmills
Thanks for your reply. Sorry for the lack of information.
Normally when I use go mod tidy -v, it will print the unused package.

For example, this repository (https://github.com/SunRunAway/testgomod) works normally.

[sunrunaway:/tmp/testgomod]$ go mod tidy -v
unused go.uber.org/atomic

But in this repository (https://github.com/SunRunAway/tidb/tree/964f9baa063c5ce282dfeee60678762e0bdc4c46),

When I run go mod tidy -v, it prints nothing but actually removed two line in the go.sum file.

[sunrunaway:...src/github.com/pingcap/tidb]$ git checkout 964f9baa063c5ce282dfeee60678762e0bdc4c46                                                   (964f9baa0) 
HEAD is now at 964f9baa0 build: `make tidy` should reports error
[sunrunaway:...src/github.com/pingcap/tidb]$ git status -s                                                                                           (964f9baa0) 
[sunrunaway:...src/github.com/pingcap/tidb]$ go mod tidy -v                                                                                          (964f9baa0) 
[sunrunaway:...src/github.com/pingcap/tidb]$ git status -s                                                                                          (964f9baa0✱) 
 M go.sum

@bcmills
Copy link
Contributor

bcmills commented Mar 19, 2020

go.sum entries are checksums, not dependencies. (Dependencies are listed in the go.mod file and in the go.mod files of the module versions listed therein.)

go mod tidy only prints information about dependencies removed from the go.mod graph, not the go.sum file.

@bcmills bcmills changed the title cmd/go: go mod tidy -v does not print information about removed modules cmd/go: go mod tidy -v does not print information about modules removed from go.sum Mar 19, 2020
@bcmills bcmills removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 19, 2020
@bcmills
Copy link
Contributor

bcmills commented Mar 19, 2020

As far as I can tell this is working as documented, but please let us know if you have additional detail that may indicate a bug.

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 19, 2020
@bcmills bcmills added this to the Unplanned milestone Mar 19, 2020
@SunRunAway
Copy link
Author

Thank you for your patient explanation. Sorry for bothering you.
Have no other questions.

@golang golang locked and limited conversation to collaborators Mar 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants