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

Open
TwiN opened this issue Nov 24, 2021 · 1 comment
Open

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

TwiN opened this issue Nov 24, 2021 · 1 comment

Comments

@TwiN
Copy link

@TwiN 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
Copy link
Contributor

@heschi heschi commented Nov 24, 2021

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants