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

x/vgo: package/version set explicitly in go.mod is removed when running vgo build #25547

Closed
dlsniper opened this issue May 24, 2018 · 2 comments

Comments

@dlsniper
Copy link
Contributor

commented May 24, 2018

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

I'm using vgo @ 69d657270ed243a47e733d2f6546e619907cfe4b
go version go1.10.1 linux/amd64 vgo:2018-02-20.1

Does this issue reproduce with the latest release?

yes

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

GOHOSTARCH=amd64
GOHOSTOS=windows

What did you do?

I'm running vgo build in this application sample github.com/dlsniper/depapp (this is placed still inside $GOPATH) and github.com/sirupsen/logrus v1.0.5 gets removed from go.mod file.

What did you expect to see?

I would expect that if the user explicitly specifies a dependency and version, then the version is still kept there (or upgraded if needed), not removed.

Removing this has the potential to create needless churn in VCS history as new dependencies are added and vgo build runs. It's also a surprising behavior to see this happen, even if the same package version is inferred by the tool.

What did you see instead?

The dependency was removed from the file.

@gopherbot gopherbot added this to the vgo milestone May 24, 2018

@rsc

This comment has been minimized.

Copy link
Contributor

commented May 24, 2018

Sorry, but as you appear to know already, this is working as intended. Minimizing go.mod has many positive benefits once you understand that's what is happening.

@rsc rsc closed this May 24, 2018

@dlsniper

This comment has been minimized.

Copy link
Contributor Author

commented May 24, 2018

The reason I opened this is that I was confused for a few minutes as to what's happening and why.

As I wrote the file by hand, I am expecting that go build won't change it in this way. I would expect the version to be upgraded if needed, but not entirely removed.

So, I think others would be equally confused about this property. I would rather avoid this surprising behavior and introduce this as a clean-up functionality to vgo list -cleanup or similar.

I would ask to either reconsider this or at least keeping it open for a little longer to see if others face a similar situation.

Thank you.

@golang golang locked and limited conversation to collaborators May 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.