golang/go

cmd/go: refactor into multiple packages

rsc opened this issue ยท 24 comments

rsc commented

It would help to split the go command into some packages,
in particular to separate out package loading from package building.
I have a plan and will send CLs at the start of Go 1.9
to try to get ahead of any possible merge conflicts.

CLs will be attached to this issue.

mvdan commented

Would this cover the need for https://github.com/kisielk/gotool?

CL https://golang.org/cl/36192 mentions this issue.

CL https://golang.org/cl/36129 mentions this issue.

CL https://golang.org/cl/36193 mentions this issue.

CL https://golang.org/cl/36203 mentions this issue.

CL https://golang.org/cl/36195 mentions this issue.

CL https://golang.org/cl/36191 mentions this issue.

CL https://golang.org/cl/36204 mentions this issue.

CL https://golang.org/cl/36200 mentions this issue.

CL https://golang.org/cl/36199 mentions this issue.

CL https://golang.org/cl/36202 mentions this issue.

CL https://golang.org/cl/36194 mentions this issue.

CL https://golang.org/cl/36196 mentions this issue.

CL https://golang.org/cl/36190 mentions this issue.

CL https://golang.org/cl/36198 mentions this issue.

CL https://golang.org/cl/36201 mentions this issue.

CL https://golang.org/cl/36197 mentions this issue.

mvdan commented

Would this cover the need for https://github.com/kisielk/gotool?

All the new packages are internal, so it seems like it won't replace gotool just yet.

rsc commented

There is no intent to expose the internals of the go command for direct import by programs that want to behave like it. I would prefer if those programs invoked the go command to find out what they need to find out: the API is the binary itself, not the Go package. Using the binary means that when some detail of the go command changes, all those other tools don't need to be updated. I'd be happy to talk about what those tools need.

mvdan commented

@rsc this sounds like a good idea. Should I open a separate issue and ping people who'll probably be interested?

rsc commented

Sure, please open a new issue 'cmd/go: define command-line API for tools' and please list there the kinds of things your tools need to find out from the go command. Thanks.

I'm very happy about this happening. I've been considering making a proposal and try to motivate doing exactly this. ๐Ÿ‘

I'll also mention #11490 here - that issue might be worth revisiting and updating now that this is happening, since it's relevant.

This happened.

Change https://golang.org/cl/59430 mentions this issue: cmd/go/internal/load: fix IsMetaPackage function name in doc