From 9474ca31d0dfcd484dd82608705ea967a1b9a71d Mon Sep 17 00:00:00 2001 From: Angus Dippenaar Date: Tue, 8 Nov 2022 16:03:14 +0000 Subject: [PATCH] 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 gopls-CI: kokoro Reviewed-by: Suzy Mueller Reviewed-by: Robert Findley Run-TryBot: Robert Findley --- gopls/doc/workspace.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gopls/doc/workspace.md b/gopls/doc/workspace.md index cb166131fb..4ff9994f93 100644 --- a/gopls/doc/workspace.md +++ b/gopls/doc/workspace.md @@ -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.