Skip to content

Commit

Permalink
Merge branch 'golang:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulrahman305 authored Oct 27, 2024
2 parents 8327676 + 889abb1 commit 5431e1b
Show file tree
Hide file tree
Showing 1,933 changed files with 102,195 additions and 33,799 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/11-language-change.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Language Change Proposals
description: Changes to the language
labels: ["Proposal", "v2", "LanguageChange"]
title: "proposal: Go 2: proposal title"
labels: ["Proposal", "LanguageChange", "LanguageChangeReview"]
title: "proposal: spec: proposal title"


body:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ _testmain.go
/src/go/build/zcgo.go
/src/go/doc/headscan
/src/internal/buildcfg/zbootstrap.go
/src/runtime/internal/sys/zversion.go
/src/internal/runtime/sys/zversion.go
/src/unicode/maketables
/src/time/tzdata/zzipdata.go
/test.out
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2009 The Go Authors. All rights reserved.
Copyright 2009 The Go Authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
Expand All @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer.
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Go is an open source programming language that makes it easy to build simple,
reliable, and efficient software.

![Gopher image](https://golang.org/doc/gopher/fiveyears.jpg)
*Gopher image by [Renee French][rf], licensed under [Creative Commons 4.0 Attributions license][cc4-by].*
*Gopher image by [Renee French][rf], licensed under [Creative Commons 4.0 Attribution license][cc4-by].*

Our canonical Git repository is located at https://go.googlesource.com/go.
There is a mirror of the repository at https://github.com/golang/go.
Expand Down
1 change: 1 addition & 0 deletions api/next/32936.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pkg crypto/tls, type ClientHelloInfo struct, Extensions []uint16 #32936
4 changes: 4 additions & 0 deletions api/next/36532.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pkg testing, method (*B) Context() context.Context #36532
pkg testing, method (*F) Context() context.Context #36532
pkg testing, method (*T) Context() context.Context #36532
pkg testing, type TB interface, Context() context.Context #36532
1 change: 1 addition & 0 deletions api/next/51473.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pkg runtime, func GOROOT //deprecated #51473
2 changes: 2 additions & 0 deletions api/next/54670.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pkg hash/maphash, func Comparable[$0 comparable](Seed, $0) uint64 #54670
pkg hash/maphash, func WriteComparable[$0 comparable](*Hash, $0) #54670
1 change: 1 addition & 0 deletions api/next/61515.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pkg testing, method (*B) Loop() bool #61515
10 changes: 10 additions & 0 deletions api/next/61901.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pkg bytes, func FieldsFuncSeq([]uint8, func(int32) bool) iter.Seq[[]uint8] #61901
pkg bytes, func FieldsSeq([]uint8) iter.Seq[[]uint8] #61901
pkg bytes, func Lines([]uint8) iter.Seq[[]uint8] #61901
pkg bytes, func SplitAfterSeq([]uint8, []uint8) iter.Seq[[]uint8] #61901
pkg bytes, func SplitSeq([]uint8, []uint8) iter.Seq[[]uint8] #61901
pkg strings, func FieldsFuncSeq(string, func(int32) bool) iter.Seq[string] #61901
pkg strings, func FieldsSeq(string) iter.Seq[string] #61901
pkg strings, func Lines(string) iter.Seq[string] #61901
pkg strings, func SplitAfterSeq(string, string) iter.Seq[string] #61901
pkg strings, func SplitSeq(string, string) iter.Seq[string] #61901
24 changes: 24 additions & 0 deletions api/next/62384.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
pkg encoding, type BinaryAppender interface { AppendBinary } #62384
pkg encoding, type BinaryAppender interface, AppendBinary([]uint8) ([]uint8, error) #62384
pkg encoding, type TextAppender interface { AppendText } #62384
pkg encoding, type TextAppender interface, AppendText([]uint8) ([]uint8, error) #62384
pkg net/url, method (*URL) AppendBinary([]uint8) ([]uint8, error) #62384
pkg log/slog, method (Level) AppendText([]uint8) ([]uint8, error) #62384
pkg log/slog, method (*LevelVar) AppendText([]uint8) ([]uint8, error) #62384
pkg math/big, method (*Float) AppendText([]uint8) ([]uint8, error) #62384
pkg math/big, method (*Int) AppendText([]uint8) ([]uint8, error) #62384
pkg math/big, method (*Rat) AppendText([]uint8) ([]uint8, error) #62384
pkg regexp, method (*Regexp) AppendText([]uint8) ([]uint8, error) #62384
pkg time, method (Time) AppendBinary([]uint8) ([]uint8, error) #62384
pkg time, method (Time) AppendText([]uint8) ([]uint8, error) #62384
pkg math/rand/v2, method (*ChaCha8) AppendBinary([]uint8) ([]uint8, error) #62384
pkg math/rand/v2, method (*PCG) AppendBinary([]uint8) ([]uint8, error) #62384
pkg crypto/x509, method (OID) AppendBinary([]uint8) ([]uint8, error) #62384
pkg crypto/x509, method (OID) AppendText([]uint8) ([]uint8, error) #62384
pkg net, method (IP) AppendText([]uint8) ([]uint8, error) #62384
pkg net/netip, method (Addr) AppendBinary([]uint8) ([]uint8, error) #62384
pkg net/netip, method (Addr) AppendText([]uint8) ([]uint8, error) #62384
pkg net/netip, method (AddrPort) AppendBinary([]uint8) ([]uint8, error) #62384
pkg net/netip, method (AddrPort) AppendText([]uint8) ([]uint8, error) #62384
pkg net/netip, method (Prefix) AppendBinary([]uint8) ([]uint8, error) #62384
pkg net/netip, method (Prefix) AppendText([]uint8) ([]uint8, error) #62384
4 changes: 4 additions & 0 deletions api/next/62516.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pkg testing, method (*B) Chdir(string) #62516
pkg testing, method (*F) Chdir(string) #62516
pkg testing, method (*T) Chdir(string) #62516
pkg testing, type TB interface, Chdir(string) #62516
11 changes: 11 additions & 0 deletions api/next/66626.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
pkg go/types, method (*Interface) EmbeddedTypes() iter.Seq[Type] #66626
pkg go/types, method (*Interface) ExplicitMethods() iter.Seq[*Func] #66626
pkg go/types, method (*Interface) Methods() iter.Seq[*Func] #66626
pkg go/types, method (*MethodSet) Methods() iter.Seq[*Selection] #66626
pkg go/types, method (*Named) Methods() iter.Seq[*Func] #66626
pkg go/types, method (*Scope) Children() iter.Seq[*Scope] #66626
pkg go/types, method (*Struct) Fields() iter.Seq[*Var] #66626
pkg go/types, method (*Tuple) Variables() iter.Seq[*Var] #66626
pkg go/types, method (*TypeList) Types() iter.Seq[Type] #66626
pkg go/types, method (*TypeParamList) TypeParams() iter.Seq[*TypeParam] #66626
pkg go/types, method (*Union) Terms() iter.Seq[*Term] #66626
14 changes: 14 additions & 0 deletions api/next/67813.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pkg net/http, type HTTP2Config struct #67813
pkg net/http, type HTTP2Config struct, CountError func(string) #67813
pkg net/http, type HTTP2Config struct, MaxConcurrentStreams int #67813
pkg net/http, type HTTP2Config struct, MaxDecoderHeaderTableSize int #67813
pkg net/http, type HTTP2Config struct, MaxEncoderHeaderTableSize int #67813
pkg net/http, type HTTP2Config struct, MaxReadFrameSize int #67813
pkg net/http, type HTTP2Config struct, MaxReceiveBufferPerConnection int #67813
pkg net/http, type HTTP2Config struct, MaxReceiveBufferPerStream int #67813
pkg net/http, type HTTP2Config struct, PermitProhibitedCipherSuites bool #67813
pkg net/http, type HTTP2Config struct, PingTimeout time.Duration #67813
pkg net/http, type HTTP2Config struct, SendPingTimeout time.Duration #67813
pkg net/http, type HTTP2Config struct, WriteByteTimeout time.Duration #67813
pkg net/http, type Server struct, HTTP2 *HTTP2Config #67813
pkg net/http, type Transport struct, HTTP2 *HTTP2Config #67813
2 changes: 1 addition & 1 deletion doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ To begin the next release development cycle, populate the contents of `next`
with those of `initial`. From the repo root:

> cd doc
> cp -r initial/* next
> cp -R initial/ next

Then edit `next/1-intro.md` to refer to the next version.
2 changes: 1 addition & 1 deletion doc/go1.17_spec.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Version of Oct 15, 2021",
"Subtitle": "Language version go1.17 (Oct 15, 2021)",
"Path": "/ref/spec"
}-->

Expand Down
41 changes: 34 additions & 7 deletions doc/go_spec.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
"Subtitle": "Language version go1.23 (June 13, 2024)",
"Subtitle": "Language version go1.23 (Oct 1, 2024)",
"Path": "/ref/spec"
}-->

Expand Down Expand Up @@ -1086,7 +1086,7 @@ <h3 id="Struct_types">Struct types</h3>
An embedded field must be specified as
a type name <code>T</code> or as a pointer to a non-interface type name <code>*T</code>,
and <code>T</code> itself may not be
a pointer type. The unqualified type name acts as the field name.
a pointer type or type parameter. The unqualified type name acts as the field name.
</p>

<pre>
Expand Down Expand Up @@ -1127,7 +1127,7 @@ <h3 id="Struct_types">Struct types</h3>
</p>

<p>
Given a struct type <code>S</code> and a <a href="#Types">named type</a>
Given a struct type <code>S</code> and a type name
<code>T</code>, promoted methods are included in the method set of the struct as follows:
</p>
<ul>
Expand Down Expand Up @@ -1927,8 +1927,8 @@ <h3 id="Type_identity">Type identity</h3>
<li>Two slice types are identical if they have identical element types.</li>

<li>Two struct types are identical if they have the same sequence of fields,
and if corresponding fields have the same names, and identical types,
and identical tags.
and if corresponding pairs of fields have the same names, identical types,
and identical tags, and are either both embedded or both not embedded.
<a href="#Exported_identifiers">Non-exported</a> field names from different
packages are always different.</li>

Expand Down Expand Up @@ -2511,12 +2511,12 @@ <h4 id="Alias_declarations">Alias declarations</h4>
</p>

<pre class="ebnf">
AliasDecl = identifier "=" Type .
AliasDecl = identifier [ TypeParameters ] "=" Type .
</pre>

<p>
Within the <a href="#Declarations_and_scope">scope</a> of
the identifier, it serves as an <i>alias</i> for the type.
the identifier, it serves as an <i>alias</i> for the given type.
</p>

<pre>
Expand All @@ -2526,6 +2526,24 @@ <h4 id="Alias_declarations">Alias declarations</h4>
)
</pre>

<p>
If the alias declaration specifies <a href="#Type_parameter_declarations">type parameters</a>
[<a href="#Go_1.24">Go 1.24</a>], the type name denotes a <i>generic alias</i>.
Generic aliases must be <a href="#Instantiations">instantiated</a> when they
are used.
</p>

<pre>
type set[P comparable] = map[P]bool
</pre>

<p>
In an alias declaration the given type cannot be a type parameter.
</p>

<pre>
type A[P any] = P // illegal: P is a type parameter
</pre>

<h4 id="Type_definitions">Type definitions</h4>

Expand Down Expand Up @@ -8687,6 +8705,15 @@ <h4 id="Go_1.23">Go 1.23</h4>
function as range expression.
</li>
</ul>

<h4 id="Go_1.24">Go 1.24</h4>
<ul>
<li>
An <a href="#Alias_declarations">alias declaration</a> may declare
<a href="#Type_parameter_declarations">type parameters</a>.
</li>
</ul>

<h3 id="Type_unification_rules">Type unification rules</h3>

<p>
Expand Down
23 changes: 23 additions & 0 deletions doc/godebug.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,29 @@ for example,
see the [runtime documentation](/pkg/runtime#hdr-Environment_Variables)
and the [go command documentation](/cmd/go#hdr-Build_and_test_caching).

### Go 1.24

Go 1.24 changed the global [`math/rand.Seed`](/pkg/math/rand/#Seed) to be a
no-op. This behavior is controlled by the `randseednop` setting.
For Go 1.24 it defaults to `randseednop=1`.
Using `randseednop=0` reverts to the pre-Go 1.24 behavior.

Go 1.24 added new values for the `multipathtcp` setting.
The possible values for `multipathtcp` are now:
- "0": disable MPTCP on dialers and listeners by default
- "1": enable MPTCP on dialers and listeners by default
- "2": enable MPTCP on listeners only by default
- "3": enable MPTCP on dialers only by default

For Go 1.24, it now defaults to multipathtcp="2", thus
enabled by default on listerners. Using multipathtcp="0" reverts to the
pre-Go 1.24 behavior.

Go 1.24 changed [`crypto/rand.Read`](/pkg/crypto/rand/#Read) to crash the
program on any error. This setting is controlled by the `randcrash` setting.
For Go 1.24 it defaults to `randcrash=1`.
Using `randcrash=0` reverts to the pre-Go 1.24 behavior.

### Go 1.23

Go 1.23 changed the channels created by package time to be unbuffered
Expand Down
14 changes: 14 additions & 0 deletions doc/next/1-intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!--
NOTE: In this document and others in this directory, the convention is to
set fixed-width phrases with non-fixed-width spaces, as in
`hello` `world`.
-->

<style>
main ul li { margin: 0.5em 0; }
</style>

## DRAFT RELEASE NOTES — Introduction to Go 1.24 {#introduction}

**Go 1.24 is not yet released. These are work-in-progress release notes.
Go 1.24 is expected to be released in February 2025.**
3 changes: 3 additions & 0 deletions doc/next/2-language.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Changes to the language {#language}


22 changes: 22 additions & 0 deletions doc/next/3-tools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Tools {#tools}

### Go command {#go-command}

### Cgo {#cgo}

Cgo currently refuses to compile calls to a C function which has multiple
incompatible declarations. For instance, if `f` is declared as both `void f(int)`
and `void f(double)`, cgo will report an error instead of possibly generating an
incorrect call sequence for `f(0)`. New in this release is a better detector for
this error condition when the incompatible declarations appear in different
files. See [#67699](/issue/67699).

### Vet

The new `tests` analyzer reports common mistakes in declarations of
tests, fuzzers, benchmarks, and examples in test packages, such as
malformed names, incorrect signatures, or examples that document
non-existent identifiers. Some of these mistakes may cause tests not
to run.

This analyzer is among the subset of analyzers that are run by `go test`.
1 change: 1 addition & 0 deletions doc/next/4-runtime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Runtime {#runtime}
12 changes: 12 additions & 0 deletions doc/next/5-toolchain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Compiler {#compiler}

## Assembler {#assembler}

## Linker {#linker}

## Bootstrap {#bootstrap}

<!-- go.dev/issue/64751 -->
As mentioned in the [Go 1.22 release notes](/doc/go1.22#bootstrap), Go 1.24 now requires
Go 1.22.6 or later for bootstrap.
We expect that Go 1.26 will require a point release of Go 1.24 or later for bootstrap.
2 changes: 2 additions & 0 deletions doc/next/6-stdlib/0-heading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Standard library {#library}

3 changes: 3 additions & 0 deletions doc/next/6-stdlib/99-minor/0-heading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Minor changes to the library {#minor_library_changes}


1 change: 1 addition & 0 deletions doc/next/6-stdlib/99-minor/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API changes and other small changes to the standard library go here.
2 changes: 2 additions & 0 deletions doc/next/6-stdlib/99-minor/archive/66831.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The `(*Writer).AddFS` implementations in both `archive/zip` and `archive/tar`
now write a directory header for an empty directory.
12 changes: 12 additions & 0 deletions doc/next/6-stdlib/99-minor/bytes/61901.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
The [bytes] package adds several functions that work with iterators:
- [Lines] returns an iterator over the
newline-terminated lines in the byte slice s.
- [SplitSeq] returns an iterator over
all substrings of s separated by sep.
- [SplitAfterSeq] returns an iterator
over substrings of s split after each instance of sep.
- [FieldsSeq] returns an iterator over
substrings of s split around runs of whitespace characters,
as defined by unicode.IsSpace.
- [FieldsFuncSeq] returns an iterator
over substrings of s split around runs of Unicode code points satisfying f(c).
1 change: 1 addition & 0 deletions doc/next/6-stdlib/99-minor/crypto/md5/62384.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The value returned by [md5.New] now also implements the [encoding.BinaryAppender] interface.
1 change: 1 addition & 0 deletions doc/next/6-stdlib/99-minor/crypto/sha1/62384.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The value returned by [sha1.New] now also implements the [encoding.BinaryAppender] interface.
1 change: 1 addition & 0 deletions doc/next/6-stdlib/99-minor/crypto/sha256/62384.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The values returned by [sha256.New] and [sha256.New224] now also implement the [encoding.BinaryAppender] interface
1 change: 1 addition & 0 deletions doc/next/6-stdlib/99-minor/crypto/sha512/62384.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The values returned by [sha512.New], [sha512.New384], [sha512.New512_224] and [sha512.New512_256] now also implement the [encoding.BinaryAppender] interface.
1 change: 1 addition & 0 deletions doc/next/6-stdlib/99-minor/crypto/tls/32936.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The [ClientHelloInfo] struct passed to [Config.GetCertificate] now includes an `Extensions` field, which can be useful for fingerprinting TLS clients.<!-- go.dev/issue/32936 -->
2 changes: 2 additions & 0 deletions doc/next/6-stdlib/99-minor/crypto/x509/62384.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[OID] now implements the [encoding.BinaryAppender] and [encoding.TextAppender]
interfaces.
5 changes: 5 additions & 0 deletions doc/next/6-stdlib/99-minor/encoding/62384.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Two new interfaces, [TextAppender] and [BinaryAppender], have been
introduced to append the textual or binary representation of an object
to a byte slice. These interfaces provide the same functionality as
[TextMarshaler] and [BinaryMarshaler], but instead of allocating a new slice
each time, they append the data directly to an existing slice.
7 changes: 7 additions & 0 deletions doc/next/6-stdlib/99-minor/encoding/json/45669.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
When marshaling, a struct field with the new `omitzero` option in the struct field
tag will be omitted if its value is zero. If the field type has an `IsZero() bool`
method, that will be used to determine whether the value is zero. Otherwise, the
value is zero if it is [the zero value for its type](/ref/spec#The_zero_value).

If both `omitempty` and `omitzero` are specified, the field will be omitted if the
value is either empty or zero (or both).
1 change: 1 addition & 0 deletions doc/next/6-stdlib/99-minor/encoding/json/68941.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[UnmarshalTypeError.Field] now includes embedded structs to provide more detailed error messages.
Loading

0 comments on commit 5431e1b

Please sign in to comment.