blob: 0575bce1fe3b6f06b85b712e249cde43e320959c [file] [log] [blame] [view]
Dmitri Shuralyoved6d7392024-07-22 14:33:50 -04001---
2title: Go 1.24 Release Notes
Gopher Robot4ccfb992024-12-05 21:15:57 +00003template: false
Dmitri Shuralyoved6d7392024-07-22 14:33:50 -04004---
5
Gopher Robot4ccfb992024-12-05 21:15:57 +00006<!--
7NOTE: In this document and others in this directory, the convention is to
8set fixed-width phrases with non-fixed-width spaces, as in
9`hello` `world`.
10-->
Dmitri Shuralyoved6d7392024-07-22 14:33:50 -040011
Gopher Robot4ccfb992024-12-05 21:15:57 +000012<style>
13 main ul li { margin: 0.5em 0; }
14</style>
15
16## DRAFT RELEASE NOTES — Introduction to Go 1.24 {#introduction}
17
18**Go 1.24 is not yet released. These are work-in-progress release notes.
19Go 1.24 is expected to be released in February 2025.**
20
21## Changes to the language {#language}
22
23<!-- go.dev/issue/46477 -->
24Go 1.24 now fully supports [generic type aliases](/issue/46477): a type alias
25may be parameterized like a defined type.
26See the [language spec](/ref/spec#Alias_declarations) for details.
27For now, the feature can be disabled by setting `GOEXPERIMENT=noaliastypeparams`;
28but the `aliastypeparams` setting will be removed for Go 1.25.
29
30## Tools {#tools}
31
32### Go command {#go-command}
33
34<!-- go.dev/issue/48429 -->
35
36Go modules can now track executable dependencies using `tool` directives in
37go.mod. This removes the need for the previous workaround of adding tools as
38blank imports to a file conventionally named "tools.go". The `go tool`
39command can now run these tools in addition to tools shipped with the Go
40distribution. For more information see [the
41documentation](/doc/modules/managing-dependencies#tools).
42
43The new `-tool` flag for `go get` causes a tool directive to be added to the
44current module for named packages in addition to adding require directives.
45
46The new [`tool` meta-pattern](/cmd/go#hdr-Package_lists_and_patterns) refers to
47all tools in the current module. This can be used to upgrade them all with `go get -u tool` or to install them into your GOBIN directory with `go install tool`.
48
49<!-- go.dev/issue/69290 -->
50
51Executables created by `go run` and the new behavior for `go tool` are now
52cached in the Go build cache. This makes repeated executions faster at the
53expense of making the cache larger. See [#69290](/issue/69290).
54
55<!-- go.dev/issue/62067 -->
56
57The `go build` and `go install` commands now accept a `-json` flag that reports
58build output and failures as structured JSON output on standard output.
59For details of the reporting format, see `go help buildjson`.
60
61Furthermore, `go test -json` now reports build output and failures in JSON,
62interleaved with test result JSON.
63These are distinguished by new `Action` types, but if they cause problems in
64a test integration system, you can revert to the text build output by setting
65`GODEBUG=gotestjsonbuildtext=1`.
66
67### Cgo {#cgo}
68
69<!-- go.dev/issue/56378, CL 579955 -->
70Cgo supports new annotations for C functions to improve run time
71performance.
72`#cgo noescape cFunctionName` tells the compiler that memory passed to
73the C function `cFunctionname` does not escape.
74`#cgo nocallback cFunctionName` tells the compiler that the C function
75`cFunctionName` does not call back to any Go functions.
76For more information, see [the cgo documentation](/pkg/cmd/cgo#hdr-Optimizing_calls_of_C_code).
77
78<!-- go.dev/issue/67699 -->
79Cgo currently refuses to compile calls to a C function which has multiple
80incompatible declarations. For instance, if `f` is declared as both `void f(int)`
81and `void f(double)`, cgo will report an error instead of possibly generating an
82incorrect call sequence for `f(0)`. New in this release is a better detector for
83this error condition when the incompatible declarations appear in different
84files. See [#67699](/issue/67699).
85
86### Vet
87
88<!-- go.dev/issue/44251 -->
89The new `tests` analyzer reports common mistakes in declarations of
90tests, fuzzers, benchmarks, and examples in test packages, such as
91malformed names, incorrect signatures, or examples that document
92non-existent identifiers. Some of these mistakes may cause tests not
93to run.
94This analyzer is among the subset of analyzers that are run by `go test`.
95
96<!-- go.dev/issue/60529 -->
97The existing `printf` analyzer now reports a diagnostic for calls of
98the form `fmt.Printf(s)`, where `s` is a non-constant format string,
99with no other arguments. Such calls are nearly always a mistake
100as the value of `s` may contain the `%` symbol; use `fmt.Print` instead.
101See [#60529](/issue/60529).
102
103<!-- go.dev/issue/64127 -->
104The existing `buildtag` analyzer now reports a diagnostic when
105there is an invalid Go [major version build constraint](/pkg/cmd/go#hdr-Build_constraints)
106within a `//go:build` directive. For example, `//go:build go1.23.1` refers to
107a point release; use `//go:build go1.23` instead.
108See [#64127](/issue/64127).
109
110<!-- go.dev/issue/66387 -->
111The existing `copylock` analyzer now reports a diagnostic when a
112variable declared in a 3-clause "for" loop such as
113`for i := iter(); done(i); i = next(i) { ... }` contains a `sync.Locker`,
114such as a `sync.Mutex`. [Go 1.22](/doc/go1.22#language) changed the behavior
115of these loops to create a new variable for each iteration, copying the
116value from the previous iteration; this copy operation is not safe for locks.
117See [#66387](/issue/66387).
118
119### GOCACHEPROG
120
121<!-- go.dev/issue/64876 -->
122The `cmd/go` internal binary and test caching mechanism can now be implemented
123by child processes implementing a JSON protocol between the `cmd/go` tool
124and the child process named by the `GOCACHEPROG` environment variable.
125This was previously behind a GOEXPERIMENT.
126For protocol details, see [#59719](/issue/59719).
127
128## Runtime {#runtime}
129
130<!-- go.dev/issue/54766 -->
131<!-- go.dev/cl/614795 -->
132<!-- go.dev/issue/68578 -->
133
134Several performance improvements to the runtime have decreased CPU overheads by
13523% on average across a suite of representative benchmarks.
136Results may vary by application.
137These improvements include a new builtin `map` implementation based on
138[Swiss Tables](https://abseil.io/about/design/swisstables), more efficient
139memory allocation of small objects, and a new runtime-internal mutex
140implementation.
141
142The new builtin `map` implementation and new runtime-internal mutex may be
143disabled by setting `GOEXPERIMENT=noswissmap` and `GOEXPERIMENT=nospinbitmutex`
144at build time respectively.
145
146## Compiler {#compiler}
147
148<!-- go.dev/issue/60725, go.dev/issue/57926 -->
149The compiler already disallowed defining new methods with receiver types that were
150cgo-generated, but it was possible to circumvent that restriction via an alias type.
151Go 1.24 now always reports an error if a receiver denotes a cgo-generated type,
152whether directly or indirectly (through an alias type).
153
154## Linker {#linker}
155
156<!-- go.dev/issue/68678, go.dev/issue/68652, CL 618598, CL 618601 -->
157The linker now generates a GNU build ID (the ELF `NT_GNU_BUILD_ID` note) on ELF platforms
158and a UUID (the Mach-O `LC_UUID` load command) on macOS by default.
159The build ID or UUID is derived from the Go build ID.
160It can be disabled by the `-B none` linker flag, or overridden by the `-B 0xNNNN` linker
161flag with a user-specified hexadecimal value.
162
163## Bootstrap {#bootstrap}
164
165<!-- go.dev/issue/64751 -->
166As mentioned in the [Go 1.22 release notes](/doc/go1.22#bootstrap), Go 1.24 now requires
167Go 1.22.6 or later for bootstrap.
168We expect that Go 1.26 will require a point release of Go 1.24 or later for bootstrap.
169
170## Standard library {#library}
171
172### Directory-limited filesystem access
173
174<!-- go.dev/issue/67002 -->
175The new [`os.Root`](/pkg/os#Root) type provides the ability to perform filesystem
176operations within a specific directory.
177
178The [`os.OpenRoot`](/pkg/os#OpenRoot) function opens a directory and returns an [`os.Root`](/pkg/os#Root).
179Methods on [`os.Root`](/pkg/os#Root) operate within the directory and do not permit
180paths that refer to locations outside the directory, including
181ones that follow symbolic links out of the directory.
182
183- [`os.Root.Open`](/pkg/os#Root.Open) opens a file for reading.
184- [`os.Root.Create`](/pkg/os#Root.Create) creates a file.
185- [`os.Root.OpenFile`](/pkg/os#Root.OpenFile) is the generalized open call.
186- [`os.Root.Mkdir`](/pkg/os#Root.Mkdir) creates a directory.
187
Gopher Robot4ccfb992024-12-05 21:15:57 +0000188### New benchmark function
189
Junyang Shaof18c77d2024-12-06 01:02:38 +0000190Benchmarks may now use the faster and less error-prone [`testing.B.Loop`](/pkg/testing#B.Loop) method to perform benchmark iterations like `for b.Loop() { ... }` in place of the typical loop structures involving `b.N` like `for range b.N`. This offers two significant advantages:
Gopher Robot4ccfb992024-12-05 21:15:57 +0000191 - The benchmark function will execute exactly once per -count, so expensive setup and cleanup steps execute only once.
192 - Function call parameters and results are kept alive, preventing the compiler from fully optimizing away the loop body.
193
Dmitri Shuralyovd0767cd2024-12-05 18:14:18 -0500194### New crypto/hkdf package {#crypto-hkdf}
Gopher Robot4ccfb992024-12-05 21:15:57 +0000195
Dmitri Shuralyovd0767cd2024-12-05 18:14:18 -0500196<!-- go.dev/issue/61477 -->
197The new [`crypto/hkdf`](/pkg/crypto/hkdf/) package implements the HMAC-based Extract-and-Expand
198Key Derivation Function (HKDF) as defined in RFC 5869. It is based on the pre-existing
199`golang.org/x/crypto/hkdf` package.
200
201### New crypto/mlkem package {#crypto-mlkem}
202
203<!-- go.dev/issue/70122 -->
204The new [`crypto/mlkem`](/pkg/crypto/mlkem/) package implements ML-KEM (formerly known as
205Kyber), as specified in [NIST FIPS 203](https://doi.org/10.6028/NIST.FIPS.203).
206
207### New crypto/pbkdf2 package {#crypto-pbkdf2}
208
209<!-- go.dev/issue/69488 -->
210The new [`crypto/pbkdf2`](/pkg/crypto/pbkdf2/) package implements the key derivation function
211PBKDF2 as defined in RFC 2898 / PKCS #5 v2.0. It is based on the pre-existing
212`golang.org/x/crypto/pbkdf2` package.
213
214### New crypto/sha3 package {#crypto-sha3}
215
216<!-- go.dev/issue/69982, go.dev/issue/65269, CL 629176 -->
217The new [`crypto/sha3`](/pkg/crypto/sha3/) package implements the SHA-3 hash function, and SHAKE and
218cSHAKE extendable-output functions. It is based on the pre-existing
219`golang.org/x/crypto/sha3` package.
220
221### New weak package {#weak}
222
223The new [`weak`](/pkg/weak/) package provides weak pointers.
Gopher Robot4ccfb992024-12-05 21:15:57 +0000224
225Weak pointers are a low-level primitive provided to enable the
226creation of memory-efficient structures, such as weak maps for
227associating values, canonicalization maps for anything not
Dmitri Shuralyovd0767cd2024-12-05 18:14:18 -0500228covered by package [`unique`](/pkg/unique/), and various kinds
Gopher Robot4ccfb992024-12-05 21:15:57 +0000229of caches.
230For supporting these use-cases, this release also provides
Dmitri Shuralyovd0767cd2024-12-05 18:14:18 -0500231[`runtime.AddCleanup`](/pkg/runtime/#AddCleanup) and
232[`maphash.Comparable`](/pkg/maphash/#Comparable).
Gopher Robot4ccfb992024-12-05 21:15:57 +0000233
234### Minor changes to the library {#minor_library_changes}
235
236#### [`archive`](/pkg/archive/)
237
238The `(*Writer).AddFS` implementations in both `archive/zip` and `archive/tar`
239now write a directory header for an empty directory.
240
241#### [`bytes`](/pkg/bytes/)
242
243The [`bytes`](/pkg/bytes) package adds several functions that work with iterators:
244- [`Lines`](/pkg/bytes#Lines) returns an iterator over the
245 newline-terminated lines in the byte slice s.
246- [`SplitSeq`](/pkg/bytes#SplitSeq) returns an iterator over
247 all substrings of s separated by sep.
248- [`SplitAfterSeq`](/pkg/bytes#SplitAfterSeq) returns an iterator
249 over substrings of s split after each instance of sep.
250- [`FieldsSeq`](/pkg/bytes#FieldsSeq) returns an iterator over
251 substrings of s split around runs of whitespace characters,
252 as defined by unicode.IsSpace.
253- [`FieldsFuncSeq`](/pkg/bytes#FieldsFuncSeq) returns an iterator
254 over substrings of s split around runs of Unicode code points satisfying f(c).
255
256#### [`crypto/cipher`](/pkg/crypto/cipher/)
257
258[`NewOFB`](/pkg/crypto/cipher#NewOFB), [`NewCFBEncrypter`](/pkg/crypto/cipher#NewCFBEncrypter), and [`NewCFBDecrypter`](/pkg/crypto/cipher#NewCFBDecrypter) are now deprecated. OFB and
259CFB mode are not authenticated, which generally enables active attacks to
260manipulate and recover the plaintext. It is recommended that applications use
261[`AEAD`](/pkg/crypto/cipher#AEAD) modes instead. If an unauthenticated [`Stream`](/pkg/crypto/cipher#Stream) mode is required, use
262[`NewCTR`](/pkg/crypto/cipher#NewCTR) instead.
263
264The new [`NewGCMWithRandomNonce`](/pkg/crypto/cipher#NewGCMWithRandomNonce) function returns an [`AEAD`](/pkg/crypto/cipher#AEAD) that implements
265AES-GCM by generating a random nonce during Seal and prepending it to the
266ciphertext.
267
268#### [`crypto/fips140`](/pkg/crypto/fips140/)
269
Dmitri Shuralyovd0767cd2024-12-05 18:14:18 -0500270TODO: FIPS 140 will be covered in its own section.
Gopher Robot4ccfb992024-12-05 21:15:57 +0000271
272#### [`crypto/md5`](/pkg/crypto/md5/)
273
274The value returned by [`md5.New`](/pkg/md5#New) now also implements the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) interface.
275
Gopher Robot4ccfb992024-12-05 21:15:57 +0000276#### [`crypto/rand`](/pkg/crypto/rand/)
277
278The [`Read`](/pkg/crypto/rand#Read) function, and the `Read` method of [`Reader`](/pkg/crypto/rand#Reader), are now
279defined to never fail.
280They will always return `nil` as the `error` result.
281If something somehow goes wrong while reading random numbers,
282the program will irrecoverably crash.
283This change was made because all supported systems now provide
284sources of random bytes that never fail.
285
286The new [`Text`](/pkg/crypto/rand#Text) function can be used to generate cryptographically secure random text strings. <!-- go.dev/issue/67057 -->
287
288#### [`crypto/rsa`](/pkg/crypto/rsa/)
289
290[`GenerateKey`](/pkg/crypto/rsa#GenerateKey) now returns an error if a key of less than 1024 bits is requested.
291All Sign, Verify, Encrypt, and Decrypt methods now return an error if used with
292a key smaller than 1024 bits. Such keys are insecure and should not be used.
293Setting `GODEBUG=rsa1024min=0` or including `//go:debug rsa1024min=0` in a
294source file restores the old behavior, but we recommend doing so only in tests,
295if necessary. A new [`GenerateKey`](/pkg/crypto/rsa#GenerateKey) example provides an easy-to-use standard
2962048-bit test key.
297
298#### [`crypto/sha1`](/pkg/crypto/sha1/)
299
300The value returned by [`sha1.New`](/pkg/sha1#New) now also implements the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) interface.
301
302#### [`crypto/sha256`](/pkg/crypto/sha256/)
303
304The values returned by [`sha256.New`](/pkg/sha256#New) and [`sha256.New224`](/pkg/sha256#New224) now also implement the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) interface
305
Gopher Robot4ccfb992024-12-05 21:15:57 +0000306#### [`crypto/sha512`](/pkg/crypto/sha512/)
307
308The values returned by [`sha512.New`](/pkg/sha512#New), [`sha512.New384`](/pkg/sha512#New384), [`sha512.New512_224`](/pkg/sha512#New512_224) and [`sha512.New512_256`](/pkg/sha512#New512_256) now also implement the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) interface.
309
310#### [`crypto/subtle`](/pkg/crypto/subtle/)
311
312The [`WithDataIndependentTiming`](/pkg/crypto/subtle#WithDataIndependentTiming) function allows the user to run a function with
313architecture specific features enabled which guarantee specific instructions are
314data value timing invariant. This can be used to make sure that code designed to
315run in constant time is not optimized by CPU-level features such that it
316operates in variable time. Currently, [`WithDataIndependentTiming`](/pkg/crypto/subtle#WithDataIndependentTiming) uses the
317PSTATE.DIT bit on arm64, and is a no-op on all other architectures.
318
319#### [`crypto/tls`](/pkg/crypto/tls/)
320
321The [`ClientHelloInfo`](/pkg/crypto/tls#ClientHelloInfo) struct passed to [`Config.GetCertificate`](/pkg/crypto/tls#Config.GetCertificate) now includes an `Extensions` field, which can be useful for fingerprinting TLS clients.<!-- go.dev/issue/32936 -->
322
323The TLS server now supports Encrypted Client Hello (ECH). This feature can be
324enabled by populating the [`Config.EncryptedClientHelloKeys`](/pkg/crypto/tls#Config.EncryptedClientHelloKeys) field.
325
326`crypto/tls` now supports the post-quantum [`X25519MLKEM768`](/pkg/crypto/tls#X25519MLKEM768) key exchange. Support
327for the experimental X25519Kyber768Draft00 key exchange has been removed.
328
329#### [`crypto/x509`](/pkg/crypto/x509/)
330
331The `x509sha1` GODEBUG setting has been removed. [`Certificate.Verify`](/pkg/crypto/x509#Certificate.Verify) will no
332longer consider SHA-1 based signatures valid when this GODEBUG setting is set.
333
334[`OID`](/pkg/crypto/x509#OID) now implements the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) and [`encoding.TextAppender`](/pkg/encoding#TextAppender)
335interfaces.
336
337The default certificate policies field has changed from
338[`Certificate.PolicyIdentifiers`](/pkg/crypto/x509#Certificate.PolicyIdentifiers) to [`Certificate.Policies`](/pkg/crypto/x509#Certificate.Policies). When parsing
339certificates, both fields will be populated, but when creating certificates
340policies will now be taken from the [`Certificate.Policies`](/pkg/crypto/x509#Certificate.Policies) field instead of the
341[Certificate.PolicyIdentifiers field]. This change can be reverted by setting
342`GODEBUG=x509usepolicies=0`.
343
344[`CreateCertificate`](/pkg/crypto/x509#CreateCertificate) will now generate a serial number using a RFC 5280
345compliant method when passed a template with a nil [`Certificate.SerialNumber`](/pkg/crypto/x509#Certificate.SerialNumber)
346field, instead of failing.
347
348[`Certificate.Verify`](/pkg/crypto/x509#Certificate.Verify) now supports policy validation, as defined by RFC 5280 and
349RFC 9618. In order to enable policy validation,
350[`VerifyOptions.CertificatePolicies`](/pkg/crypto/x509#VerifyOptions.CertificatePolicies) must be set to an acceptable set of policy
351[`OIDs`](/pkg/crypto/x509#OIDs). When enabled, only certificate chains with valid policy graphs will be
352returned from [`Certificate.Verify`](/pkg/crypto/x509#Certificate.Verify).
353
354[`MarshalPKCS8PrivateKey`](/pkg/crypto/x509#MarshalPKCS8PrivateKey) now returns an error instead of marshaling an invalid
355RSA key. ([`MarshalPKCS1PrivateKey`](/pkg/crypto/x509#MarshalPKCS1PrivateKey) doesn't have an error return, and its behavior
356when provided invalid keys continues to be undefined.)
357
358[`ParsePKCS1PrivateKey`](/pkg/crypto/x509#ParsePKCS1PrivateKey) and [`ParsePKCS8PrivateKey`](/pkg/crypto/x509#ParsePKCS8PrivateKey) now use and validate the
359encoded CRT values, so might reject invalid keys that were previously accepted.
360Use `GODEBUG=x509rsacrt=0` to revert to recomputing them.
361
362#### [`debug/elf`](/pkg/debug/elf/)
363
364The [`debug/elf`](/pkg/debug/elf) package adds several new constants, types, and methods to add support for handling dynamic versions and version flags in ELF (Executable and Linkable Format) files:
365
366Several new types have been introduced:
367- [`DynamicVersion`](/pkg/debug/elf#DynamicVersion) struct represents a dynamic version entry in the ELF file.
368- [`DynamicVersionDep`](/pkg/debug/elf#DynamicVersionDep) struct represents a dependency of a dynamic version.
369- [`DynamicVersionNeed`](/pkg/debug/elf#DynamicVersionNeed) struct represents a required dynamic version in the ELF file.
370- [`DynamicVersionFlag`](/pkg/debug/elf#DynamicVersionFlag) is a new type defined as uint16, representing flags for dynamic versions.
371 - [`VER_FLG_BASE`](/pkg/debug/elf#VER_FLG_BASE) version definition of the file.
372 - [`VER_FLG_WEAK`](/pkg/debug/elf#VER_FLG_WEAK) weak version identifier.
373 - [`VER_FLG_INFO`](/pkg/debug/elf#VER_FLG_INFO) reference exists for informational purposes.
374- [`SymbolVersionFlag`](/pkg/debug/elf#SymbolVersionFlag) is a new type defined as uint8, representing version flags for ELF symbols.
375 - [`VerFlagNone`](/pkg/debug/elf#VerFlagNone) no flags.
376 - [`VerFlagLocal`](/pkg/debug/elf#VerFlagLocal) symbol has local scope.
377 - [`VerFlagGlobal`](/pkg/debug/elf#VerFlagGlobal) symbol has global scope.
378 - [`VerFlagHidden`](/pkg/debug/elf#VerFlagHidden) symbol is hidden.
379
380The following methods have been added:
381- [`File.DynamicVersionNeeds`](/pkg/debug/elf#File.DynamicVersionNeeds) method returns a list of dynamic version needs in the ELF file, representing dependencies required by the executable.
382- [`File.DynamicVersions`](/pkg/debug/elf#File.DynamicVersions) retrieves a list of dynamic versions defined in the ELF file.
383<!-- go.dev/issue/63952 -->
384
385#### [`encoding`](/pkg/encoding/)
386
387Two new interfaces, [`TextAppender`](/pkg/encoding#TextAppender) and [`BinaryAppender`](/pkg/encoding#BinaryAppender), have been
388introduced to append the textual or binary representation of an object
389to a byte slice. These interfaces provide the same functionality as
390[`TextMarshaler`](/pkg/encoding#TextMarshaler) and [`BinaryMarshaler`](/pkg/encoding#BinaryMarshaler), but instead of allocating a new slice
391each time, they append the data directly to an existing slice.
392
393#### [`encoding/json`](/pkg/encoding/json/)
394
395When marshaling, a struct field with the new `omitzero` option in the struct field
396tag will be omitted if its value is zero. If the field type has an `IsZero() bool`
397method, that will be used to determine whether the value is zero. Otherwise, the
398value is zero if it is [the zero value for its type](/ref/spec#The_zero_value).
399
400If both `omitempty` and `omitzero` are specified, the field will be omitted if the
401value is either empty or zero (or both).
402
403[`UnmarshalTypeError.Field`](/pkg/encoding/json#UnmarshalTypeError.Field) now includes embedded structs to provide more detailed error messages.
404
405#### [`go/types`](/pkg/go/types/)
406
407All `go/types` data structures that expose sequences using a pair of
408methods such as `Len() int` and `At(int) T` now also have methods that
409return iterators, allowing you to simplify code such as this:
410
411```
412params := fn.Type.(*types.Signature).Params()
413for i := 0; i < params.Len(); i++ {
414 use(params.At(i))
415}
416```
417
418to this:
419
420```
421for param := range fn.Signature().Params().Variables() {
422 use(param)
423}
424```
425
426The methods are:
427[`Interface.EmbeddedTypes`](/pkg/go/types#Interface.EmbeddedTypes),
428[`Interface.ExplicitMethods`](/pkg/go/types#Interface.ExplicitMethods),
429[`Interface.Methods`](/pkg/go/types#Interface.Methods),
430[`MethodSet.Methods`](/pkg/go/types#MethodSet.Methods),
431[`Named.Methods`](/pkg/go/types#Named.Methods),
432[`Scope.Children`](/pkg/go/types#Scope.Children),
433[`Struct.Fields`](/pkg/go/types#Struct.Fields),
434[`Tuple.Variables`](/pkg/go/types#Tuple.Variables),
435[`TypeList.Types`](/pkg/go/types#TypeList.Types),
436[`TypeParamList.TypeParams`](/pkg/go/types#TypeParamList.TypeParams),
437[`Union.Terms`](/pkg/go/types#Union.Terms).
438
439#### [`hash/adler32`](/pkg/hash/adler32/)
440
441The value returned by [`New`](/pkg/hash/adler32#New) now also implements the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) interface.
442
443#### [`hash/crc32`](/pkg/hash/crc32/)
444
445The values returned by [`New`](/pkg/hash/crc32#New) and [`NewIEEE`](/pkg/hash/crc32#NewIEEE) now also implement the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) interface.
446
447#### [`hash/crc64`](/pkg/hash/crc64/)
448
449The value returned by [`New`](/pkg/hash/crc64#New) now also implements the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) interface.
450
451#### [`hash/fnv`](/pkg/hash/fnv/)
452
453The values returned by [`New32`](/pkg/hash/fnv#New32), [`New32a`](/pkg/hash/fnv#New32a), [`New64`](/pkg/hash/fnv#New64), [`New64a`](/pkg/hash/fnv#New64a), [`New128`](/pkg/hash/fnv#New128) and [`New128a`](/pkg/hash/fnv#New128a) now also implement the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) interface.
454
455#### [`hash/maphash`](/pkg/hash/maphash/)
456
457New function [`Comparable`](/pkg/hash/maphash#Comparable) returns the hash of comparable value v.
458New function [`WriteComparable`](/pkg/hash/maphash#WriteComparable) adds x to the data hashed by [`Hash`](/pkg/hash/maphash#Hash).
459
460#### [`log/slog`](/pkg/log/slog/)
461
462The new [`DiscardHandler`](/pkg/log/slog#DiscardHandler) is a handler that is never enabled and always discards its output.
463
464[`Level`](/pkg/log/slog#Level) and [`LevelVar`](/pkg/log/slog#LevelVar) now implement the [`encoding.TextAppender`](/pkg/encoding#TextAppender) interface.
465
466#### [`math/big`](/pkg/math/big/)
467
468[`Float`](/pkg/math/big#Float), [`Int`](/pkg/math/big#Int) and [`Rat`](/pkg/math/big#Rat) now implement the [`encoding.TextAppender`](/pkg/encoding#TextAppender) interface.
469
470#### [`math/rand`](/pkg/math/rand/)
471
472Calls to the deprecated top-level [`Seed`](/pkg/math/rand#Seed) function no longer have any effect. To
473restore the old behavior set `GODEBUG=randseednop=0`. For more background see
474the proposal [#67273](/issue/67273).
475
476#### [`math/rand/v2`](/pkg/math/rand/v2/)
477
478[`ChaCha8`](/pkg/math/rand/v2#ChaCha8) and [`PCG`](/pkg/math/rand/v2#PCG) now implement the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) interface.
479
480#### [`net`](/pkg/net/)
481
482[`ListenConfig`](/pkg/net#ListenConfig) now uses MPTCP by default on systems where it is supported
483(currently on Linux only).
484
485[`IP`](/pkg/net#IP) now implements the [`encoding.TextAppender`](/pkg/encoding#TextAppender) interface.
486
487#### [`net/http`](/pkg/net/http/)
488
489[`Transport`](/pkg/net/http#Transport)'s limit on 1xx informational responses received
490in response to a request has changed.
491It previously aborted a request and returned an error after
492receiving more than 5 1xx responses.
493It now returns an error if the total size of all 1xx responses
494exceeds the [`Transport.MaxResponseHeaderBytes`](/pkg/net/http#Transport.MaxResponseHeaderBytes) configuration setting.
495
496In addition, when a request has a
497[`net/http/httptrace.ClientTrace.Got1xxResponse`](/pkg/net/http/httptrace#ClientTrace.Got1xxResponse)
498trace hook, there is now no limit on the total number of 1xx responses.
499The `Got1xxResponse` hook may return an error to abort a request.
500
501[`Transport`](/pkg/net/http#Transport) and [`Server`](/pkg/net/http#Server) now have an HTTP2 field which permits
502configuring HTTP/2 protocol settings.
503
504The new [`Server.Protocols`](/pkg/net/http#Server.Protocols) and [`Transport.Protocols`](/pkg/net/http#Transport.Protocols) fields provide
505a simple way to configure what HTTP protocols a server or client use.
506
507The server and client may be configured to support unencrypted HTTP/2
508connections.
509
510When [`Server.Protocols`](/pkg/net/http#Server.Protocols) contains UnencryptedHTTP2, the server will accept
511HTTP/2 connections on unencrypted ports. The server can accept both
512HTTP/1 and unencrypted HTTP/2 on the same port.
513
514When [`Transport.Protocols`](/pkg/net/http#Transport.Protocols) contains UnencryptedHTTP2 and does not contain
515HTTP1, the transport will use unencrypted HTTP/2 for http:// URLs.
516If the transport is configured to use both HTTP/1 and unencrypted HTTP/2,
517it will use HTTP/1.
518
519Unencrypted HTTP/2 support uses "HTTP/2 with Prior Knowledge"
520(RFC 9113, section 3.3). The deprecated "Upgrade: h2c" header
521is not supported.
522
523#### [`net/netip`](/pkg/net/netip/)
524
525[`Addr`](/pkg/net/netip#Addr), [`AddrPort`](/pkg/net/netip#AddrPort) and [`Prefix`](/pkg/net/netip#Prefix) now implement the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) and
526[`encoding.TextAppender`](/pkg/encoding#TextAppender) interfaces.
527
528#### [`net/url`](/pkg/net/url/)
529
530[`URL`](/pkg/net/url#URL) now also implements the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) interface.
531
Gopher Robot4ccfb992024-12-05 21:15:57 +0000532#### [`os/user`](/pkg/os/user/)
533
534On Windows, [`Current`](/pkg/os/user#Current) can now be used in Windows Nano Server.
535The implementation has been updated to avoid using functions
536from the `NetApi32` library, which is not available in Nano Server.
537
538On Windows, [`Current`](/pkg/os/user#Current), [`Lookup`](/pkg/os/user#Lookup) and [`LookupId`](/pkg/os/user#LookupId) now supports the
539following built-in service user accounts:
540- `NT AUTHORITY\SYSTEM`
541- `NT AUTHORITY\LOCAL SERVICE`
542- `NT AUTHORITY\NETWORK SERVICE`
543
544On Windows, [`Current`](/pkg/os/user#Current) has been made considerably faster when
545the current user is joined to a slow domain, which is the
546usual case for many corporate users. The new implementation
547performance is now in the order of milliseconds, compared to
548the previous implementation which could take several seconds,
549or even minutes, to complete.
550
551On Windows, [`Current`](/pkg/os/user#Current) now returns the process owner user when
552the current thread is impersonating another user. Previously,
553it returned an error.
554
555#### [`regexp`](/pkg/regexp/)
556
557[`Regexp`](/pkg/regexp#Regexp) now implements the [`encoding.TextAppender`](/pkg/encoding#TextAppender) interface.
558
559#### [`runtime`](/pkg/runtime/)
560
561The [`GOROOT`](/pkg/runtime#GOROOT) function is now deprecated.
562In new code prefer to use the system path to locate the go binary,
563and use `go env GOROOT` to find its GOROOT.
564
565The [`AddCleanup`](/pkg/runtime#AddCleanup) function attaches a function to a pointer. Once the object that
566the pointer points to is no longer reachable, the runtime will call the function.
567[`AddCleanup`](/pkg/runtime#AddCleanup) is a finalization mechanism similar to [`SetFinalizer`](/pkg/runtime#SetFinalizer). Unlike
568[`SetFinalizer`](/pkg/runtime#SetFinalizer), it does not resurrect objects while running the cleanup. Multiple
569cleanups can be attached to a single object. [`AddCleanup`](/pkg/runtime#AddCleanup) is an improvement over
570[`SetFinalizer`](/pkg/runtime#SetFinalizer).
571
572#### [`strings`](/pkg/strings/)
573
574The [`strings`](/pkg/strings) package adds several functions that work with iterators:
575- [`Lines`](/pkg/strings#Lines) returns an iterator over
576 the newline-terminated lines in the string s.
577- [`SplitSeq`](/pkg/strings#SplitSeq) returns an iterator over
578 all substrings of s separated by sep.
579- [`SplitAfterSeq`](/pkg/strings#SplitAfterSeq) returns an iterator
580 over substrings of s split after each instance of sep.
581- [`FieldsSeq`](/pkg/strings#FieldsSeq) returns an iterator over
582 substrings of s split around runs of whitespace characters,
583 as defined by unicode.IsSpace.
584- [`FieldsFuncSeq`](/pkg/strings#FieldsFuncSeq) returns an iterator
585 over substrings of s split around runs of Unicode code points satisfying f(c).
586
587#### [`sync`](/pkg/sync/)
588
589The implementation of [`sync.Map`](/pkg/sync#Map) has been changed, improving overall performance
590and resolving some long-standing issues.
591If you encounter any problems, set `GOEXPERIMENT=nosynchashtriemap` at build
592time to switch back to the old implementation and please [file an
593issue](/issue/new).
594
595#### [`testing`](/pkg/testing/)
596
597The new [`T.Context`](/pkg/testing#T.Context) and [`B.Context`](/pkg/testing#B.Context) methods return a context that's canceled
598after the test completes and before test cleanup functions run.
599
600<!-- testing.B.Loop mentioned in 6-stdlib/6-testing-bloop.md. -->
601
602The new [`T.Chdir`](/pkg/testing#T.Chdir) and [`B.Chdir`](/pkg/testing#B.Chdir) methods can be used to change the working
603directory for the duration of a test or benchmark.
604
605#### [`text/template`](/pkg/text/template/)
606
607Templates now support range-over-func and range-over-int.
608
609#### [`time`](/pkg/time/)
610
611[`Time`](/pkg/time#Time) now implements the [`encoding.BinaryAppender`](/pkg/encoding#BinaryAppender) and [`encoding.TextAppender`](/pkg/encoding#TextAppender) interfaces.
612
Gopher Robot4ccfb992024-12-05 21:15:57 +0000613## Ports {#ports}
614
615### Linux {#linux}
616
617<!-- go.dev/issue/67001 -->
618As [announced](go1.23#linux) in the Go 1.23 release notes, Go 1.24 requires Linux
619kernel version 3.2 or later.
620
621### Darwin {#darwin}
622
623<!-- go.dev/issue/69839 -->
624Go 1.24 is the last release that will run on macOS 11 Big Sur.
625Go 1.25 will require macOS 12 Monterey or later.
626
627### WebAssembly {#wasm}
628
629<!-- go.dev/issue/65199, CL 603055 -->
630The `go:wasmexport` directive is added for Go programs to export functions to the WebAssembly host.
631
632On WebAssembly System Interface Preview 1 (`GOOS=wasip1, GOARCH=wasm`), Go 1.24 supports
633building a Go program as a
634[reactor/library](https://github.com/WebAssembly/WASI/blob/63a46f61052a21bfab75a76558485cf097c0dbba/legacy/application-abi.md#current-unstable-abi),
635by specifying the `-buildmode=c-shared` build flag.
636
637<!-- go.dev/issue/66984, CL 626615 -->
638More types are now permitted as argument or result types for `go:wasmimport` functions.
639Specifically, `bool`, `string`, `uintptr`, and pointers to certain types are allowed
640(see the [proposal](/issue/66984) for detail),
641along with 32-bit and 64-bit integer and float types, and `unsafe.Pointer`, which
642are already allowed.
643These types are also permitted as argument or result types for `go:wasmexport` functions.
644
645<!-- go.dev/issue/68024 -->
646The support files for WebAssembly have been moved to `lib/wasm` from `misc/wasm`.
647
Dmitri Shuralyov1f1be512024-12-05 18:20:57 -0500648### Windows {#windows}
649
650<!-- go.dev/issue/70705 -->
651The windows/arm port (`GOOS=windows` `GOARCH=arm`) has been marked broken.
652See [issue 70705](/issue/70705) for details.
653
Gopher Robot4ccfb992024-12-05 21:15:57 +0000654<!-- Needs to be documented and tracked via a release-blocking issue.
655
656accepted proposal https://go.dev/issue/26232 (from https://go.dev/cl/605256, https://go.dev/cl/605275, https://go.dev/cl/605298, https://go.dev/cl/625036) - cmd/go's HTTP auth is tracked in proposal 26232 itself as a release blocker
Gopher Robot4ccfb992024-12-05 21:15:57 +0000657accepted proposal https://go.dev/issue/50603 (from https://go.dev/cl/595376, https://go.dev/cl/596035, https://go.dev/cl/609155, https://go.dev/cl/611916, https://go.dev/cl/627295) - cmd/go support for stamping pseudo-version in go build is tracked in proposal 50603 itself as a release blocker
Gopher Robot4ccfb992024-12-05 21:15:57 +0000658accepted proposal https://go.dev/issue/69393 (from https://go.dev/cl/630775) - automatic crypto/tls.CurvePreferences ordering is now tracked in proposal 69393 itself as a release blocker
659-->
660
661<!-- Needs to be documented, but not currently tracked via a release-blocking issue.
662
663accepted proposal https://go.dev/issue/66821 (from https://go.dev/cl/602495, https://go.dev/cl/602497, https://go.dev/cl/608175, https://go.dev/cl/608435, https://go.dev/cl/621979, https://go.dev/cl/622115) - crashing the process on error reading randomness (which should not have a path to happen) might need to be mentioned; commented at https://go.dev/issues/66821#issuecomment-2502069725 for next steps; Ian sent out CL 632036
664-->
665
666<!-- Maybe worth including or maybe fine not to include in Go 1.24 release notes. Someone more familiar with the change makes the call.
667
668accepted proposal https://go.dev/issue/64802 (from https://go.dev/cl/628681) - a crypto/ecdsa change when rand is nil; commented at https://go.dev/issue/64802#issuecomment-2502019212 for next steps
669accepted proposal https://go.dev/issue/25309 (from https://go.dev/cl/594018, https://go.dev/cl/595120, https://go.dev/cl/595564, https://go.dev/cl/601778) - new x/crypto package; doesn't seem to need to be mentioned but asked anyway in https://go.dev/issue/25309#issuecomment-2498747653
670accepted proposal https://go.dev/issue/43744 (from https://go.dev/cl/357530) - unclear if Go 1.24 release notes need anything; pinged it in https://go.dev/issue/43744#issuecomment-2498773718
671accepted proposal https://go.dev/issue/69687 (from https://go.dev/cl/591997, https://go.dev/cl/629735) - experimental package testing/synctest behind an experiment; commented at https://github.com/golang/go/issues/69687#issuecomment-2502179333, leaving to Damien to decide whether to document it or defer that until the package is added as non-experiment
672accepted proposal https://go.dev/issue/51269 (from https://go.dev/cl/627035) - may be worth mentioning in Go 1.24 release notes, or may be fine to leave out; commented at https://go.dev/issue/51269#issuecomment-2501802763
673accepted proposal https://go.dev/issue/60905 (from https://go.dev/cl/610195) - CL 610195 seems like a small performance enhancement that builds on the Go 1.23 proposal to add GOARM64; probably okay without being mentioned in Go 1.24 release notes (also probably okay to mention)
674accepted proposal https://go.dev/issue/61395 (from https://go.dev/cl/594738, https://go.dev/cl/594976) - CL 594738 made sync/atomic AND/OR operations intrinsic on amd64, but the API was already added in Go 1.23; CL 594976 is a fix; probably doesn't require a Go 1.24 release note
675-->
676
677<!-- Items that don't need to be mentioned in Go 1.24 release notes but are picked up by relnote todo.
678
679accepted proposal https://go.dev/issue/66540 (from https://go.dev/cl/603958) - a Go language spec clarification; might not need to be mentioned in Go 1.24 release notes; left a comment at https://go.dev/issue/66540#issuecomment-2502051684; Robert confirmed it indeed doesn't
680accepted proposal https://go.dev/issue/34208 (from https://go.dev/cl/586241) - CL 586241 implements a fix for a Go 1.23 feature, doesn't seem to be need anything in Go 1.24 release notes
681accepted proposal https://go.dev/issue/43993 (from https://go.dev/cl/626116) - CL 626116 prepares the tree towards the vet change but the vet change itself isn't implemented in Go 1.24, so nothing to say in Go 1.24 release notes
682accepted proposal https://go.dev/issue/44505 (from https://go.dev/cl/609955) - CL 609955 is an internal cleanup in x/tools, no need for Go 1.24 release note
683accepted proposal https://go.dev/issue/61476 (from https://go.dev/cl/608255) - CL 608255 builds on GORISCV64 added in Go 1.23; nothing to mention in Go 1.24 release notes
684accepted proposal https://go.dev/issue/66315 (from https://go.dev/cl/577996) - adding Pass.Module field to x/tools/go/analysis doesn't seem like something that needs to be mentioned in Go 1.24 release notes
685accepted proposal https://go.dev/issue/57786 (from https://go.dev/cl/472717) - CL 472717 is in x/net/http2 and mentions a Go 1.21 proposal; it doesn't seem to need anything in Go 1.24 release notes
686accepted proposal https://go.dev/issue/54265 (from https://go.dev/cl/609915, https://go.dev/cl/610675) - CLs that refer to a Go 1.22 proposal, nothing more is needed in Go 1.24 release notes
687accepted proposal https://go.dev/issue/53021 (from https://go.dev/cl/622276) - CL 622276 improves docs; proposal 53021 was in Go 1.20 so nothing more is needed in Go 1.24 release notes
688accepted proposal https://go.dev/issue/51430 (from https://go.dev/cl/613375) - CL 613375 is an internal documentation comment; proposal 51430 happened in Go 1.20/1.21 so nothing more is needed in Go 1.24 release notes
689accepted proposal https://go.dev/issue/38445 (from https://go.dev/cl/626495) - CL 626495 works on proposal 38445, which is about x/tools/go/package, doesn't need anything in Go 1.24 release notes
690accepted proposal https://go.dev/issue/56986 (from https://go.dev/cl/618115) - CL 618115 adds documentation; it doesn't need to be mentioned in Go 1.24 release notes
691accepted proposal https://go.dev/issue/60061 (from https://go.dev/cl/612038) - CL 612038 is a CL that deprecates something in x/tools/go/ast and mentions a Go 1.22 proposal; doesn't need anything in Go 1.24 release notes
692accepted proposal https://go.dev/issue/61324 (from https://go.dev/cl/411907) - CL 411907 is an x/tools CL that implements a proposal for a new package there; doesn't need anything in Go 1.24 release notes
693accepted proposal https://go.dev/issue/61777 (from https://go.dev/cl/601496) - CL 601496 added a WriteByteTimeout field to x/net/http2.Server; doesn't need a Go 1.24 release note
694accepted proposal https://go.dev/issue/61940 (from https://go.dev/cl/600997) - CL 600997 deleted obsolete code in x/build and mentioned an accepted proposal; doesn't need a Go 1.24 release note
695accepted proposal https://go.dev/issue/62113 (from https://go.dev/cl/594195) - CL 594195 made iterator-related additions in x/net/html; doesn't need a Go 1.24 release note
696accepted proposal https://go.dev/issue/62484 (from https://go.dev/cl/600775) - CL 600775 documents CopyFS symlink behavior and mentions the Go 1.23 proposal; doesn't need a Go 1.24 release note
697accepted proposal https://go.dev/issue/64207 (from https://go.dev/cl/605875) - an x/website CL that follows up on a Go 1.23 proposal; doesn't need a Go 1.24 release note
698accepted proposal https://go.dev/issue/65236 (from https://go.dev/cl/596135) - CL 596135 adds tests for the Go 1.23 proposal 65236; doesn't need a Go 1.24 release note
699accepted proposal https://go.dev/issue/67795 (from https://go.dev/cl/616218) - iteratior support for x/tools/go/ast/inspector; doesn't need a Go 1.24 release note
700accepted proposal https://go.dev/issue/67812 (from https://go.dev/cl/601497) - configurable server pings for x/net/http2.Server; doesn't need a Go 1.24 release note
701accepted proposal https://go.dev/issue/68232 (from https://go.dev/cl/595676) - x/sys/unix additions; doesn't need a Go 1.24 release note
702accepted proposal https://go.dev/issue/68898 (from https://go.dev/cl/607495, https://go.dev/cl/620036, https://go.dev/cl/620135, https://go.dev/cl/623638) - a proposal for x/tools/go/gcexportdata to document 2 releases + tip support policy; since the change is in x/tools it doesn't need a Go 1.24 release note
703accepted proposal https://go.dev/issue/69095 (from https://go.dev/cl/593683, https://go.dev/cl/608955, https://go.dev/cl/610716) - a proposal that affects maintenance and support of golang.org/x repositories; doesn't need to be mentioned in Go 1.24 release notes
704accepted proposal https://go.dev/issue/68384 (from https://go.dev/cl/611875) - expanding the scope of Go Telemetry to include Delve isn't directly tied to Go 1.24 and doesn't seem to need to be mentioned in Go 1.24 release notes
705accepted proposal https://go.dev/issue/69291 (from https://go.dev/cl/610939) - CL 610939 refactors code in x/tools and mentions the still-open proposal #69291 to add Reachable to x/tools/go/ssa/ssautil; doesn't need a Go 1.24 release note
706accepted proposal https://go.dev/issue/69360 (from https://go.dev/cl/614158, https://go.dev/cl/614159, https://go.dev/cl/614635, https://go.dev/cl/614675) - proposal 69360 is to tag and delete gorename from x/tools; doesn't need a Go 1.24 release note
707accepted proposal https://go.dev/issue/61417 (from https://go.dev/cl/605955) - a new field in x/oauth2; nothing to mention in Go 1.24 release notes
708-->