gopls/doc: clarify `go work use`

I felt a bit confused on my first reading of the docs for using `go work`.

It wasn't clear to me if the `tools` argument in `go work use tools tools/gopls` was an alias or a directory name, so I thought this might make it very clear to understand for first time users.

Change-Id: I9c5a04a8928207b53acfb36ce7add8ca5f033d46
GitHub-Last-Rev: 49e125d83e40f06239f3a24c92f16258a25305c3
GitHub-Pull-Request: golang/tools#409
Reviewed-on: https://go-review.googlesource.com/c/tools/+/441415
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
This commit is contained in:
Angus Dippenaar 2022-11-08 16:03:14 +00:00 committed by Robert Findley
parent 003fde144e
commit 9474ca31d0
1 changed files with 5 additions and 3 deletions

View File

@ -34,12 +34,14 @@ your workspace root to the directory containing the `go.work` file.
For example, suppose this repo is checked out into the `$WORK/tools` directory.
We can work on both `golang.org/x/tools` and `golang.org/x/tools/gopls`
simultaneously by creating a `go.work` file:
simultaneously by creating a `go.work` file using `go work init`, followed by
`go work use MODULE_DIRECTORIES...` to add directories containing `go.mod` files to the
workspace:
```
```sh
cd $WORK
go work init
go work use tools tools/gopls
go work use ./tools/ ./tools/gopls/
```
...followed by opening the `$WORK` directory in our editor.