Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: modules seem to leave the package directory in an inconsistent state sometimes #27952
What did you do?
I am not able to reproduce it consistently, but the company I work at has been using modules for about a week and we run into a variant of this problem fairly frequently.
Here is an aggregate of the various terminals I used when running into the problem most recently. The (pseudo-anonymized) directories are included for each command since I work in a split-screen tmux so not all of the commands were in the same terminal pane.
I attempted to compile a program that had previously used go modules and previously worked. When I built it, it went and found a new version. I thought maybe it couldn't find the older revision because I had cleared out my package cache, but it seems as if the directory it was looking for was mostly empty except for one entry and go modules is unable to recover from this state.
This isn't the first time we have experienced something like this too. I have regularly had to teach people how to clear out their package caches because you have to force all of the directories to be writeable to actually remove the entries inside and we have had compilations fail because a go file was empty or a file that should be there is missing.
I do not have an effective way of reproducing, but I suspect it may be getting caused by Ctrl+C. I have no evidence for this and have no idea if that is true. I don't remember every time I interrupt a command from my terminal, but it seems like it could be plausible.
I have also had it successfully compile once and record the wrong hash inside of the
What did you expect to see?
I expected it to compile without issues and to not look for a new version. If there was a problem with the version that was specified, I expected it to loudly fail and tell me that the hash was wrong rather than to silently upgrade the version I was using.
What did you see instead?
It upgraded the version I was using to an incompatible copy and it did not tell me my local cache state was bad nor did it attempt to fix the cache state by redownloading or reextracting the zip file.
changed the title
go modules: seems to leave the package directory in an inconsistent state sometimes
Oct 1, 2018
I ran into this same issue. I was getting an error message
I cleaned up my local go-github: