Thanks, Ian. That makes sense now. It's irritating, but it makes sense.

Relatedly, is there a way to get the output of `go list std` as though
it were a JSON array. It looks to me like this is not possible, at
least, not without all the other information from the documented
struct.

Dan

On Wed, 2018-08-01 at 10:22 -0700, Ian Lance Taylor wrote:
> 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.
> 
> 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.

Reply via email to