Skip to content

Commit 4d205d8

Browse files
committed
gopls/doc: add instructions for using go.work with the Go distribution
Following the discovery of golang/go#59429, we should have more detailed instructions for how to use a `go.work` file with the Go distribution. Change-Id: I9aab204832cfc08016f4f3c53cbe7195e23cf21c Reviewed-on: https://go-review.googlesource.com/c/tools/+/482016 gopls-CI: kokoro <[email protected]> Reviewed-by: Alan Donovan <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Robert Findley <[email protected]>
1 parent d5076cc commit 4d205d8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

gopls/doc/advanced.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ You can achieve this by adding the right version of `go` to your `PATH`
4242
(`export PATH=$HOME/go/bin:$PATH` on Unix systems) or by configuring your
4343
editor.
4444

45+
To work on both `std` and `cmd` simultaneously, add a `go.work` file to
46+
`GOROOT/src`:
47+
48+
```
49+
cd $(go env GOROOT)/src
50+
go work init . cmd
51+
```
52+
53+
Note that you must work inside the `GOROOT/src` subdirectory, as the `go`
54+
command does not recognize `go.work` files in a parent of `GOROOT/src`
55+
(https://go.dev/issue/59429).
56+
4557
## Working with generic code
4658

4759
Gopls has support for editing generic Go code. To enable this support, you need
@@ -55,7 +67,6 @@ $ go install golang.org/x/tools/gopls@latest
5567

5668
It is strongly recommended that you install the latest version of `gopls`, or
5769
the latest **unstable** version as [described above](#installing-unreleased-versions).
58-
We're still working on improving our generics support.
5970

6071
The `gopls` built with these instructions understands generic code. See the
6172
[generics tutorial](https://go.dev/doc/tutorial/generics) for more information

0 commit comments

Comments
 (0)