| 1 |
--- |
| 2 |
title: "Go, Backwards Compatibility, and GODEBUG" |
| 3 |
layout: article |
| 4 |
--- |
| 5 |
|
| 6 |
<!-- |
| 7 |
This document is kept in the Go repo, not x/website, |
| 8 |
because it documents the full list of known GODEBUG settings, |
| 9 |
which are tied to a specific release. |
| 10 |
--> |
| 11 |
|
| 12 |
## Introduction {#intro} |
| 13 |
|
| 14 |
Go's emphasis on backwards compatibility is one of its key strengths. |
| 15 |
There are, however, times when we cannot maintain complete compatibility. |
| 16 |
If code depends on buggy (including insecure) behavior, |
| 17 |
then fixing the bug will break that code. |
| 18 |
New features can also have similar impacts: |
| 19 |
enabling the HTTP/2 use by the HTTP client broke programs |
| 20 |
connecting to servers with buggy HTTP/2 implementations. |
| 21 |
These kinds of changes are unavoidable and |
| 22 |
[permitted by the Go 1 compatibility rules](/doc/go1compat). |
| 23 |
Even so, Go provides a mechanism called GODEBUG to |
| 24 |
reduce the impact such changes have on Go developers |
| 25 |
using newer toolchains to compile old code. |
| 26 |
|
| 27 |
A GODEBUG setting is a `key=value` pair |
| 28 |
that controls the execution of certain parts of a Go program. |
| 29 |
The environment variable `GODEBUG` |
| 30 |
can hold a comma-separated list of these settings. |
| 31 |
For example, if a Go program is running in an environment that contains |
| 32 |
|
| 33 |
GODEBUG=http2client=0,http2server=0 |
| 34 |
|
| 35 |
then that Go program will disable the use of HTTP/2 by default in both |
| 36 |
the HTTP client and the HTTP server. |
| 37 |
Unrecognized settings in the `GODEBUG` environment variable are ignored. |
| 38 |
It is also possible to set the default `GODEBUG` for a given program |
| 39 |
(discussed below). |
| 40 |
|
| 41 |
When preparing any change that is permitted by Go 1 compatibility |
| 42 |
but may nonetheless break some existing programs, |
| 43 |
we first engineer the change to keep as many existing programs working as possible. |
| 44 |
For the remaining programs, |
| 45 |
we define a new GODEBUG setting that |
| 46 |
allows individual programs to opt back in to the old behavior. |
| 47 |
A GODEBUG setting may not be added if doing so is infeasible, |
| 48 |
but that should be extremely rare. |
| 49 |
|
| 50 |
GODEBUG settings added for compatibility will be maintained |
| 51 |
for a minimum of two years (four Go releases). |
| 52 |
Some, such as `http2client` and `http2server`, |
| 53 |
will be maintained much longer, even indefinitely. |
| 54 |
|
| 55 |
When possible, each GODEBUG setting has an associated |
| 56 |
[runtime/metrics](/pkg/runtime/metrics/) counter |
| 57 |
named `/godebug/non-default-behavior/<name>:events` |
| 58 |
that counts the number of times a particular program's |
| 59 |
behavior has changed based on a non-default value |
| 60 |
for that setting. |
| 61 |
For example, when `GODEBUG=http2client=0` is set, |
| 62 |
`/godebug/non-default-behavior/http2client:events` |
| 63 |
counts the number of HTTP transports that the program |
| 64 |
has configured without HTTP/2 support. |
| 65 |
|
| 66 |
## Default GODEBUG Values {#default} |
| 67 |
|
| 68 |
When a GODEBUG setting is not listed in the environment variable, |
| 69 |
its value is derived from three sources: |
| 70 |
the defaults for the Go toolchain used to build the program, |
| 71 |
amended to match the Go version listed in `go.mod`, |
| 72 |
and then overridden by explicit `//go:debug` lines in the program. |
| 73 |
|
| 74 |
The [GODEBUG History](#history) gives the exact defaults for each Go toolchain version. |
| 75 |
For example, Go 1.21 introduces the `panicnil` setting, |
| 76 |
controlling whether `panic(nil)` is allowed; |
| 77 |
it defaults to `panicnil=0`, making `panic(nil)` a run-time error. |
| 78 |
Using `panicnil=1` restores the behavior of Go 1.20 and earlier. |
| 79 |
|
| 80 |
When compiling a work module or workspace that declares |
| 81 |
an older Go version, the Go toolchain amends its defaults |
| 82 |
to match that older Go version as closely as possible. |
| 83 |
For example, when a Go 1.21 toolchain compiles a program, |
| 84 |
if the work module's `go.mod` or the workspace's `go.work` |
| 85 |
says `go` `1.20`, then the program defaults to `panicnil=1`, |
| 86 |
matching Go 1.20 instead of Go 1.21. |
| 87 |
|
| 88 |
Because this method of setting GODEBUG defaults was introduced only in Go 1.21, |
| 89 |
programs listing versions of Go earlier than Go 1.20 are configured to match Go 1.20, |
| 90 |
not the older version. |
| 91 |
|
| 92 |
To override these defaults, starting in Go 1.23, the work module's `go.mod` |
| 93 |
or the workspace's `go.work` can list one or more `godebug` lines: |
| 94 |
|
| 95 |
godebug ( |
| 96 |
default=go1.21 |
| 97 |
panicnil=1 |
| 98 |
asynctimerchan=0 |
| 99 |
) |
| 100 |
|
| 101 |
The special key `default` indicates a Go version to take unspecified |
| 102 |
settings from. This allows setting the GODEBUG defaults separately |
| 103 |
from the Go language version in the module. |
| 104 |
In this example, the program is asking for Go 1.21 semantics and |
| 105 |
then asking for the old pre-Go 1.21 `panic(nil)` behavior and the |
| 106 |
new Go 1.23 `asynctimerchan=0` behavior. |
| 107 |
|
| 108 |
Only the work module's `go.mod` is consulted for `godebug` directives. |
| 109 |
Any directives in required dependency modules are ignored. |
| 110 |
It is an error to list a `godebug` with an unrecognized setting. |
| 111 |
(Toolchains older than Go 1.23 reject all `godebug` lines, since they do not |
| 112 |
understand `godebug` at all.) When a workspace is in use, `godebug` |
| 113 |
directives in `go.mod` files are ignored, and `go.work` will be consulted |
| 114 |
for `godebug` directives instead. |
| 115 |
|
| 116 |
The defaults from the `go` and `godebug` lines apply to all main |
| 117 |
packages that are built. For more fine-grained control, |
| 118 |
starting in Go 1.21, a main package's source files |
| 119 |
can include one or more `//go:debug` directives at the top of the file |
| 120 |
(preceding the `package` statement). |
| 121 |
The `godebug` lines in the previous example would be written: |
| 122 |
|
| 123 |
//go:debug default=go1.21 |
| 124 |
//go:debug panicnil=1 |
| 125 |
//go:debug asynctimerchan=0 |
| 126 |
|
| 127 |
Starting in Go 1.21, the Go toolchain treats a `//go:debug` directive |
| 128 |
with an unrecognized GODEBUG setting as an invalid program. |
| 129 |
Programs with more than one `//go:debug` line for a given setting |
| 130 |
are also treated as invalid. |
| 131 |
(Older toolchains ignore `//go:debug` directives entirely.) |
| 132 |
|
| 133 |
The defaults that will be compiled into a main package |
| 134 |
are reported by the command: |
| 135 |
|
| 136 |
go list -f '{{.DefaultGODEBUG}}' my/main/package |
| 137 |
|
| 138 |
Only differences from the base Go toolchain defaults are reported. |
| 139 |
|
| 140 |
When testing a package, `//go:debug` lines in the `*_test.go` |
| 141 |
files are treated as directives for the test's main package. |
| 142 |
In any other context, `//go:debug` lines are ignored by the toolchain; |
| 143 |
`go` `vet` reports such lines as misplaced. |
| 144 |
|
| 145 |
## GODEBUG History {#history} |
| 146 |
|
| 147 |
This section documents the GODEBUG settings introduced and removed in each major Go release |
| 148 |
for compatibility reasons. |
| 149 |
Packages or programs may define additional settings for internal debugging purposes; |
| 150 |
for example, |
| 151 |
see the [runtime documentation](/pkg/runtime#hdr-Environment_Variables) |
| 152 |
and the [go command documentation](/cmd/go#hdr-Build_and_test_caching). |
| 153 |
|
| 154 |
### Go 1.26 |
| 155 |
|
| 156 |
Go 1.26 added a new `httpcookiemaxnum` setting that controls the maximum number |
| 157 |
of cookies that net/http will accept when parsing HTTP headers. If the number of |
| 158 |
cookie in a header exceeds the number set in `httpcookiemaxnum`, cookie parsing |
| 159 |
will fail early. The default value is `httpcookiemaxnum=3000`. Setting |
| 160 |
`httpcookiemaxnum=0` will allow the cookie parsing to accept an indefinite |
| 161 |
number of cookies. To avoid denial of service attacks, this setting and default |
| 162 |
was backported to Go 1.25.2 and Go 1.24.8. |
| 163 |
|
| 164 |
Go 1.26 added a new `urlmaxqueryparams` setting that controls the maximum number |
| 165 |
of query parameters that net/url will accept when parsing a URL-encoded query string. |
| 166 |
If the number of parameters exceeds the number set in `urlmaxqueryparams`, |
| 167 |
parsing will fail early. The default value is `urlmaxqueryparams=10000`. |
| 168 |
Setting `urlmaxqueryparams=0`bles the limit. To avoid denial of service attacks, |
| 169 |
this setting and default was backported to Go 1.25.4 and Go 1.24.10. |
| 170 |
|
| 171 |
### Go 1.25 |
| 172 |
|
| 173 |
Go 1.25.13 added a `fips140ems` setting that when set to `0` disables the |
| 174 |
enforcement of Extended Master Secret in FIPS 140-3 mode. There is no change in |
| 175 |
default behavior. |
| 176 |
|
| 177 |
Go 1.25.8 added a new `htmlmetacontenturlescape` setting that controls whether |
| 178 |
html/template will escape URLs in the `url=` portion of the content attribute of |
| 179 |
HTML meta tags. The default `htmlmetacontentescape=1` will cause URLs to be |
| 180 |
escaped. Setting `htmlmetacontentescape=0` disables this behavior. |
| 181 |
|
| 182 |
Go 1.25 added a new `decoratemappings` setting that controls whether the Go |
| 183 |
runtime annotates OS anonymous memory mappings with context about their |
| 184 |
purpose. These annotations appear in /proc/self/maps and /proc/self/smaps as |
| 185 |
"[anon: Go: ...]". This setting is only used on Linux. For Go 1.25, it defaults |
| 186 |
to `decoratemappings=1`, enabling annotations. Using `decoratemappings=0` |
| 187 |
reverts to the pre-Go 1.25 behavior. This setting is fixed at program startup |
| 188 |
time, and can't be modified by changing the `GODEBUG` environment variable |
| 189 |
after the program starts. |
| 190 |
|
| 191 |
Go 1.25 added a new `embedfollowsymlinks` setting that controls whether the |
| 192 |
Go command will follow symlinks to regular files embedding files. |
| 193 |
The default value `embedfollowsymlinks=0` does not allow following |
| 194 |
symlinks. `embedfollowsymlinks=1` will allow following symlinks. |
| 195 |
|
| 196 |
Go 1.25 added a new `containermaxprocs` setting that controls whether the Go |
| 197 |
runtime will consider cgroup CPU limits when setting the default GOMAXPROCS. |
| 198 |
The default value `containermaxprocs=1` will use cgroup limits in addition to |
| 199 |
the total logical CPU count and CPU affinity. `containermaxprocs=0` will |
| 200 |
disable consideration of cgroup limits. This setting only affects Linux. |
| 201 |
|
| 202 |
Go 1.25 added a new `updatemaxprocs` setting that controls whether the Go |
| 203 |
runtime will periodically update GOMAXPROCS for new CPU affinity or cgroup |
| 204 |
limits. The default value `updatemaxprocs=1` will enable periodic updates. |
| 205 |
`updatemaxprocs=0` will disable periodic updates. |
| 206 |
|
| 207 |
Go 1.25 disabled SHA-1 signature algorithms in TLS 1.2 according to RFC 9155. |
| 208 |
The default can be reverted using the `tlssha1=1` setting. |
| 209 |
|
| 210 |
Go 1.25 switched to SHA-256 to fill in missing SubjectKeyId in |
| 211 |
crypto/x509.CreateCertificate. The setting `x509sha256skid=0` reverts to SHA-1. |
| 212 |
|
| 213 |
Go 1.25 corrected the semantics of contention reports for runtime-internal locks, |
| 214 |
and so removed the [`runtimecontentionstacks` setting](/pkg/runtime#hdr-Environment_Variables). |
| 215 |
|
| 216 |
Go 1.25 (starting with Go 1.25 RC 2) disabled build information stamping when |
| 217 |
multiple VCS are detected due to concerns around VCS injection attacks. This |
| 218 |
behavior and setting was backported to Go 1.24.5 and Go 1.23.11. This behavior |
| 219 |
can be renabled with the setting `allowmultiplevcs=1`. |
| 220 |
|
| 221 |
### Go 1.24 |
| 222 |
|
| 223 |
Go 1.24 added a new `fips140` setting that controls whether the Go |
| 224 |
Cryptographic Module operates in FIPS 140-3 mode. |
| 225 |
The possible values are: |
| 226 |
- "off": no special support for FIPS 140-3 mode. This is the default. |
| 227 |
- "on": the Go Cryptographic Module operates in FIPS 140-3 mode. |
| 228 |
- "only": like "on", but cryptographic algorithms not approved by |
| 229 |
FIPS 140-3 return an error or panic. |
| 230 |
For more information, see [FIPS 140-3 Compliance](/doc/security/fips140). |
| 231 |
This setting is fixed at program startup time, and can't be modified |
| 232 |
by changing the `GODEBUG` environment variable after the program starts. |
| 233 |
|
| 234 |
Go 1.24 changed the global [`math/rand.Seed`](/pkg/math/rand/#Seed) to be a |
| 235 |
no-op. This behavior is controlled by the `randseednop` setting. |
| 236 |
For Go 1.24 it defaults to `randseednop=1`. |
| 237 |
Using `randseednop=0` reverts to the pre-Go 1.24 behavior. |
| 238 |
|
| 239 |
Go 1.24 added new values for the `multipathtcp` setting. |
| 240 |
The possible values for `multipathtcp` are now: |
| 241 |
- "0": disable MPTCP on dialers and listeners by default |
| 242 |
- "1": enable MPTCP on dialers and listeners by default |
| 243 |
- "2": enable MPTCP on listeners only by default |
| 244 |
- "3": enable MPTCP on dialers only by default |
| 245 |
|
| 246 |
For Go 1.24, it now defaults to multipathtcp="2", thus |
| 247 |
enabled by default on listeners. Using multipathtcp="0" reverts to the |
| 248 |
pre-Go 1.24 behavior. |
| 249 |
|
| 250 |
Go 1.24 changed the behavior of `go test -json` to emit build errors as JSON |
| 251 |
instead of text. |
| 252 |
These new JSON events are distinguished by new `Action` values, |
| 253 |
but can still cause problems with CI systems that aren't robust to these events. |
| 254 |
This behavior can be controlled with the `gotestjsonbuildtext` setting. |
| 255 |
Using `gotestjsonbuildtext=1` restores the 1.23 behavior. |
| 256 |
This setting will be removed in a future release, Go 1.28 at the earliest. |
| 257 |
|
| 258 |
Go 1.24 changed [`crypto/rsa`](/pkg/crypto/rsa) to require RSA keys to be at |
| 259 |
least 1024 bits. This behavior can be controlled with the `rsa1024min` setting. |
| 260 |
Using `rsa1024min=0` restores the Go 1.23 behavior. |
| 261 |
|
| 262 |
Go 1.24 introduced a mechanism for enabling platform specific Data Independent |
| 263 |
Timing (DIT) modes in the [`crypto/subtle`](/pkg/crypto/subtle) package. This |
| 264 |
mode can be enabled for an entire program with the `dataindependenttiming` setting. |
| 265 |
For Go 1.24 it defaults to `dataindependenttiming=0`. There is no change in default |
| 266 |
behavior from Go 1.23 when `dataindependenttiming` is unset. |
| 267 |
Using `dataindependenttiming=1` enables the DIT mode for the entire Go program. |
| 268 |
When enabled, DIT will be enabled when calling into C from Go. When enabled, |
| 269 |
calling into Go code from C will enable DIT, and disable it before returning to |
| 270 |
C if it was not enabled when Go code was entered. |
| 271 |
This currently only affects arm64 programs. For all other platforms it is a no-op. |
| 272 |
|
| 273 |
Go 1.24 removed the `x509sha1` setting. `crypto/x509` no longer supports verifying |
| 274 |
signatures on certificates that use SHA-1 based signature algorithms. |
| 275 |
|
| 276 |
Go 1.24 changes the default value of the [`x509usepolicies` |
| 277 |
setting.](/pkg/crypto/x509/#CreateCertificate) from `0` to `1`. When marshalling |
| 278 |
certificates, policies are now taken from the |
| 279 |
[`Certificate.Policies`](/pkg/crypto/x509/#Certificate.Policies) field rather |
| 280 |
than the |
| 281 |
[`Certificate.PolicyIdentifiers`](/pkg/crypto/x509/#Certificate.PolicyIdentifiers) |
| 282 |
field by default. |
| 283 |
|
| 284 |
Go 1.24 enabled the post-quantum key exchange mechanism |
| 285 |
X25519MLKEM768 by default. The default can be reverted using the |
| 286 |
[`tlsmlkem` setting](/pkg/crypto/tls/#Config.CurvePreferences). |
| 287 |
This can be useful when dealing with buggy TLS servers that do not handle large records correctly, |
| 288 |
causing a timeout during the handshake (see [TLS post-quantum TL;DR fail](https://tldr.fail/)). |
| 289 |
Go 1.24 also removed X25519Kyber768Draft00 and the Go 1.23 `tlskyber` setting. |
| 290 |
|
| 291 |
Go 1.24 made [`ParsePKCS1PrivateKey`](/pkg/crypto/x509/#ParsePKCS1PrivateKey) |
| 292 |
use and validate the CRT parameters in the encoded private key. This behavior |
| 293 |
can be controlled with the `x509rsacrt` setting. Using `x509rsacrt=0` restores |
| 294 |
the Go 1.23 behavior. |
| 295 |
|
| 296 |
### Go 1.23 |
| 297 |
|
| 298 |
Go 1.23 changed the channels created by package time to be unbuffered |
| 299 |
(synchronous), which makes correct use of the [`Timer.Stop`](/pkg/time/#Timer.Stop) |
| 300 |
and [`Timer.Reset`](/pkg/time/#Timer.Reset) method results much easier. |
| 301 |
The [`asynctimerchan` setting](/pkg/time/#NewTimer) disables this change. |
| 302 |
There are no runtime metrics for this change, |
| 303 |
This setting may be removed in a future release, Go 1.27 at the earliest. |
| 304 |
|
| 305 |
Go 1.23 changed the mode bits reported by [`os.Lstat`](/pkg/os#Lstat) and [`os.Stat`](/pkg/os#Stat) |
| 306 |
for reparse points, which can be controlled with the `winsymlink` setting. |
| 307 |
As of Go 1.23 (`winsymlink=1`), mount points no longer have [`os.ModeSymlink`](/pkg/os#ModeSymlink) |
| 308 |
set, and reparse points that are not symlinks, Unix sockets, or dedup files now |
| 309 |
always have [`os.ModeIrregular`](/pkg/os#ModeIrregular) set. As a result of these changes, |
| 310 |
[`filepath.EvalSymlinks`](/pkg/path/filepath#EvalSymlinks) no longer evaluates |
| 311 |
mount points, which was a source of many inconsistencies and bugs. |
| 312 |
At previous versions (`winsymlink=0`), mount points are treated as symlinks, |
| 313 |
and other reparse points with non-default [`os.ModeType`](/pkg/os#ModeType) bits |
| 314 |
(such as [`os.ModeDir`](/pkg/os#ModeDir)) do not have the `ModeIrregular` bit set. |
| 315 |
|
| 316 |
Go 1.23 changed [`os.Readlink`](/pkg/os#Readlink) and [`filepath.EvalSymlinks`](/pkg/path/filepath#EvalSymlinks) |
| 317 |
to avoid trying to normalize volumes to drive letters, which was not always even possible. |
| 318 |
This behavior is controlled by the `winreadlinkvolume` setting. |
| 319 |
For Go 1.23, it defaults to `winreadlinkvolume=1`. |
| 320 |
Previous versions default to `winreadlinkvolume=0`. |
| 321 |
|
| 322 |
Go 1.23 enabled the experimental post-quantum key exchange mechanism |
| 323 |
X25519Kyber768Draft00 by default. The default can be reverted using the |
| 324 |
[`tlskyber` setting](/pkg/crypto/tls/#Config.CurvePreferences). |
| 325 |
This can be useful when dealing with buggy TLS servers that do not handle large records correctly, |
| 326 |
causing a timeout during the handshake (see [TLS post-quantum TL;DR fail](https://tldr.fail/)). |
| 327 |
|
| 328 |
Go 1.23 changed the behavior of |
| 329 |
[crypto/x509.ParseCertificate](/pkg/crypto/x509/#ParseCertificate) to reject |
| 330 |
serial numbers that are negative. This change can be reverted with |
| 331 |
the [`x509negativeserial` setting](/pkg/crypto/x509/#ParseCertificate). |
| 332 |
|
| 333 |
Go 1.23 re-enabled support in html/template for ECMAScript 6 template literals by default. |
| 334 |
The [`jstmpllitinterp` setting](/pkg/html/template#hdr-Security_Model) no longer has |
| 335 |
any effect. |
| 336 |
|
| 337 |
Go 1.23 changed the default TLS cipher suites used by clients and servers when |
| 338 |
not explicitly configured, removing 3DES cipher suites. The default can be reverted |
| 339 |
using the [`tls3des` setting](/pkg/crypto/tls/#Config.CipherSuites). |
| 340 |
|
| 341 |
Go 1.23 changed the behavior of [`tls.X509KeyPair`](/pkg/crypto/tls#X509KeyPair) |
| 342 |
and [`tls.LoadX509KeyPair`](/pkg/crypto/tls#LoadX509KeyPair) to populate the |
| 343 |
Leaf field of the returned [`tls.Certificate`](/pkg/crypto/tls#Certificate). |
| 344 |
This behavior is controlled by the `x509keypairleaf` setting. For Go 1.23, it |
| 345 |
defaults to `x509keypairleaf=1`. Previous versions default to |
| 346 |
`x509keypairleaf=0`. |
| 347 |
|
| 348 |
Go 1.23 changed |
| 349 |
[`net/http.ServeContent`](/pkg/net/http#ServeContent), |
| 350 |
[`net/http.ServeFile`](/pkg/net/http#ServeFile), and |
| 351 |
[`net/http.ServeFS`](/pkg/net/http#ServeFS) to |
| 352 |
remove Cache-Control, Content-Encoding, Etag, and Last-Modified headers |
| 353 |
when serving an error. This behavior is controlled by |
| 354 |
the [`httpservecontentkeepheaders` setting](/pkg/net/http#ServeContent). |
| 355 |
Using `httpservecontentkeepheaders=1` restores the pre-Go 1.23 behavior. |
| 356 |
|
| 357 |
### Go 1.22 |
| 358 |
|
| 359 |
Go 1.22 adds a configurable limit to control the maximum acceptable RSA key size |
| 360 |
that can be used in TLS handshakes, controlled by the [`tlsmaxrsasize` setting](/pkg/crypto/tls#Conn.Handshake). |
| 361 |
The default is tlsmaxrsasize=8192, limiting RSA to 8192-bit keys. To avoid |
| 362 |
denial of service attacks, this setting and default was backported to Go |
| 363 |
1.19.13, Go 1.20.8, and Go 1.21.1. |
| 364 |
|
| 365 |
Go 1.22 made it an error for a request or response read by a net/http |
| 366 |
client or server to have an empty Content-Length header. |
| 367 |
This behavior is controlled by the `httplaxcontentlength` setting. |
| 368 |
|
| 369 |
Go 1.22 changed the behavior of ServeMux to accept extended |
| 370 |
patterns and unescape both patterns and request paths by segment. |
| 371 |
This behavior can be controlled by the |
| 372 |
[`httpmuxgo121` setting](/pkg/net/http/#ServeMux). |
| 373 |
|
| 374 |
Go 1.22 added the [Alias type](/pkg/go/types#Alias) to [go/types](/pkg/go/types) |
| 375 |
for the explicit representation of [type aliases](/ref/spec#Type_declarations). |
| 376 |
Whether the type checker produces `Alias` types or not is controlled by the |
| 377 |
[`gotypesalias` setting](/pkg/go/types#Alias). |
| 378 |
For Go 1.22 it defaults to `gotypesalias=0`. |
| 379 |
For Go 1.23, `gotypesalias=1` will become the default. |
| 380 |
This setting will be removed in a future release, Go 1.27 at the earliest. |
| 381 |
|
| 382 |
Go 1.22 changed the default minimum TLS version supported by both servers |
| 383 |
and clients to TLS 1.2. The default can be reverted to TLS 1.0 using the |
| 384 |
[`tls10server` setting](/pkg/crypto/tls/#Config). |
| 385 |
|
| 386 |
Go 1.22 changed the default TLS cipher suites used by clients and servers when |
| 387 |
not explicitly configured, removing the cipher suites which used RSA based key |
| 388 |
exchange. The default can be reverted using the [`tlsrsakex` setting](/pkg/crypto/tls/#Config). |
| 389 |
|
| 390 |
Go 1.22 disabled |
| 391 |
[`ConnectionState.ExportKeyingMaterial`](/pkg/crypto/tls/#ConnectionState.ExportKeyingMaterial) |
| 392 |
when the connection supports neither TLS 1.3 nor Extended Master Secret |
| 393 |
(implemented in Go 1.21). It can be reenabled with the [`tlsunsafeekm` |
| 394 |
setting](/pkg/crypto/tls/#ConnectionState.ExportKeyingMaterial). |
| 395 |
|
| 396 |
Go 1.22 changed how the runtime interacts with transparent huge pages on Linux. |
| 397 |
In particular, a common default Linux kernel configuration can result in |
| 398 |
significant memory overheads, and Go 1.22 no longer works around this default. |
| 399 |
To work around this issue without adjusting kernel settings, transparent huge |
| 400 |
pages can be disabled for Go memory with the |
| 401 |
[`disablethp` setting](/pkg/runtime#hdr-Environment_Variables). |
| 402 |
This behavior was backported to Go 1.21.1, but the setting is only available |
| 403 |
starting with Go 1.21.6. |
| 404 |
This setting may be removed in a future release, and users impacted by this issue |
| 405 |
should adjust their Linux configuration according to the recommendations in the |
| 406 |
[GC guide](/doc/gc-guide#Linux_transparent_huge_pages), or switch to a Linux |
| 407 |
distribution that disables transparent huge pages altogether. |
| 408 |
|
| 409 |
Go 1.22 added contention on runtime-internal locks to the [`mutex` |
| 410 |
profile](/pkg/runtime/pprof#Profile). Contention on these locks is always |
| 411 |
reported at `runtime._LostContendedRuntimeLock`. Complete stack traces of |
| 412 |
runtime locks can be enabled with the [`runtimecontentionstacks` |
| 413 |
setting](/pkg/runtime#hdr-Environment_Variables). These stack traces have |
| 414 |
non-standard semantics, see setting documentation for details. |
| 415 |
|
| 416 |
Go 1.22 added a new [`crypto/x509.Certificate`](/pkg/crypto/x509/#Certificate) |
| 417 |
field, [`Policies`](/pkg/crypto/x509/#Certificate.Policies), which supports |
| 418 |
certificate policy OIDs with components larger than 31 bits. By default this |
| 419 |
field is only used during parsing, when it is populated with policy OIDs, but |
| 420 |
not used during marshaling. It can be used to marshal these larger OIDs, instead |
| 421 |
of the existing PolicyIdentifiers field, by using the |
| 422 |
[`x509usepolicies` setting](/pkg/crypto/x509/#CreateCertificate). |
| 423 |
|
| 424 |
|
| 425 |
### Go 1.21 |
| 426 |
|
| 427 |
Go 1.21 made it a run-time error to call `panic` with a nil interface value, |
| 428 |
controlled by the [`panicnil` setting](/pkg/builtin/#panic). |
| 429 |
|
| 430 |
Go 1.21 made it an error for html/template actions to appear inside of an ECMAScript 6 |
| 431 |
template literal, controlled by the |
| 432 |
[`jstmpllitinterp` setting](/pkg/html/template#hdr-Security_Model). |
| 433 |
This behavior was backported to Go 1.19.8+ and Go 1.20.3+. |
| 434 |
|
| 435 |
Go 1.21 introduced a limit on the maximum number of MIME headers and multipart |
| 436 |
forms, controlled by the |
| 437 |
[`multipartmaxheaders` and `multipartmaxparts` settings](/pkg/mime/multipart#hdr-Limits) |
| 438 |
respectively. |
| 439 |
This behavior was backported to Go 1.19.8+ and Go 1.20.3+. |
| 440 |
|
| 441 |
Go 1.21 adds the support of Multipath TCP but it is only used if the application |
| 442 |
explicitly asked for it. This behavior can be controlled by the |
| 443 |
[`multipathtcp` setting](/pkg/net#Dialer.SetMultipathTCP). |
| 444 |
|
| 445 |
There is no plan to remove any of these settings. |
| 446 |
|
| 447 |
### Go 1.20 |
| 448 |
|
| 449 |
Go 1.20 introduced support for rejecting insecure paths in tar and zip archives, |
| 450 |
controlled by the [`tarinsecurepath` setting](/pkg/archive/tar/#Reader.Next) |
| 451 |
and the [`zipinsecurepath` setting](/pkg/archive/zip/#NewReader). |
| 452 |
These default to `tarinsecurepath=1` and `zipinsecurepath=1`, |
| 453 |
preserving the behavior of earlier versions of Go. |
| 454 |
A future version of Go may change the defaults to |
| 455 |
`tarinsecurepath=0` and `zipinsecurepath=0`. |
| 456 |
|
| 457 |
Go 1.20 introduced automatic seeding of the |
| 458 |
[`math/rand`](/pkg/math/rand) global random number generator, |
| 459 |
controlled by the [`randautoseed` setting](/pkg/math/rand/#Seed). |
| 460 |
|
| 461 |
Go 1.20 introduced the concept of fallback roots for use during certificate verification, |
| 462 |
controlled by the [`x509usefallbackroots` setting](/pkg/crypto/x509/#SetFallbackRoots). |
| 463 |
|
| 464 |
Go 1.20 removed the preinstalled `.a` files for the standard library |
| 465 |
from the Go distribution. |
| 466 |
Installations now build and cache the standard library like |
| 467 |
packages in other modules. |
| 468 |
The [`installgoroot` setting](/cmd/go#hdr-Compile_and_install_packages_and_dependencies) |
| 469 |
restores the installation and use of preinstalled `.a` files. |
| 470 |
|
| 471 |
There is no plan to remove any of these settings. |
| 472 |
|
| 473 |
### Go 1.19 |
| 474 |
|
| 475 |
Go 1.19 made it an error for path lookups to resolve to binaries in the current directory, |
| 476 |
controlled by the [`execerrdot` setting](/pkg/os/exec#hdr-Executables_in_the_current_directory). |
| 477 |
There is no plan to remove this setting. |
| 478 |
|
| 479 |
Go 1.19 started sending EDNS0 additional headers on DNS requests. |
| 480 |
This can reportedly break the DNS server provided on some routers, |
| 481 |
such as CenturyLink Zyxel C3000Z. |
| 482 |
This can be changed by the [`netedns0` setting](/pkg/net#hdr-Name_Resolution). |
| 483 |
This setting is available in Go 1.21.12, Go 1.22.5, Go 1.23, and later. |
| 484 |
There is no plan to remove this setting. |
| 485 |
|
| 486 |
### Go 1.18 |
| 487 |
|
| 488 |
Go 1.18 removed support for SHA1 in most X.509 certificates, |
| 489 |
controlled by the [`x509sha1` setting](/pkg/crypto/x509#InsecureAlgorithmError). |
| 490 |
This setting was removed in Go 1.24. |
| 491 |
|
| 492 |
### Go 1.10 |
| 493 |
|
| 494 |
Go 1.10 changed how build caching worked and added test caching, along |
| 495 |
with the [`gocacheverify`, `gocachehash`, and `gocachetest` settings](/cmd/go/#hdr-Build_and_test_caching). |
| 496 |
There is no plan to remove these settings. |
| 497 |
|
| 498 |
### Go 1.6 |
| 499 |
|
| 500 |
Go 1.6 introduced transparent support for HTTP/2, |
| 501 |
controlled by the [`http2client`, `http2server`, and `http2debug` settings](/pkg/net/http/#hdr-HTTP_2). |
| 502 |
There is no plan to remove these settings. |
| 503 |
|
| 504 |
### Go 1.5 |
| 505 |
|
| 506 |
Go 1.5 introduced a pure Go DNS resolver, |
| 507 |
controlled by the [`netdns` setting](/pkg/net/#hdr-Name_Resolution). |
| 508 |
There is no plan to remove this setting. |