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: get get -u all fails! #18859

Closed
jD91mZM2 opened this issue Jan 30, 2017 · 9 comments
Closed

cmd/go: get get -u all fails! #18859

jD91mZM2 opened this issue Jan 30, 2017 · 9 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@jD91mZM2
Copy link

Please answer these questions before submitting your issue. Thanks!

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

go version go1.7.4 linux/amd64

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

Linux Mint (linux), AMD64

What did you do?

I had an old version of a library. I was going to update it.
I ran go get -u all

What did you expect to see?

The plugin updated.

What did you see instead?

That changes would be overwritten, and "Please, commit your changes or stash them before you can merge" and abort. I had to reinstall".
No update was applied
To update I had to uninstall and reinstall the dependency

@ALTree ALTree changed the title go get -u all fails! cmd/go: get get -u all fails! Jan 30, 2017
@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 30, 2017
@ALTree
Copy link
Member

ALTree commented Jan 30, 2017

Is this a one-time failure or you can reproduce this reliably? If it's the latter, can you provide instructions on how to reproduce the failure?

Was the repository that triggered the failure in a strange state? Did you have uncommited changes?

@bradfitz
Copy link
Contributor

Sounds like you had manually modified a package's source and git is complaining that it would lose your changes if go get updated that git repo.

There's not enough information here to help you, but it sounds like it did the right thing and protected you from losing your modifications.

For questions about Go, see https://golang.org/wiki/Questions.

If you have a reproducible bug report, or more details, feel free to reopen.

@jD91mZM2
Copy link
Author

I did not modify the source, though... And there should really be some flag to overwrite any conflicts either way. While I cannot reproduce it for you, Googling the error message shows some extra git commands you should run to overwrite...

@ALTree
Copy link
Member

ALTree commented Jan 31, 2017

I did not modify the source

But git says the source was modified and if we can't reproduce this there's no way to debug a possible problem / tell if go get -u is doing something wrong.

And there should really be some flag to overwrite any conflicts either way

I don't think a flag is needed. Note that you don't need to delete the dependency to fix the problem: just run git stash as the warning suggested and the go get again.

@jD91mZM2
Copy link
Author

jD91mZM2 commented Jan 31, 2017

Oh... I am a giant idiot. I never even tried running the commands because I thought it would be more complicated than that... Never really used Git.

Thanks for everything =)

@jD91mZM2
Copy link
Author

jD91mZM2 commented Feb 2, 2017

It happened again. I did NO changes to the thing, at least not myself (thinking if some third party app did. Really doubt it though.). Running git stash gives an error, because in the directroy I am in, there is no .git file.

I can confirm cding to the right directory (as shown by the go get tool), and then running git stash works.

@eduncan911
Copy link

Most (if not all) dependency managers put your dependencies into a disconnected Head state (for non-git gurus, this means it changes the branch from master).

IOW, does this look similar to your workflow?

$ godep restore
$ go build

This basically will break any full go get -u all or any mass updating technique, such as with gostatus and tooling. This is especially true for older versions of Go.

Instead, you should be using the latest version of Go (1.6+) and:

$ mkdir vendor
$ godep save
$ godep go build

This resolved all my issues over the last few years across various dev machines and VMs that all started around Go 1.1 or 1.2 and I keep upgrading them. Kind of a PITA during this transition actually.

@jD91mZM2
Copy link
Author

Mine worked after stashing them a second time. It hasn't asked me again so far.

@eduncan911
Copy link

eduncan911 commented Feb 19, 2017

I suspect you have a tool or your workflow has some scripting that keeps attempting to restore certain versions of those repos. It's a lot more common than you think: I've even seen Makefiles have godep restore right smack in the middle of 3rd party packages. shakes head

Anyhow.. Before running git stash next time:

  1. tell us what repo(s) keeps showing issues.
  2. change to a few of them, and run git status and paste an output or two from a couple.

If number 2 shows them in an detached head state, then my theory is correct - you have some tooling that keeps attempting to restore them. Dig into each step of your projects and find it and fix it.

If it indeed shows modified files, then perhaps some installer tooling is running a Makefile or some other installation tool and modifying sources. But git status will tell us that as well.

Either way, it is something on your system and/or in your daily workflow that keeps modifying them.

In the end, you are going to have to find it, fix it, and move on.

@golang golang locked and limited conversation to collaborators Feb 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge 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