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
goutil.Run(), goutil.Install() will potentially use outdated packages. #2
Comments
It also adds the tmp dir to the environment used when the go tool is |
I noticed the double src, and wasn't sure if that was intentional or not. It's still valid, you're basically creating a package named "src" hehe. Adding the tmp dir to GOPATH env var will not help prevent this issue, since the imported (potentially stale) package will likely be inside another GOPATH workspace (i.e. across the GOPATH workspace boundary, as Russ Cox phrased it). So I don't think this issue is fixed.
|
Oh interesting/annoying. I did not know that. I guess it'll have to use -a |
Nice idea, I didn't think of using Personally, I don't see any good reasons why the go tool will use stale libraries if they happen to fall outside the GOPATH workspace your package is in. I thought having multiple GOPATH workspaces was simply an organizational aspect with no such side-effects. Similar to how you can take any Go package and split it into multiple .go files with no weird side-effects. Perhaps we can make a case for it on that issue?
What if you simply have 2 GOPATH workspaces? Then you're still affected. I don't get their logic here. Another potential fix idea I had is to use to create the temporary folder within the user's GOPATH workspace, rather than inside a temporary OS folder. However, if the user has multiple GOPATH workspaces, there's still a chance of using stale libraries. :( |
I'm currently looking at how the Go tool computes what packages are stale. Perhaps we can detect when there are stale imports, and then use This may work, but... it feels like a hack and not the right way to do things, though. :/ |
yeah, it would be nice if that worked as we and others thought it would, I'm trying to think of why go build would intentionally work as it does. |
Yeah, same here. I think we should point out the potential problem with the current approach and inquire about their motivation behind this decision. (Unless I'm missing something,) things would be so much simpler if the go tool always tried to build stale libraries, whether they're in a different GOPATH workspace or not. |
Ugh, I already duplicated build tag parsing and copied the code for If I'm going to go through all that trouble I might as well, find out As long as I'm doing all this I might as well move gostrap into its As for getting an explanation, maybe just a post on the mailing list? |
I've found some explanation in the go source code, where it determines if a package is stale or not:
It links to issue 3149. Reading that stuff now. |
Issue 3149 makes it seem that the reason they did this "don't touch other GOPATH workspaces" was from the era of Go when setting the My proposal would be to only build across other GOPATH workspaces, but never inside GOROOT. I think that'd be quite awesome (and it seems like a very easy fix, no hard implementation work required here).
If you could do that, I'd prefer and appreciate that... I'm feeling tired today lol. |
For reference, the go-nuts thread is here (thanks for making it btw!): https://groups.google.com/forum/#!topic/golang-nuts/Z5uJf6mEF6E Sadly, it's not getting much attention so far (and got hard to find, lol). Btw, since this GH issue is still closed, are you not considering it an issue? |
I forgot I closed it because I was replying to the e-mail notifications. I'm so bad at management things. Thanks for the reminder/bump. I am considering a semi-issue. It's a problem but without a change to the go tool, there's not much to do except throw a lot of code at it and document where it behaves differently. I'd like to fix it but for now the duct tape that is -a will have to do. |
Some progress on the issue. I got the following response from minux on golang-nuts:
|
I think we should do that. I'll try to do that in the next few days. |
I've reposted your (excellent) original post in golang-dev here. |
Woohoo!!! golang/go#10509 has been resolved. Once 1.5 comes out, both this and shurcooL/goexec#3 can be resolved. |
huzzah! |
Hey @jimmyfrasche, Now that Go 1.5 is out, you can resolve this issue very easily. It's just a matter of removing the See shurcooL/goexec#5 for an example of how I resolved it in |
Thanks for the reminder. Finally closed! |
Congratulations! 🎉 🎊 ✨ |
Since the generated .go file resides somewhere in a temporary folder, it is outside the GOPATH boundary, and if a package is built but outdated (i.e. source code has been changed since it was built), the outdated version will be used.
(From shurcooL/goexec#3.)
If I'm not mistaken, this issue affects you too, since you also use ioutil.TempDir with blank
dir
parameter for your temporary GOPATH workspace. So the folder will be somewhere in/tmp
or similar, which will be outside the GOPATH boundary of imports.Any thoughts on this?
The text was updated successfully, but these errors were encountered: