proposal: cmd/go: allow setting runtime godebugs in go.mod / go:debug directives
- Dominant language
- Go
- Stars
- 139k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
### Proposal Details
Now `asyncpreemptoff=1` cannot be specified by `//go:debug`:
```
examples\test\main.go:1:1: invalid //go:debug: unknown //go:debug setting "asyncpreemptoff"
```
However, there are many situations where disabling async preemption is required as a workaround to make applications work correctly:
* https://github.com/golang/go/issues/36981
* https://github.com/golang/go/issues/48059
* https://github.com/golang/go/issues/57442
* https://github.com/golang/go/issues/64781
* https://github.com/golang/go/issues/68485
* https://github.com/golang/go/issues/71242
* https://github.com/hashicorp/terraform/issues/27350
I propose to enable to specify `asyncpreemptoff=1` as `//go:debug` and `godebug` section in go.mod.
Note that it is still possible to specify it by `-ldflags="-X=runtime.godebugDefault=asyncpreemptoff=1"`, but this is pretty hacky.
Contributor guide
Assessment
This issue has not been assessed yet.