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: "mod tidy" doesn't delete go.sum when go.mod has no dependencies #49772

Closed
TwiN opened this issue Nov 24, 2021 · 2 comments
Closed

cmd/go: "mod tidy" doesn't delete go.sum when go.mod has no dependencies #49772

TwiN opened this issue Nov 24, 2021 · 2 comments
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@TwiN
Copy link

TwiN commented Nov 24, 2021

It's not really a big deal, but I occasionally find myself having to manually delete go.sum files after removing all external dependencies from a project.

Steps to Reproduce

  1. Create a project
  2. Add an external dependency
  3. Execute go mod vendor
  4. Note how go.sum has been created
  5. Remove the external dependency from the code
  6. Execute go mod tidy
  7. Note how the go.sum file is now empty.

Conversely, if you had never added an external dependency and executed go mod vendor, go.sum would have never been created, and the following error would have been displayed instead:

go: no dependencies to vendor

if buf.Len() == 0 {
fmt.Fprintf(os.Stderr, "go: no dependencies to vendor\n")
return
}

@heschi heschi added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. GoCommand cmd/go labels Nov 24, 2021
@heschi heschi added this to the Backlog milestone Nov 24, 2021
@heschi
Copy link
Contributor

heschi commented Nov 24, 2021

cc @matloob @bcmills

@dmitshur
Copy link
Contributor

I suspect this is the same as #36236. (Please comment otherwise.)

@dmitshur dmitshur closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2022
@golang golang locked and limited conversation to collaborators Sep 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge GoCommand cmd/go modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants