diff options
| author | Michael Matloob <matloob@golang.org> | 2022-03-16 12:18:56 -0400 |
|---|---|---|
| committer | Michael Matloob <matloob@golang.org> | 2022-03-21 18:00:16 +0000 |
| commit | dc08095e2bad041d4d5b76726e6122e79383d496 (patch) | |
| tree | 87f5634812c29b704934984842049b3077fcbae7 /_content/ref | |
| parent | 927473651d7f0cd255c97d6775a299e03dd7e930 (diff) | |
| download | go-x-website-dc08095e2bad041d4d5b76726e6122e79383d496.tar.xz | |
_content/ref: update the modules reference for GOWORK
The -workfile flag's function has been absorbed by the GOWORK
environment variable. Update the workspaces reference to reflect that.
Also fix an error in the workspaces tutorial.
For golang/go#45713
Change-Id: Id8dc8bb8dc6458d03d7b947ec78d84263d9689e1
Reviewed-on: https://go-review.googlesource.com/c/website/+/393360
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Beth Brown <ecbrown@google.com>
Diffstat (limited to '_content/ref')
| -rw-r--r-- | _content/ref/mod.md | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/_content/ref/mod.md b/_content/ref/mod.md index a4bcfa25..4fd2f388 100644 --- a/_content/ref/mod.md +++ b/_content/ref/mod.md @@ -1088,14 +1088,17 @@ operate on the set of modules determined by the current workspace. and `go get` always operate on a single main module. A command determines whether it is in a workspace context by first examining -the `-workfile` flag. If `-workfile` is set to `off`, the command will be +the `GOWORK` environment variable. If `GOWORK` is set to `off`, the command will be in a single-module context. If it is empty or not provided, the command will search the current working directory, and then successive parent directories, for a file `go.work`. If a file is found, the command will operate in the workspace it defines; otherwise, the workspace will include only the module containing the working directory. -If `-workfile` names a path to an existing file that ends in .work, -workspace mode will be enabled. Any other value is an error. +If `GOWORK` names a path to an existing file that ends in .work, +workspace mode will be enabled. Any other value is an error. You can use the +`go env GOWORK` command to determine which `go.work` file the `go` command +is using. `go env gowork` will be empty if the `go` command is not in workspace +mode. ### `go.work` files {#go-work-file} @@ -1446,11 +1449,6 @@ commands accept the following flags, common to all module commands. `-modfile` is specified, an alternate `go.sum` file is also used: its path is derived from the `-modfile` flag by trimming the `.mod` extension and appending `.sum`. -* The `-workfile` flag instructs the `go` command to enter workspace mode using the provided - [`go.work` file](#go-work-file) to define the workspace. If `-workfile` is - set to `off` workspace mode is disabled. If `-workfile` is not provided the - `go` command will search for a `go.work` file as described in the - [Workspaces](#workspaces) section. ### Vendoring {#vendoring} @@ -4325,6 +4323,20 @@ GOSUMDB="sum.golang.org+<publickey> https://sum.golang.org" </p> </td> </tr> + <tr> + <td><code>GOWORK</code></td> + <td> + <p> + The `GOWORK` environment variable instructs the `go` command to enter workspace + mode using the provided [`go.work` file](#go-work-file) to define the workspace. + If `GOWORK` is set to `off` workspace mode is disabled. This can be used to run + the `go` command in single module mode: for example, `GOWORK=off go build .` builds + the `.` package in single-module mode.`If `GOWORK` is empty, the + `go` command will search for a `go.work` file as described in the [Workspaces](#workspaces) + section. + </p> + </td> + </tr> </tbody> </table> |
