On Wed, Aug 1, 2018 at 11:16 AM, Manlio Perillo <[email protected]> wrote: > Il giorno mercoledì 1 agosto 2018 19:23:04 UTC+2, Ian Lance Taylor ha > scritto: >> >> On Fri, Jul 27, 2018 at 9:33 PM, Dan Kortschak >> <[email protected]> wrote: >> > >> > That's fine. Though given that a program *can* shell out to `go list >> > std` to get the list of std packages, it seems odd to me that there is >> > not some way of doing that without need to exec a new process. You >> > explained it, but not in a way that makes sense to me. >> >> I'll try to explain it again. >> >> In Go 1.11 the list of standard packages can be found by looking for >> directories under `$GOROOT/src`. We create a package stdpkg that >> returns the list of standard packages. It works fine when using Go >> 1.11. You build a program using Go 1.11 that calls stdpkg. It works >> fine. You install that program in your /usr/bin directory. >> >> Now, for some reason in Go 1.12, we move things around. Now looking >> at `$GOROOT/src` no longer gives you the list of standard packages, >> they've moved somewhere else. We update stdpkg so that it uses the >> new mechanism. >> >> You update your system to use Go 1.12. You use it for a few days. >> Then you run your program, previously built with Go 1.11, previously >> installed in /usr/bin. That program looks at `$GOROOT/src` and >> doesn't find anything, because you are now using Go 1.12. So your >> program fails in some unexpected way. >> >> If your program instead ran `go list`, then it would still work, even >> when built with 1.11, after you update to 1.12. >> > > Then the question: why golint and friends *does not* run `go list`? > Moreover, at least last time I checked, each tool use a slight different > implementation with subtle changes in the command behavior.
Yes, that is likely a bug. As I understand it, the current plan is to change them to use the go/packages package currently under development. That package will invoke the go tool when appropriate. > There is also https://github.com/golang/go/issues/8768. I added a comment there. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
