Skip to content

Commit

Permalink
_content/ref/mod: document godebug directive
Browse files Browse the repository at this point in the history
For golang/go#65573.

Change-Id: Ie6b92586d203dd921d86084da84edc4706143fd8
Reviewed-on: https://go-review.googlesource.com/c/website/+/584218
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
  • Loading branch information
rsc authored and gopherbot committed May 15, 2024
1 parent 15db8a6 commit 8589d49
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions _content/ref/mod.md
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,33 @@ Example:
toolchain go1.21.0
```

### `godebug` directive {#go-mod-file-godebug}

A `godebug` directive declares a single [GODEBUG setting](/doc/godebug)
to apply when this module is the main module.
There can be more than one such line, and they can be factored.
It is an error for the main module to name a GODEBUG key that does not exist.
The effect of `godebug key=value` is as if every main package being compiled
contained a source file that listed `//go:debug key=value`.

```
GodebugDirective = "godebug" ( GodebugSpec | "(" newline { GodebugSpec } ")" newline ) .
GodebugSpec = GodebugKey "=" GodebugValue newline.
GodebugKey = GodebugChar { GodebugChar }.
GodebugValue = GodebugChar { GodebugChar }.
GodebugChar = any non-space character except , " ` ' (comma and quotes).
```

Example:

```
godebug default=go1.21
godebug (
panicnil=1
asynctimerchan=0
)
```

### `require` directive {#go-mod-file-require}

A `require` directive declares a minimum required version of a given module
Expand Down Expand Up @@ -1264,6 +1291,14 @@ Example:
toolchain go1.21.0
```

### `godebug` directive {#go-work-file-godebug}

A `godebug` directive declares a single [GODEBUG setting](/doc/godebug)
to apply when working in this workspace.
The syntax and effect is the same as the [`go.mod` file's `godebug` directive](#go-mod-file-godebug).
When a workspace is in use, `godebug` directives in `go.mod` files are ignored.


### `use` directive {#go-work-file-use}

A `use` adds a module on disk to the set of main modules in a workspace.
Expand Down

0 comments on commit 8589d49

Please sign in to comment.