Description
The new workspace feature looks like a great thing, but the only helpful documentation is the design doc. The output from go help
is barely rudimentary.
Look at where we start:
% go help work
Go workspace provides access to operations on workspaces.
Note that support for workspaces is built into many other commands,
not just 'go work'.
See 'go help modules' for information about Go's module system of
which workspaces are a part.
A workspace is specified by a go.work file that specifies a set of
module directories with the "use" directive. These modules are used
as root modules by the go command for builds and related operations.
A workspace that does not specify modules to be used cannot be used
to do builds from local modules.
To determine whether the go command is operating in workspace mode,
use the "go env GOWORK" command. This will specify the workspace
file being used.
Usage:
go work <command> [arguments]
The commands are:
edit edit go.work from tools or scripts
init initialize workspace file
sync sync workspace build list to modules
use add modules to workspace file
Use "go help work <command>" for more information about a command.
It doesn't even say what a workspace is. It does kinda say how to make one, and hints at what it means, but it's just not good enough. The final sentence of the one substantive paragraph is unintelligible out of context.
What do they do? Why do I want one? Can I have more than one? What defines a workspace? etc. etc. The second sentence says they are so important they are implemented all over the place. What does that even mean and is it relevant?
The tip to go help modules
is probably necessary but contains no direct information about workspaces and is itself a huge topic.
The individual commands add little:
% go help work use
usage: go work use [-r] [moddirs]
Use provides a command-line interface for adding directories,
optionally recursively, to a go.work file.
The -r flag searches recursively for modules in the argument directories.
%
From the go help
output alone I cannot understand this feature, what it is, what it solves, whether I should use it or not, and how to use it. Such an important new feature needs proper documentation support in the help system.