mirror of
https://github.com/golang/go.git
synced 2025-05-22 16:09:37 +00:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7dff7439dc | ||
|
62c3a6350b | ||
|
eba9e08766 | ||
|
f3bdcda88a | ||
|
362f22d2d2 |
@ -1,7 +1,7 @@
|
|||||||
name: Language Change Proposals
|
name: Language Change Proposals
|
||||||
description: Changes to the language
|
description: Changes to the language
|
||||||
labels: ["Proposal", "LanguageChange", "LanguageChangeReview"]
|
labels: ["Proposal", "v2", "LanguageChange"]
|
||||||
title: "proposal: spec: proposal title"
|
title: "proposal: Go 2: proposal title"
|
||||||
|
|
||||||
|
|
||||||
body:
|
body:
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -37,7 +37,7 @@ _testmain.go
|
|||||||
/src/go/build/zcgo.go
|
/src/go/build/zcgo.go
|
||||||
/src/go/doc/headscan
|
/src/go/doc/headscan
|
||||||
/src/internal/buildcfg/zbootstrap.go
|
/src/internal/buildcfg/zbootstrap.go
|
||||||
/src/internal/runtime/sys/zversion.go
|
/src/runtime/internal/sys/zversion.go
|
||||||
/src/unicode/maketables
|
/src/unicode/maketables
|
||||||
/src/time/tzdata/zzipdata.go
|
/src/time/tzdata/zzipdata.go
|
||||||
/test.out
|
/test.out
|
||||||
|
4
LICENSE
4
LICENSE
@ -1,4 +1,4 @@
|
|||||||
Copyright 2009 The Go Authors.
|
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are
|
||||||
@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer.
|
|||||||
copyright 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
|
in the documentation and/or other materials provided with the
|
||||||
distribution.
|
distribution.
|
||||||
* Neither the name of Google LLC nor the names of its
|
* Neither the name of Google Inc. nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ Go is an open source programming language that makes it easy to build simple,
|
|||||||
reliable, and efficient software.
|
reliable, and efficient software.
|
||||||
|
|
||||||

|

|
||||||
*Gopher image by [Renee French][rf], licensed under [Creative Commons 4.0 Attribution license][cc4-by].*
|
*Gopher image by [Renee French][rf], licensed under [Creative Commons 4.0 Attributions license][cc4-by].*
|
||||||
|
|
||||||
Our canonical Git repository is located at https://go.googlesource.com/go.
|
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.
|
There is a mirror of the repository at https://github.com/golang/go.
|
||||||
|
@ -18,7 +18,7 @@ pkg crypto/tls, type Config struct, EncryptedClientHelloRejectionVerify func(Con
|
|||||||
pkg crypto/tls, type ConnectionState struct, ECHAccepted bool #63369
|
pkg crypto/tls, type ConnectionState struct, ECHAccepted bool #63369
|
||||||
pkg crypto/tls, type ECHRejectionError struct #63369
|
pkg crypto/tls, type ECHRejectionError struct #63369
|
||||||
pkg crypto/tls, type ECHRejectionError struct, RetryConfigList []uint8 #63369
|
pkg crypto/tls, type ECHRejectionError struct, RetryConfigList []uint8 #63369
|
||||||
pkg crypto/tls, type QUICConfig struct, EnableSessionEvents bool #63691
|
pkg crypto/tls, type QUICConfig struct, EnableStoreSessionEvent bool #63691
|
||||||
pkg crypto/tls, type QUICEvent struct, SessionState *SessionState #63691
|
pkg crypto/tls, type QUICEvent struct, SessionState *SessionState #63691
|
||||||
pkg crypto/tls, type QUICSessionTicketOptions struct, Extra [][]uint8 #63691
|
pkg crypto/tls, type QUICSessionTicketOptions struct, Extra [][]uint8 #63691
|
||||||
pkg crypto/x509, func ParseOID(string) (OID, error) #66249
|
pkg crypto/x509, func ParseOID(string) (OID, error) #66249
|
||||||
|
223
api/go1.24.txt
223
api/go1.24.txt
@ -1,223 +0,0 @@
|
|||||||
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 crypto/cipher, func NewCFBDecrypter //deprecated #69445
|
|
||||||
pkg crypto/cipher, func NewCFBEncrypter //deprecated #69445
|
|
||||||
pkg crypto/cipher, func NewGCMWithRandomNonce(Block) (AEAD, error) #69981
|
|
||||||
pkg crypto/cipher, func NewOFB //deprecated #69445
|
|
||||||
pkg crypto/fips140, func Enabled() bool #70123
|
|
||||||
pkg crypto/hkdf, func Expand[$0 hash.Hash](func() $0, []uint8, string, int) ([]uint8, error) #61477
|
|
||||||
pkg crypto/hkdf, func Extract[$0 hash.Hash](func() $0, []uint8, []uint8) ([]uint8, error) #61477
|
|
||||||
pkg crypto/hkdf, func Key[$0 hash.Hash](func() $0, []uint8, []uint8, string, int) ([]uint8, error) #61477
|
|
||||||
pkg crypto/mlkem, const CiphertextSize1024 = 1568 #70122
|
|
||||||
pkg crypto/mlkem, const CiphertextSize1024 ideal-int #70122
|
|
||||||
pkg crypto/mlkem, const CiphertextSize768 = 1088 #70122
|
|
||||||
pkg crypto/mlkem, const CiphertextSize768 ideal-int #70122
|
|
||||||
pkg crypto/mlkem, const EncapsulationKeySize1024 = 1568 #70122
|
|
||||||
pkg crypto/mlkem, const EncapsulationKeySize1024 ideal-int #70122
|
|
||||||
pkg crypto/mlkem, const EncapsulationKeySize768 = 1184 #70122
|
|
||||||
pkg crypto/mlkem, const EncapsulationKeySize768 ideal-int #70122
|
|
||||||
pkg crypto/mlkem, const SeedSize = 64 #70122
|
|
||||||
pkg crypto/mlkem, const SeedSize ideal-int #70122
|
|
||||||
pkg crypto/mlkem, const SharedKeySize = 32 #70122
|
|
||||||
pkg crypto/mlkem, const SharedKeySize ideal-int #70122
|
|
||||||
pkg crypto/mlkem, func GenerateKey1024() (*DecapsulationKey1024, error) #70122
|
|
||||||
pkg crypto/mlkem, func GenerateKey768() (*DecapsulationKey768, error) #70122
|
|
||||||
pkg crypto/mlkem, func NewDecapsulationKey1024([]uint8) (*DecapsulationKey1024, error) #70122
|
|
||||||
pkg crypto/mlkem, func NewDecapsulationKey768([]uint8) (*DecapsulationKey768, error) #70122
|
|
||||||
pkg crypto/mlkem, func NewEncapsulationKey1024([]uint8) (*EncapsulationKey1024, error) #70122
|
|
||||||
pkg crypto/mlkem, func NewEncapsulationKey768([]uint8) (*EncapsulationKey768, error) #70122
|
|
||||||
pkg crypto/mlkem, method (*DecapsulationKey1024) Bytes() []uint8 #70122
|
|
||||||
pkg crypto/mlkem, method (*DecapsulationKey1024) Decapsulate([]uint8) ([]uint8, error) #70122
|
|
||||||
pkg crypto/mlkem, method (*DecapsulationKey1024) EncapsulationKey() *EncapsulationKey1024 #70122
|
|
||||||
pkg crypto/mlkem, method (*DecapsulationKey768) Bytes() []uint8 #70122
|
|
||||||
pkg crypto/mlkem, method (*DecapsulationKey768) Decapsulate([]uint8) ([]uint8, error) #70122
|
|
||||||
pkg crypto/mlkem, method (*DecapsulationKey768) EncapsulationKey() *EncapsulationKey768 #70122
|
|
||||||
pkg crypto/mlkem, method (*EncapsulationKey1024) Bytes() []uint8 #70122
|
|
||||||
pkg crypto/mlkem, method (*EncapsulationKey1024) Encapsulate() ([]uint8, []uint8) #70122
|
|
||||||
pkg crypto/mlkem, method (*EncapsulationKey768) Bytes() []uint8 #70122
|
|
||||||
pkg crypto/mlkem, method (*EncapsulationKey768) Encapsulate() ([]uint8, []uint8) #70122
|
|
||||||
pkg crypto/mlkem, type DecapsulationKey1024 struct #70122
|
|
||||||
pkg crypto/mlkem, type DecapsulationKey768 struct #70122
|
|
||||||
pkg crypto/mlkem, type EncapsulationKey1024 struct #70122
|
|
||||||
pkg crypto/mlkem, type EncapsulationKey768 struct #70122
|
|
||||||
pkg crypto/pbkdf2, func Key[$0 hash.Hash](func() $0, string, []uint8, int, int) ([]uint8, error) #69488
|
|
||||||
pkg crypto/rand, func Text() string #67057
|
|
||||||
pkg crypto/sha3, func New224() *SHA3 #69982
|
|
||||||
pkg crypto/sha3, func New256() *SHA3 #69982
|
|
||||||
pkg crypto/sha3, func New384() *SHA3 #69982
|
|
||||||
pkg crypto/sha3, func New512() *SHA3 #69982
|
|
||||||
pkg crypto/sha3, func NewCSHAKE128([]uint8, []uint8) *SHAKE #69982
|
|
||||||
pkg crypto/sha3, func NewCSHAKE256([]uint8, []uint8) *SHAKE #69982
|
|
||||||
pkg crypto/sha3, func NewSHAKE128() *SHAKE #69982
|
|
||||||
pkg crypto/sha3, func NewSHAKE256() *SHAKE #69982
|
|
||||||
pkg crypto/sha3, func Sum224([]uint8) [28]uint8 #69982
|
|
||||||
pkg crypto/sha3, func Sum256([]uint8) [32]uint8 #69982
|
|
||||||
pkg crypto/sha3, func Sum384([]uint8) [48]uint8 #69982
|
|
||||||
pkg crypto/sha3, func Sum512([]uint8) [64]uint8 #69982
|
|
||||||
pkg crypto/sha3, func SumSHAKE128([]uint8, int) []uint8 #69982
|
|
||||||
pkg crypto/sha3, func SumSHAKE256([]uint8, int) []uint8 #69982
|
|
||||||
pkg crypto/sha3, method (*SHA3) AppendBinary([]uint8) ([]uint8, error) #69982
|
|
||||||
pkg crypto/sha3, method (*SHA3) BlockSize() int #69982
|
|
||||||
pkg crypto/sha3, method (*SHA3) MarshalBinary() ([]uint8, error) #69982
|
|
||||||
pkg crypto/sha3, method (*SHA3) Reset() #69982
|
|
||||||
pkg crypto/sha3, method (*SHA3) Size() int #69982
|
|
||||||
pkg crypto/sha3, method (*SHA3) Sum([]uint8) []uint8 #69982
|
|
||||||
pkg crypto/sha3, method (*SHA3) UnmarshalBinary([]uint8) error #69982
|
|
||||||
pkg crypto/sha3, method (*SHA3) Write([]uint8) (int, error) #69982
|
|
||||||
pkg crypto/sha3, method (*SHAKE) AppendBinary([]uint8) ([]uint8, error) #69982
|
|
||||||
pkg crypto/sha3, method (*SHAKE) BlockSize() int #69982
|
|
||||||
pkg crypto/sha3, method (*SHAKE) MarshalBinary() ([]uint8, error) #69982
|
|
||||||
pkg crypto/sha3, method (*SHAKE) Read([]uint8) (int, error) #69982
|
|
||||||
pkg crypto/sha3, method (*SHAKE) Reset() #69982
|
|
||||||
pkg crypto/sha3, method (*SHAKE) UnmarshalBinary([]uint8) error #69982
|
|
||||||
pkg crypto/sha3, method (*SHAKE) Write([]uint8) (int, error) #69982
|
|
||||||
pkg crypto/sha3, type SHA3 struct #69982
|
|
||||||
pkg crypto/sha3, type SHAKE struct #69982
|
|
||||||
pkg crypto/subtle, func WithDataIndependentTiming(func()) #66450
|
|
||||||
pkg crypto/tls, const X25519MLKEM768 = 4588 #69985
|
|
||||||
pkg crypto/tls, const X25519MLKEM768 CurveID #69985
|
|
||||||
pkg crypto/tls, type ClientHelloInfo struct, Extensions []uint16 #32936
|
|
||||||
pkg crypto/tls, type Config struct, EncryptedClientHelloKeys []EncryptedClientHelloKey #68500
|
|
||||||
pkg crypto/tls, type EncryptedClientHelloKey struct #68500
|
|
||||||
pkg crypto/tls, type EncryptedClientHelloKey struct, Config []uint8 #68500
|
|
||||||
pkg crypto/tls, type EncryptedClientHelloKey struct, PrivateKey []uint8 #68500
|
|
||||||
pkg crypto/tls, type EncryptedClientHelloKey struct, SendAsRetry bool #68500
|
|
||||||
pkg crypto/x509, const NoValidChains = 10 #68484
|
|
||||||
pkg crypto/x509, const NoValidChains InvalidReason #68484
|
|
||||||
pkg crypto/x509, method (OID) AppendBinary([]uint8) ([]uint8, error) #62384
|
|
||||||
pkg crypto/x509, method (OID) AppendText([]uint8) ([]uint8, error) #62384
|
|
||||||
pkg crypto/x509, type Certificate struct, InhibitAnyPolicy int #68484
|
|
||||||
pkg crypto/x509, type Certificate struct, InhibitAnyPolicyZero bool #68484
|
|
||||||
pkg crypto/x509, type Certificate struct, InhibitPolicyMapping int #68484
|
|
||||||
pkg crypto/x509, type Certificate struct, InhibitPolicyMappingZero bool #68484
|
|
||||||
pkg crypto/x509, type Certificate struct, PolicyMappings []PolicyMapping #68484
|
|
||||||
pkg crypto/x509, type Certificate struct, RequireExplicitPolicy int #68484
|
|
||||||
pkg crypto/x509, type Certificate struct, RequireExplicitPolicyZero bool #68484
|
|
||||||
pkg crypto/x509, type PolicyMapping struct #68484
|
|
||||||
pkg crypto/x509, type PolicyMapping struct, IssuerDomainPolicy OID #68484
|
|
||||||
pkg crypto/x509, type PolicyMapping struct, SubjectDomainPolicy OID #68484
|
|
||||||
pkg crypto/x509, type VerifyOptions struct, CertificatePolicies []OID #68484
|
|
||||||
pkg debug/elf, const VER_FLG_BASE = 1 #63952
|
|
||||||
pkg debug/elf, const VER_FLG_BASE DynamicVersionFlag #63952
|
|
||||||
pkg debug/elf, const VER_FLG_INFO = 4 #63952
|
|
||||||
pkg debug/elf, const VER_FLG_INFO DynamicVersionFlag #63952
|
|
||||||
pkg debug/elf, const VER_FLG_WEAK = 2 #63952
|
|
||||||
pkg debug/elf, const VER_FLG_WEAK DynamicVersionFlag #63952
|
|
||||||
pkg debug/elf, method (*File) DynamicVersionNeeds() ([]DynamicVersionNeed, error) #63952
|
|
||||||
pkg debug/elf, method (*File) DynamicVersions() ([]DynamicVersion, error) #63952
|
|
||||||
pkg debug/elf, type DynamicVersion struct #63952
|
|
||||||
pkg debug/elf, type DynamicVersion struct, Deps []string #63952
|
|
||||||
pkg debug/elf, type DynamicVersion struct, Flags DynamicVersionFlag #63952
|
|
||||||
pkg debug/elf, type DynamicVersion struct, Name string #63952
|
|
||||||
pkg debug/elf, type DynamicVersion struct, Index uint16 #63952
|
|
||||||
pkg debug/elf, type DynamicVersionDep struct #63952
|
|
||||||
pkg debug/elf, type DynamicVersionDep struct, Dep string #63952
|
|
||||||
pkg debug/elf, type DynamicVersionDep struct, Flags DynamicVersionFlag #63952
|
|
||||||
pkg debug/elf, type DynamicVersionDep struct, Index uint16 #63952
|
|
||||||
pkg debug/elf, type DynamicVersionFlag uint16 #63952
|
|
||||||
pkg debug/elf, type DynamicVersionNeed struct #63952
|
|
||||||
pkg debug/elf, type DynamicVersionNeed struct, Name string #63952
|
|
||||||
pkg debug/elf, type DynamicVersionNeed struct, Needs []DynamicVersionDep #63952
|
|
||||||
pkg debug/elf, type Symbol struct, HasVersion bool #63952
|
|
||||||
pkg debug/elf, type Symbol struct, VersionIndex VersionIndex #63952
|
|
||||||
pkg debug/elf, method (VersionIndex) Index() uint16 #63952
|
|
||||||
pkg debug/elf, method (VersionIndex) IsHidden() bool #63952
|
|
||||||
pkg debug/elf, type VersionIndex uint16 #63952
|
|
||||||
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 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
|
|
||||||
pkg hash/maphash, func Comparable[$0 comparable](Seed, $0) uint64 #54670
|
|
||||||
pkg hash/maphash, func WriteComparable[$0 comparable](*Hash, $0) #54670
|
|
||||||
pkg log/slog, method (*LevelVar) AppendText([]uint8) ([]uint8, error) #62384
|
|
||||||
pkg log/slog, method (Level) AppendText([]uint8) ([]uint8, error) #62384
|
|
||||||
pkg log/slog, var DiscardHandler Handler #62005
|
|
||||||
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 math/rand/v2, method (*ChaCha8) AppendBinary([]uint8) ([]uint8, error) #62384
|
|
||||||
pkg math/rand/v2, method (*PCG) AppendBinary([]uint8) ([]uint8, error) #62384
|
|
||||||
pkg net, method (IP) AppendText([]uint8) ([]uint8, error) #62384
|
|
||||||
pkg net/http, method (*Protocols) SetHTTP1(bool) #67814
|
|
||||||
pkg net/http, method (*Protocols) SetHTTP2(bool) #67814
|
|
||||||
pkg net/http, method (*Protocols) SetUnencryptedHTTP2(bool) #67816
|
|
||||||
pkg net/http, method (Protocols) HTTP1() bool #67814
|
|
||||||
pkg net/http, method (Protocols) HTTP2() bool #67814
|
|
||||||
pkg net/http, method (Protocols) String() string #67814
|
|
||||||
pkg net/http, method (Protocols) UnencryptedHTTP2() bool #67816
|
|
||||||
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 Protocols struct #67814
|
|
||||||
pkg net/http, type Server struct, HTTP2 *HTTP2Config #67813
|
|
||||||
pkg net/http, type Server struct, Protocols *Protocols #67814
|
|
||||||
pkg net/http, type Transport struct, HTTP2 *HTTP2Config #67813
|
|
||||||
pkg net/http, type Transport struct, Protocols *Protocols #67814
|
|
||||||
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
|
|
||||||
pkg net/url, method (*URL) AppendBinary([]uint8) ([]uint8, error) #62384
|
|
||||||
pkg os, func OpenInRoot(string, string) (*File, error) #67002
|
|
||||||
pkg os, func OpenRoot(string) (*Root, error) #67002
|
|
||||||
pkg os, method (*Root) Close() error #67002
|
|
||||||
pkg os, method (*Root) Create(string) (*File, error) #67002
|
|
||||||
pkg os, method (*Root) FS() fs.FS #67002
|
|
||||||
pkg os, method (*Root) Lstat(string) (fs.FileInfo, error) #67002
|
|
||||||
pkg os, method (*Root) Mkdir(string, fs.FileMode) error #67002
|
|
||||||
pkg os, method (*Root) Name() string #67002
|
|
||||||
pkg os, method (*Root) Open(string) (*File, error) #67002
|
|
||||||
pkg os, method (*Root) OpenFile(string, int, fs.FileMode) (*File, error) #67002
|
|
||||||
pkg os, method (*Root) OpenRoot(string) (*Root, error) #67002
|
|
||||||
pkg os, method (*Root) Remove(string) error #67002
|
|
||||||
pkg os, method (*Root) Stat(string) (fs.FileInfo, error) #67002
|
|
||||||
pkg os, type Root struct #67002
|
|
||||||
pkg regexp, method (*Regexp) AppendText([]uint8) ([]uint8, error) #62384
|
|
||||||
pkg runtime, func AddCleanup[$0 interface{}, $1 interface{}](*$0, func($1), $1) Cleanup #67535
|
|
||||||
pkg runtime, func GOROOT //deprecated #51473
|
|
||||||
pkg runtime, method (Cleanup) Stop() #67535
|
|
||||||
pkg runtime, type Cleanup struct #67535
|
|
||||||
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
|
|
||||||
pkg testing, method (*B) Chdir(string) #62516
|
|
||||||
pkg testing, method (*B) Context() context.Context #36532
|
|
||||||
pkg testing, method (*B) Loop() bool #61515
|
|
||||||
pkg testing, method (*F) Chdir(string) #62516
|
|
||||||
pkg testing, method (*F) Context() context.Context #36532
|
|
||||||
pkg testing, method (*T) Chdir(string) #62516
|
|
||||||
pkg testing, method (*T) Context() context.Context #36532
|
|
||||||
pkg testing, type TB interface, Chdir(string) #62516
|
|
||||||
pkg testing, type TB interface, Context() context.Context #36532
|
|
||||||
pkg time, method (Time) AppendBinary([]uint8) ([]uint8, error) #62384
|
|
||||||
pkg time, method (Time) AppendText([]uint8) ([]uint8, error) #62384
|
|
||||||
pkg weak, func Make[$0 interface{}](*$0) Pointer[$0] #67552
|
|
||||||
pkg weak, method (Pointer[$0]) Value() *$0 #67552
|
|
||||||
pkg weak, type Pointer[$0 interface{}] struct #67552
|
|
@ -1,4 +0,0 @@
|
|||||||
pkg testing, method (*B) Attr(string, string) #43936
|
|
||||||
pkg testing, method (*F) Attr(string, string) #43936
|
|
||||||
pkg testing, method (*T) Attr(string, string) #43936
|
|
||||||
pkg testing, type TB interface, Attr(string, string) #43936
|
|
@ -1 +0,0 @@
|
|||||||
pkg mime/multipart, func FileContentDisposition(string, string) string #46771
|
|
@ -1,8 +0,0 @@
|
|||||||
pkg io/fs, func Lstat(FS, string) (FileInfo, error) #49580
|
|
||||||
pkg io/fs, func ReadLink(FS, string) (string, error) #49580
|
|
||||||
pkg io/fs, type ReadLinkFS interface { Lstat, Open, ReadLink } #49580
|
|
||||||
pkg io/fs, type ReadLinkFS interface, Lstat(string) (FileInfo, error) #49580
|
|
||||||
pkg io/fs, type ReadLinkFS interface, Open(string) (File, error) #49580
|
|
||||||
pkg io/fs, type ReadLinkFS interface, ReadLink(string) (string, error) #49580
|
|
||||||
pkg testing/fstest, method (MapFS) Lstat(string) (fs.FileInfo, error) #49580
|
|
||||||
pkg testing/fstest, method (MapFS) ReadLink(string) (string, error) #49580
|
|
@ -1,3 +0,0 @@
|
|||||||
pkg testing, method (*B) Output() io.Writer #59928
|
|
||||||
pkg testing, method (*F) Output() io.Writer #59928
|
|
||||||
pkg testing, method (*T) Output() io.Writer #59928
|
|
@ -1 +0,0 @@
|
|||||||
pkg reflect, func TypeAssert[$0 interface{}](Value) ($0, bool) #62121
|
|
@ -1,9 +0,0 @@
|
|||||||
pkg runtime/trace, func NewFlightRecorder(FlightRecorderConfig) *FlightRecorder #63185
|
|
||||||
pkg runtime/trace, method (*FlightRecorder) Enabled() bool #63185
|
|
||||||
pkg runtime/trace, method (*FlightRecorder) Start() error #63185
|
|
||||||
pkg runtime/trace, method (*FlightRecorder) Stop() #63185
|
|
||||||
pkg runtime/trace, method (*FlightRecorder) WriteTo(io.Writer) (int64, error) #63185
|
|
||||||
pkg runtime/trace, type FlightRecorder struct #63185
|
|
||||||
pkg runtime/trace, type FlightRecorderConfig struct #63185
|
|
||||||
pkg runtime/trace, type FlightRecorderConfig struct, MaxBytes uint64 #63185
|
|
||||||
pkg runtime/trace, type FlightRecorderConfig struct, MinAge time.Duration #63185
|
|
@ -1,5 +0,0 @@
|
|||||||
pkg crypto, func SignMessage(Signer, io.Reader, []uint8, SignerOpts) ([]uint8, error) #63405
|
|
||||||
pkg crypto, type MessageSigner interface { Public, Sign, SignMessage } #63405
|
|
||||||
pkg crypto, type MessageSigner interface, Public() PublicKey #63405
|
|
||||||
pkg crypto, type MessageSigner interface, Sign(io.Reader, []uint8, SignerOpts) ([]uint8, error) #63405
|
|
||||||
pkg crypto, type MessageSigner interface, SignMessage(io.Reader, []uint8, SignerOpts) ([]uint8, error) #63405
|
|
@ -1 +0,0 @@
|
|||||||
pkg sync, method (*WaitGroup) Go(func()) #63769
|
|
@ -1,4 +0,0 @@
|
|||||||
pkg crypto/ecdsa, func ParseRawPrivateKey(elliptic.Curve, []uint8) (*PrivateKey, error) #63963
|
|
||||||
pkg crypto/ecdsa, func ParseUncompressedPublicKey(elliptic.Curve, []uint8) (*PublicKey, error) #63963
|
|
||||||
pkg crypto/ecdsa, method (*PrivateKey) Bytes() ([]uint8, error) #63963
|
|
||||||
pkg crypto/ecdsa, method (*PublicKey) Bytes() ([]uint8, error) #63963
|
|
@ -1 +0,0 @@
|
|||||||
pkg log/slog, func GroupAttrs(string, ...Attr) Attr #66365
|
|
@ -1,10 +0,0 @@
|
|||||||
pkg os, method (*Root) Chmod(string, fs.FileMode) error #67002
|
|
||||||
pkg os, method (*Root) Chown(string, int, int) error #67002
|
|
||||||
pkg os, method (*Root) Chtimes(string, time.Time, time.Time) error #67002
|
|
||||||
pkg os, method (*Root) Lchown(string, int, int) error #67002
|
|
||||||
pkg os, method (*Root) Link(string, string) error #67002
|
|
||||||
pkg os, method (*Root) MkdirAll(string, fs.FileMode) error #67002
|
|
||||||
pkg os, method (*Root) Readlink(string) (string, error) #67002
|
|
||||||
pkg os, method (*Root) RemoveAll(string) error #67002
|
|
||||||
pkg os, method (*Root) Rename(string, string) error #67002
|
|
||||||
pkg os, method (*Root) Symlink(string, string) error #67002
|
|
@ -1,2 +0,0 @@
|
|||||||
pkg testing/synctest, func Test(*testing.T, func(*testing.T)) #67434
|
|
||||||
pkg testing/synctest, func Wait() #67434
|
|
@ -1 +0,0 @@
|
|||||||
pkg crypto/tls, type ConnectionState struct, CurveID CurveID #67516
|
|
@ -1,5 +0,0 @@
|
|||||||
pkg hash, type XOF interface { BlockSize, Read, Reset, Write } #69518
|
|
||||||
pkg hash, type XOF interface, BlockSize() int #69518
|
|
||||||
pkg hash, type XOF interface, Read([]uint8) (int, error) #69518
|
|
||||||
pkg hash, type XOF interface, Reset() #69518
|
|
||||||
pkg hash, type XOF interface, Write([]uint8) (int, error) #69518
|
|
@ -1,9 +0,0 @@
|
|||||||
pkg crypto/sha3, method (*SHA3) Clone() (hash.Cloner, error) #69521
|
|
||||||
pkg hash, type Cloner interface { BlockSize, Clone, Reset, Size, Sum, Write } #69521
|
|
||||||
pkg hash, type Cloner interface, BlockSize() int #69521
|
|
||||||
pkg hash, type Cloner interface, Clone() (Cloner, error) #69521
|
|
||||||
pkg hash, type Cloner interface, Reset() #69521
|
|
||||||
pkg hash, type Cloner interface, Size() int #69521
|
|
||||||
pkg hash, type Cloner interface, Sum([]uint8) []uint8 #69521
|
|
||||||
pkg hash, type Cloner interface, Write([]uint8) (int, error) #69521
|
|
||||||
pkg hash/maphash, method (*Hash) Clone() (hash.Cloner, error) #69521
|
|
@ -1,17 +0,0 @@
|
|||||||
pkg go/types, const FieldVar = 6 #70250
|
|
||||||
pkg go/types, const FieldVar VarKind #70250
|
|
||||||
pkg go/types, const LocalVar = 2 #70250
|
|
||||||
pkg go/types, const LocalVar VarKind #70250
|
|
||||||
pkg go/types, const PackageVar = 1 #70250
|
|
||||||
pkg go/types, const PackageVar VarKind #70250
|
|
||||||
pkg go/types, const ParamVar = 4 #70250
|
|
||||||
pkg go/types, const ParamVar VarKind #70250
|
|
||||||
pkg go/types, const RecvVar = 3 #70250
|
|
||||||
pkg go/types, const RecvVar VarKind #70250
|
|
||||||
pkg go/types, const ResultVar = 5 #70250
|
|
||||||
pkg go/types, const ResultVar VarKind #70250
|
|
||||||
pkg go/types, func LookupSelection(Type, bool, *Package, string) (Selection, bool) #70737
|
|
||||||
pkg go/types, method (*Var) Kind() VarKind #70250
|
|
||||||
pkg go/types, method (*Var) SetKind(VarKind) #70250
|
|
||||||
pkg go/types, method (VarKind) String() string #70250
|
|
||||||
pkg go/types, type VarKind uint8 #70250
|
|
@ -1 +0,0 @@
|
|||||||
pkg log/slog, method (Record) Source() *Source #70280
|
|
@ -1,3 +0,0 @@
|
|||||||
pkg unicode, var CategoryAliases map[string]string #70780
|
|
||||||
pkg unicode, var Cn *RangeTable #70780
|
|
||||||
pkg unicode, var LC *RangeTable #70780
|
|
@ -1 +0,0 @@
|
|||||||
pkg go/parser, func ParseDir //deprecated #71122
|
|
@ -1 +0,0 @@
|
|||||||
pkg crypto/tls, type Config struct, GetEncryptedClientHelloKeys func(*ClientHelloInfo) ([]EncryptedClientHelloKey, error) #71920
|
|
@ -1,4 +0,0 @@
|
|||||||
pkg debug/elf, const PT_RISCV_ATTRIBUTES = 1879048195 #72843
|
|
||||||
pkg debug/elf, const PT_RISCV_ATTRIBUTES ProgType #72843
|
|
||||||
pkg debug/elf, const SHT_RISCV_ATTRIBUTES = 1879048195 #72843
|
|
||||||
pkg debug/elf, const SHT_RISCV_ATTRIBUTES SectionType #72843
|
|
@ -1,2 +0,0 @@
|
|||||||
pkg os, method (*Root) ReadFile(string) ([]uint8, error) #73126
|
|
||||||
pkg os, method (*Root) WriteFile(string, []uint8, fs.FileMode) error #73126
|
|
@ -1 +0,0 @@
|
|||||||
pkg runtime, func SetDefaultGOMAXPROCS() #73193
|
|
@ -1 +0,0 @@
|
|||||||
pkg go/token, method (*FileSet) AddExistingFiles(...*File) #73205
|
|
@ -1 +0,0 @@
|
|||||||
pkg go/ast, func PreorderStack(Node, []Node, func(Node, []Node) bool) #73319
|
|
@ -1,7 +0,0 @@
|
|||||||
pkg net/http, func NewCrossOriginProtection() *CrossOriginProtection #73626
|
|
||||||
pkg net/http, method (*CrossOriginProtection) AddInsecureBypassPattern(string) #73626
|
|
||||||
pkg net/http, method (*CrossOriginProtection) AddTrustedOrigin(string) error #73626
|
|
||||||
pkg net/http, method (*CrossOriginProtection) Check(*Request) error #73626
|
|
||||||
pkg net/http, method (*CrossOriginProtection) Handler(Handler) Handler #73626
|
|
||||||
pkg net/http, method (*CrossOriginProtection) SetDenyHandler(Handler) #73626
|
|
||||||
pkg net/http, type CrossOriginProtection struct #73626
|
|
@ -1 +1,2 @@
|
|||||||
branch: master
|
branch: release-branch.go1.23
|
||||||
|
parent-branch: master
|
||||||
|
@ -70,6 +70,6 @@ To begin the next release development cycle, populate the contents of `next`
|
|||||||
with those of `initial`. From the repo root:
|
with those of `initial`. From the repo root:
|
||||||
|
|
||||||
> cd doc
|
> cd doc
|
||||||
> cp -R initial/ next
|
> cp -r initial/* next
|
||||||
|
|
||||||
Then edit `next/1-intro.md` to refer to the next version.
|
Then edit `next/1-intro.md` to refer to the next version.
|
||||||
|
6864
doc/go1.17_spec.html
Normal file
6864
doc/go1.17_spec.html
Normal file
File diff suppressed because it is too large
Load Diff
@ -82,7 +82,7 @@ while still insisting that races are errors and that tools can diagnose and repo
|
|||||||
<p>
|
<p>
|
||||||
The following formal definition of Go's memory model closely follows
|
The following formal definition of Go's memory model closely follows
|
||||||
the approach presented by Hans-J. Boehm and Sarita V. Adve in
|
the approach presented by Hans-J. Boehm and Sarita V. Adve in
|
||||||
“<a href="https://dl.acm.org/doi/10.1145/1375581.1375591">Foundations of the C++ Concurrency Memory Model</a>”,
|
“<a href="https://www.hpl.hp.com/techreports/2008/HPL-2008-56.pdf">Foundations of the C++ Concurrency Memory Model</a>”,
|
||||||
published in PLDI 2008.
|
published in PLDI 2008.
|
||||||
The definition of data-race-free programs and the guarantee of sequential consistency
|
The definition of data-race-free programs and the guarantee of sequential consistency
|
||||||
for race-free programs are equivalent to the ones in that work.
|
for race-free programs are equivalent to the ones in that work.
|
||||||
@ -453,7 +453,7 @@ crash, or do something else.)
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="rule">
|
<p class="rule">
|
||||||
The <i>k</i>th receive from a channel with capacity <i>C</i> is synchronized before the completion of the <i>k</i>+<i>C</i>th send on that channel.
|
The <i>k</i>th receive on a channel with capacity <i>C</i> is synchronized before the completion of the <i>k</i>+<i>C</i>th send from that channel completes.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
474
doc/go_spec.html
474
doc/go_spec.html
@ -1,6 +1,6 @@
|
|||||||
<!--{
|
<!--{
|
||||||
"Title": "The Go Programming Language Specification",
|
"Title": "The Go Programming Language Specification",
|
||||||
"Subtitle": "Language version go1.25 (Feb 25, 2025)",
|
"Subtitle": "Language version go1.23 (June 13, 2024)",
|
||||||
"Path": "/ref/spec"
|
"Path": "/ref/spec"
|
||||||
}-->
|
}-->
|
||||||
|
|
||||||
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
This is the reference manual for the Go programming language.
|
This is the reference manual for the Go programming language.
|
||||||
|
The pre-Go1.18 version, without generics, can be found
|
||||||
|
<a href="/doc/go1.17_spec.html">here</a>.
|
||||||
For more information and other documents, see <a href="/">go.dev</a>.
|
For more information and other documents, see <a href="/">go.dev</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -796,6 +798,7 @@ If a variable has not yet been assigned a value, its value is the
|
|||||||
<a href="#The_zero_value">zero value</a> for its type.
|
<a href="#The_zero_value">zero value</a> for its type.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<h2 id="Types">Types</h2>
|
<h2 id="Types">Types</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -1083,7 +1086,7 @@ A field declared with a type but no explicit field name is called an <i>embedded
|
|||||||
An embedded field must be specified as
|
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>,
|
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
|
and <code>T</code> itself may not be
|
||||||
a pointer type or type parameter. The unqualified type name acts as the field name.
|
a pointer type. The unqualified type name acts as the field name.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@ -1124,7 +1127,7 @@ of a struct except that they cannot be used as field names in
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Given a struct type <code>S</code> and a type name
|
Given a struct type <code>S</code> and a <a href="#Types">named type</a>
|
||||||
<code>T</code>, promoted methods are included in the method set of the struct as follows:
|
<code>T</code>, promoted methods are included in the method set of the struct as follows:
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
@ -1197,7 +1200,7 @@ type (
|
|||||||
<p>
|
<p>
|
||||||
A pointer type denotes the set of all pointers to <a href="#Variables">variables</a> of a given
|
A pointer type denotes the set of all pointers to <a href="#Variables">variables</a> of a given
|
||||||
type, called the <i>base type</i> of the pointer.
|
type, called the <i>base type</i> of the pointer.
|
||||||
The <a href="#Representation_of_values">value</a> of an uninitialized pointer is <code>nil</code>.
|
The value of an uninitialized pointer is <code>nil</code>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
@ -1213,9 +1216,9 @@ BaseType = Type .
|
|||||||
<h3 id="Function_types">Function types</h3>
|
<h3 id="Function_types">Function types</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
A function type denotes the set of all functions with the same parameter and result types.
|
A function type denotes the set of all functions with the same parameter
|
||||||
The <a href="#Representation_of_values">value</a> of an uninitialized variable of function
|
and result types. The value of an uninitialized variable of function type
|
||||||
type is <code>nil</code>.
|
is <code>nil</code>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
@ -1264,8 +1267,7 @@ An interface type defines a <i>type set</i>.
|
|||||||
A variable of interface type can store a value of any type that is in the type
|
A variable of interface type can store a value of any type that is in the type
|
||||||
set of the interface. Such a type is said to
|
set of the interface. Such a type is said to
|
||||||
<a href="#Implementing_an_interface">implement the interface</a>.
|
<a href="#Implementing_an_interface">implement the interface</a>.
|
||||||
The <a href="#Representation_of_values">value</a> of an uninitialized variable of
|
The value of an uninitialized variable of interface type is <code>nil</code>.
|
||||||
interface type is <code>nil</code>.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
@ -1628,7 +1630,7 @@ implements the interface.
|
|||||||
A map is an unordered group of elements of one type, called the
|
A map is an unordered group of elements of one type, called the
|
||||||
element type, indexed by a set of unique <i>keys</i> of another type,
|
element type, indexed by a set of unique <i>keys</i> of another type,
|
||||||
called the key type.
|
called the key type.
|
||||||
The <a href="#Representation_of_values">value</a> of an uninitialized map is <code>nil</code>.
|
The value of an uninitialized map is <code>nil</code>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
@ -1691,7 +1693,7 @@ to communicate by
|
|||||||
<a href="#Send_statements">sending</a> and
|
<a href="#Send_statements">sending</a> and
|
||||||
<a href="#Receive_operator">receiving</a>
|
<a href="#Receive_operator">receiving</a>
|
||||||
values of a specified element type.
|
values of a specified element type.
|
||||||
The <a href="#Representation_of_values">value</a> of an uninitialized channel is <code>nil</code>.
|
The value of an uninitialized channel is <code>nil</code>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
@ -1770,57 +1772,6 @@ received in the order sent.
|
|||||||
|
|
||||||
<h2 id="Properties_of_types_and_values">Properties of types and values</h2>
|
<h2 id="Properties_of_types_and_values">Properties of types and values</h2>
|
||||||
|
|
||||||
<h3 id="Representation_of_values">Representation of values</h3>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Values of predeclared types (see below for the interfaces <code>any</code>
|
|
||||||
and <code>error</code>), arrays, and structs are self-contained:
|
|
||||||
Each such value contains a complete copy of all its data,
|
|
||||||
and <a href="#Variables">variables</a> of such types store the entire value.
|
|
||||||
For instance, an array variable provides the storage (the variables)
|
|
||||||
for all elements of the array.
|
|
||||||
The respective <a href="#The_zero_value">zero values</a> are specific to the
|
|
||||||
value's types; they are never <code>nil</code>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Non-nil pointer, function, slice, map, and channel values contain references
|
|
||||||
to underlying data which may be shared by multiple values:
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
A pointer value is a reference to the variable holding
|
|
||||||
the pointer base type value.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
A function value contains references to the (possibly
|
|
||||||
<a href="#Function_literals">anonymous</a>) function
|
|
||||||
and enclosed variables.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
A slice value contains the slice length, capacity, and
|
|
||||||
a reference to its <a href="#Slice_types">underlying array</a>.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
A map or channel value is a reference to the implementation-specific
|
|
||||||
data structure of the map or channel.
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
An interface value may be self-contained or contain references to underlying data
|
|
||||||
depending on the interface's <a href="#Variables">dynamic type</a>.
|
|
||||||
The predeclared identifier <code>nil</code> is the zero value for types whose values
|
|
||||||
can contain references.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
When multiple values share underlying data, changing one value may change another.
|
|
||||||
For instance, changing an element of a <a href="#Slice_types">slice</a> will change
|
|
||||||
that element in the underlying array for all slices that share the array.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h3 id="Underlying_types">Underlying types</h3>
|
<h3 id="Underlying_types">Underlying types</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -1856,10 +1807,110 @@ The underlying type of <code>[]B1</code>, <code>B3</code>, and <code>B4</code> i
|
|||||||
The underlying type of <code>P</code> is <code>interface{}</code>.
|
The underlying type of <code>P</code> is <code>interface{}</code>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<h3 id="Core_types">Core types</h3>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Each non-interface type <code>T</code> has a <i>core type</i>, which is the same as the
|
||||||
|
<a href="#Underlying_types">underlying type</a> of <code>T</code>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
An interface <code>T</code> has a core type if one of the following
|
||||||
|
conditions is satisfied:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
There is a single type <code>U</code> which is the <a href="#Underlying_types">underlying type</a>
|
||||||
|
of all types in the <a href="#Interface_types">type set</a> of <code>T</code>; or
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
the type set of <code>T</code> contains only <a href="#Channel_types">channel types</a>
|
||||||
|
with identical element type <code>E</code>, and all directional channels have the same
|
||||||
|
direction.
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
No other interfaces have a core type.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The core type of an interface is, depending on the condition that is satisfied, either:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
the type <code>U</code>; or
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
the type <code>chan E</code> if <code>T</code> contains only bidirectional
|
||||||
|
channels, or the type <code>chan<- E</code> or <code><-chan E</code>
|
||||||
|
depending on the direction of the directional channels present.
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
By definition, a core type is never a <a href="#Type_definitions">defined type</a>,
|
||||||
|
<a href="#Type_parameter_declarations">type parameter</a>, or
|
||||||
|
<a href="#Interface_types">interface type</a>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Examples of interfaces with core types:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
type Celsius float32
|
||||||
|
type Kelvin float32
|
||||||
|
|
||||||
|
interface{ int } // int
|
||||||
|
interface{ Celsius|Kelvin } // float32
|
||||||
|
interface{ ~chan int } // chan int
|
||||||
|
interface{ ~chan int|~chan<- int } // chan<- int
|
||||||
|
interface{ ~[]*data; String() string } // []*data
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Examples of interfaces without core types:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
interface{} // no single underlying type
|
||||||
|
interface{ Celsius|float64 } // no single underlying type
|
||||||
|
interface{ chan int | chan<- string } // channels have different element types
|
||||||
|
interface{ <-chan int | chan<- int } // directional channels have different directions
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Some operations (<a href="#Slice_expressions">slice expressions</a>,
|
||||||
|
<a href="#Appending_and_copying_slices"><code>append</code> and <code>copy</code></a>)
|
||||||
|
rely on a slightly more loose form of core types which accept byte slices and strings.
|
||||||
|
Specifically, if there are exactly two types, <code>[]byte</code> and <code>string</code>,
|
||||||
|
which are the underlying types of all types in the type set of interface <code>T</code>,
|
||||||
|
the core type of <code>T</code> is called <code>bytestring</code>.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Examples of interfaces with <code>bytestring</code> core types:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
interface{ int } // int (same as ordinary core type)
|
||||||
|
interface{ []byte | string } // bytestring
|
||||||
|
interface{ ~[]byte | myString } // bytestring
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Note that <code>bytestring</code> is not a real type; it cannot be used to declare
|
||||||
|
variables or compose other types. It exists solely to describe the behavior of some
|
||||||
|
operations that read from a sequence of bytes, which may be a byte slice or a string.
|
||||||
|
</p>
|
||||||
|
|
||||||
<h3 id="Type_identity">Type identity</h3>
|
<h3 id="Type_identity">Type identity</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Two types are either <i>identical</i> ("the same") or <i>different</i>.
|
Two types are either <i>identical</i> or <i>different</i>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -1876,8 +1927,8 @@ components have identical types. In detail:
|
|||||||
<li>Two slice types are identical if they have identical element types.</li>
|
<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,
|
<li>Two struct types are identical if they have the same sequence of fields,
|
||||||
and if corresponding pairs of fields have the same names, identical types,
|
and if corresponding fields have the same names, and identical types,
|
||||||
and identical tags, and are either both embedded or both not embedded.
|
and identical tags.
|
||||||
<a href="#Exported_identifiers">Non-exported</a> field names from different
|
<a href="#Exported_identifiers">Non-exported</a> field names from different
|
||||||
packages are always different.</li>
|
packages are always different.</li>
|
||||||
|
|
||||||
@ -2460,12 +2511,12 @@ An alias declaration binds an identifier to the given type
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
AliasDecl = identifier [ TypeParameters ] "=" Type .
|
AliasDecl = identifier "=" Type .
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Within the <a href="#Declarations_and_scope">scope</a> of
|
Within the <a href="#Declarations_and_scope">scope</a> of
|
||||||
the identifier, it serves as an <i>alias</i> for the given type.
|
the identifier, it serves as an <i>alias</i> for the type.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@ -2475,24 +2526,6 @@ type (
|
|||||||
)
|
)
|
||||||
</pre>
|
</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>
|
<h4 id="Type_definitions">Type definitions</h4>
|
||||||
|
|
||||||
@ -2768,7 +2801,7 @@ values or variables, or components of other, non-interface types.
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
A type argument <code>T</code><i> satisfies</i> a type constraint <code>C</code>
|
A type argument <code>T</code><i> satisfies</i> a type constraint <code>C</code>
|
||||||
if <code>T</code> is an element of the type set defined by <code>C</code>; in other words,
|
if <code>T</code> is an element of the type set defined by <code>C</code>; i.e.,
|
||||||
if <code>T</code> <a href="#Implementing_an_interface">implements</a> <code>C</code>.
|
if <code>T</code> <a href="#Implementing_an_interface">implements</a> <code>C</code>.
|
||||||
As an exception, a <a href="#Comparison_operators">strictly comparable</a>
|
As an exception, a <a href="#Comparison_operators">strictly comparable</a>
|
||||||
type constraint may also be satisfied by a <a href="#Comparison_operators">comparable</a>
|
type constraint may also be satisfied by a <a href="#Comparison_operators">comparable</a>
|
||||||
@ -2848,7 +2881,7 @@ initialization value in the assignment.
|
|||||||
If that value is an untyped constant, it is first implicitly
|
If that value is an untyped constant, it is first implicitly
|
||||||
<a href="#Conversions">converted</a> to its <a href="#Constants">default type</a>;
|
<a href="#Conversions">converted</a> to its <a href="#Constants">default type</a>;
|
||||||
if it is an untyped boolean value, it is first implicitly converted to type <code>bool</code>.
|
if it is an untyped boolean value, it is first implicitly converted to type <code>bool</code>.
|
||||||
The predeclared identifier <code>nil</code> cannot be used to initialize a variable
|
The predeclared value <code>nil</code> cannot be used to initialize a variable
|
||||||
with no explicit type.
|
with no explicit type.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -3042,7 +3075,7 @@ to the base type <code>Point</code>.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If the receiver base type is a <a href="#Type_definitions">generic type</a>, the
|
If the receiver base type is a <a href="#Type_declarations">generic type</a>, the
|
||||||
receiver specification must declare corresponding type parameters for the method
|
receiver specification must declare corresponding type parameters for the method
|
||||||
to use. This makes the receiver type parameters available to the method.
|
to use. This makes the receiver type parameters available to the method.
|
||||||
Syntactically, this type parameter declaration looks like an
|
Syntactically, this type parameter declaration looks like an
|
||||||
@ -3066,22 +3099,6 @@ func (p Pair[A, B]) Swap() Pair[B, A] { … } // receiver declares A, B
|
|||||||
func (p Pair[First, _]) First() First { … } // receiver declares First, corresponds to A in Pair
|
func (p Pair[First, _]) First() First { … } // receiver declares First, corresponds to A in Pair
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
|
||||||
If the receiver type is denoted by (a pointer to) an <a href="#Alias_declarations">alias</a>,
|
|
||||||
the alias must not be generic and it must not denote an instantiated generic type, neither
|
|
||||||
directly nor indirectly via another alias, and irrespective of pointer indirections.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
type GPoint[P any] = Point
|
|
||||||
type HPoint = *GPoint[int]
|
|
||||||
type IPair = Pair[int, int]
|
|
||||||
|
|
||||||
func (*GPoint[P]) Draw(P) { … } // illegal: alias must not be generic
|
|
||||||
func (HPoint) Draw(P) { … } // illegal: alias must not denote instantiated type GPoint[int]
|
|
||||||
func (*IPair) Second() int { … } // illegal: alias must not denote instantiated type Pair[int, int]
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<h2 id="Expressions">Expressions</h2>
|
<h2 id="Expressions">Expressions</h2>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -3153,8 +3170,7 @@ math.Sin // denotes the Sin function in package math
|
|||||||
<h3 id="Composite_literals">Composite literals</h3>
|
<h3 id="Composite_literals">Composite literals</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Composite literals construct new values for structs, arrays, slices, and maps
|
Composite literals construct new composite values each time they are evaluated.
|
||||||
each time they are evaluated.
|
|
||||||
They consist of the type of the literal followed by a brace-bound list of elements.
|
They consist of the type of the literal followed by a brace-bound list of elements.
|
||||||
Each element may optionally be preceded by a corresponding key.
|
Each element may optionally be preceded by a corresponding key.
|
||||||
</p>
|
</p>
|
||||||
@ -3172,14 +3188,10 @@ Element = Expression | LiteralValue .
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Unless the LiteralType is a type parameter,
|
The LiteralType's <a href="#Core_types">core type</a> <code>T</code>
|
||||||
its <a href="#Underlying_types">underlying type
|
|
||||||
must be a struct, array, slice, or map type
|
must be a struct, array, slice, or map type
|
||||||
(the syntax enforces this constraint except when the type is given
|
(the syntax enforces this constraint except when the type is given
|
||||||
as a TypeName).
|
as a TypeName).
|
||||||
If the LiteralType is a type parameter, all types in its type set
|
|
||||||
must have the same underlying type which must be
|
|
||||||
a valid composite literal type.
|
|
||||||
The types of the elements and keys must be <a href="#Assignability">assignable</a>
|
The types of the elements and keys must be <a href="#Assignability">assignable</a>
|
||||||
to the respective field, element, and key types of type <code>T</code>;
|
to the respective field, element, and key types of type <code>T</code>;
|
||||||
there is no additional conversion.
|
there is no additional conversion.
|
||||||
@ -3364,6 +3376,7 @@ noteFrequency := map[string]float32{
|
|||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
||||||
<h3 id="Function_literals">Function literals</h3>
|
<h3 id="Function_literals">Function literals</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -3403,7 +3416,8 @@ Primary expressions are the operands for unary and binary expressions.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
PrimaryExpr = Operand |
|
PrimaryExpr =
|
||||||
|
Operand |
|
||||||
Conversion |
|
Conversion |
|
||||||
MethodExpr |
|
MethodExpr |
|
||||||
PrimaryExpr Selector |
|
PrimaryExpr Selector |
|
||||||
@ -3836,12 +3850,11 @@ The following rules apply:
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If <code>a</code> is neither a map nor a <a href="#Type_parameter_declarations">type parameter</a>:
|
If <code>a</code> is neither a map nor a type parameter:
|
||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>the index <code>x</code> must be an untyped constant, or its type must be
|
<li>the index <code>x</code> must be an untyped constant or its
|
||||||
an <a href="#Numeric_types">integer</a> or a type parameter whose type set
|
<a href="#Core_types">core type</a> must be an <a href="#Numeric_types">integer</a></li>
|
||||||
contains only integer types</li>
|
|
||||||
<li>a constant index must be non-negative and
|
<li>a constant index must be non-negative and
|
||||||
<a href="#Representability">representable</a> by a value of type <code>int</code></li>
|
<a href="#Representability">representable</a> by a value of type <code>int</code></li>
|
||||||
<li>a constant index that is untyped is given type <code>int</code></li>
|
<li>a constant index that is untyped is given type <code>int</code></li>
|
||||||
@ -3955,26 +3968,14 @@ Assigning to an element of a <code>nil</code> map causes a
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Slice expressions construct a substring or slice from a string, array, pointer
|
Slice expressions construct a substring or slice from a string, array, pointer
|
||||||
to array, or slice operand.
|
to array, or slice. There are two variants: a simple form that specifies a low
|
||||||
There are two variants: a simple form that specifies a low
|
|
||||||
and high bound, and a full form that also specifies a bound on the capacity.
|
and high bound, and a full form that also specifies a bound on the capacity.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
|
||||||
If the operand type is a <a href="#Type_parameter_declarations">type parameter</a>,
|
|
||||||
unless its type set contains string types,
|
|
||||||
all types in the type set must have the same underlying type, and the slice expression
|
|
||||||
must be valid for an operand of that type.
|
|
||||||
If the type set contains string types it may also contain byte slices with underlying
|
|
||||||
type <code>[]byte</code>.
|
|
||||||
In this case, the slice expression must be valid for an operand of <code>string</code>
|
|
||||||
type.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h4>Simple slice expressions</h4>
|
<h4>Simple slice expressions</h4>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
For a string, array, pointer to array, or slice <code>a</code>, the primary expression
|
The primary expression
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@ -3982,7 +3983,9 @@ a[low : high]
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
constructs a substring or slice.
|
constructs a substring or slice. The <a href="#Core_types">core type</a> of
|
||||||
|
<code>a</code> must be a string, array, pointer to array, slice, or a
|
||||||
|
<a href="#Core_types"><code>bytestring</code></a>.
|
||||||
The <i>indices</i> <code>low</code> and
|
The <i>indices</i> <code>low</code> and
|
||||||
<code>high</code> select which elements of operand <code>a</code> appear
|
<code>high</code> select which elements of operand <code>a</code> appear
|
||||||
in the result. The result has indices starting at 0 and length equal to
|
in the result. The result has indices starting at 0 and length equal to
|
||||||
@ -4062,7 +4065,7 @@ s3 := s[:0] // s3 == nil
|
|||||||
<h4>Full slice expressions</h4>
|
<h4>Full slice expressions</h4>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
For an array, pointer to array, or slice <code>a</code> (but not a string), the primary expression
|
The primary expression
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@ -4073,6 +4076,8 @@ a[low : high : max]
|
|||||||
constructs a slice of the same type, and with the same length and elements as the simple slice
|
constructs a slice of the same type, and with the same length and elements as the simple slice
|
||||||
expression <code>a[low : high]</code>. Additionally, it controls the resulting slice's capacity
|
expression <code>a[low : high]</code>. Additionally, it controls the resulting slice's capacity
|
||||||
by setting it to <code>max - low</code>. Only the first index may be omitted; it defaults to 0.
|
by setting it to <code>max - low</code>. Only the first index may be omitted; it defaults to 0.
|
||||||
|
The <a href="#Core_types">core type</a> of <code>a</code> must be an array, pointer to array,
|
||||||
|
or slice (but not a string).
|
||||||
After slicing the array <code>a</code>
|
After slicing the array <code>a</code>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -4178,8 +4183,8 @@ No <a href="#Run_time_panics">run-time panic</a> occurs in this case.
|
|||||||
<h3 id="Calls">Calls</h3>
|
<h3 id="Calls">Calls</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Given an expression <code>f</code> of <a href="#Function_types">function type</a>
|
Given an expression <code>f</code> with a <a href="#Core_types">core type</a>
|
||||||
<code>F</code>,
|
<code>F</code> of <a href="#Function_types">function type</a>,
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@ -4191,7 +4196,8 @@ calls <code>f</code> with arguments <code>a1, a2, … an</code>.
|
|||||||
Except for one special case, arguments must be single-valued expressions
|
Except for one special case, arguments must be single-valued expressions
|
||||||
<a href="#Assignability">assignable</a> to the parameter types of
|
<a href="#Assignability">assignable</a> to the parameter types of
|
||||||
<code>F</code> and are evaluated before the function is called.
|
<code>F</code> and are evaluated before the function is called.
|
||||||
The type of the expression is the result type of <code>F</code>.
|
The type of the expression is the result type
|
||||||
|
of <code>F</code>.
|
||||||
A method invocation is similar but the method itself
|
A method invocation is similar but the method itself
|
||||||
is specified as a selector upon a value of the receiver type for
|
is specified as a selector upon a value of the receiver type for
|
||||||
the method.
|
the method.
|
||||||
@ -4209,23 +4215,12 @@ If <code>f</code> denotes a generic function, it must be
|
|||||||
or used as a function value.
|
or used as a function value.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
|
||||||
If the type of <code>f</code> is a <a href="#Type_parameter_declarations">type parameter</a>,
|
|
||||||
all types in its type set must have the same underlying type, which must be a function type,
|
|
||||||
and the function call must be valid for that type.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
In a function call, the function value and arguments are evaluated in
|
In a function call, the function value and arguments are evaluated in
|
||||||
<a href="#Order_of_evaluation">the usual order</a>.
|
<a href="#Order_of_evaluation">the usual order</a>.
|
||||||
After they are evaluated, new storage is allocated for the function's
|
After they are evaluated, the parameters of the call are passed by value to the function
|
||||||
<a href="#Variables">variables</a>, which includes its parameters
|
|
||||||
and results.
|
|
||||||
Then, the arguments of the call are <i>passed</i> to the function,
|
|
||||||
which means that they are <a href="#Assignment_statements">assigned</a>
|
|
||||||
to their corresponding function parameters,
|
|
||||||
and the called function begins execution.
|
and the called function begins execution.
|
||||||
The return parameters of the function are passed
|
The return parameters of the function are passed by value
|
||||||
back to the caller when the function returns.
|
back to the caller when the function returns.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -4239,9 +4234,9 @@ As a special case, if the return values of a function or method
|
|||||||
<code>g</code> are equal in number and individually
|
<code>g</code> are equal in number and individually
|
||||||
assignable to the parameters of another function or method
|
assignable to the parameters of another function or method
|
||||||
<code>f</code>, then the call <code>f(g(<i>parameters_of_g</i>))</code>
|
<code>f</code>, then the call <code>f(g(<i>parameters_of_g</i>))</code>
|
||||||
will invoke <code>f</code> after passing the return values of
|
will invoke <code>f</code> after binding the return values of
|
||||||
<code>g</code> to the parameters of <code>f</code> in order.
|
<code>g</code> to the parameters of <code>f</code> in order. The call
|
||||||
The call of <code>f</code> must contain no parameters other than the call of <code>g</code>,
|
of <code>f</code> must contain no parameters other than the call of <code>g</code>,
|
||||||
and <code>g</code> must have at least one return value.
|
and <code>g</code> must have at least one return value.
|
||||||
If <code>f</code> has a final <code>...</code> parameter, it is
|
If <code>f</code> has a final <code>...</code> parameter, it is
|
||||||
assigned the return values of <code>g</code> that remain after
|
assigned the return values of <code>g</code> that remain after
|
||||||
@ -4287,7 +4282,7 @@ If <code>f</code> is <a href="#Function_types">variadic</a> with a final
|
|||||||
parameter <code>p</code> of type <code>...T</code>, then within <code>f</code>
|
parameter <code>p</code> of type <code>...T</code>, then within <code>f</code>
|
||||||
the type of <code>p</code> is equivalent to type <code>[]T</code>.
|
the type of <code>p</code> is equivalent to type <code>[]T</code>.
|
||||||
If <code>f</code> is invoked with no actual arguments for <code>p</code>,
|
If <code>f</code> is invoked with no actual arguments for <code>p</code>,
|
||||||
the value <a href="#Calls">passed</a> to <code>p</code> is <code>nil</code>.
|
the value passed to <code>p</code> is <code>nil</code>.
|
||||||
Otherwise, the value passed is a new slice
|
Otherwise, the value passed is a new slice
|
||||||
of type <code>[]T</code> with a new underlying array whose successive elements
|
of type <code>[]T</code> with a new underlying array whose successive elements
|
||||||
are the actual arguments, which all must be <a href="#Assignability">assignable</a>
|
are the actual arguments, which all must be <a href="#Assignability">assignable</a>
|
||||||
@ -4728,28 +4723,17 @@ more complicated:
|
|||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
If all types in <code>C</code>'s type set have the same
|
If <code>C</code> has a <a href="#Core_types">core type</a>
|
||||||
underlying type <code>U</code>,
|
<code>core(C)</code>
|
||||||
and <code>P</code> has a known type argument <code>A</code>,
|
and <code>P</code> has a known type argument <code>A</code>,
|
||||||
<code>U</code> and <code>A</code> must unify loosely.
|
<code>core(C)</code> and <code>A</code> must unify loosely.
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
Similarly, if all types in <code>C</code>'s type set are
|
|
||||||
channel types with the same element type and non-conflicting
|
|
||||||
channel directions,
|
|
||||||
and <code>P</code> has a known type argument <code>A</code>,
|
|
||||||
the most restrictive channel type in <code>C</code>'s type
|
|
||||||
set and <code>A</code> must unify loosely.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
If <code>P</code> does not have a known type argument
|
If <code>P</code> does not have a known type argument
|
||||||
and <code>C</code> contains exactly one type term <code>T</code>
|
and <code>C</code> contains exactly one type term <code>T</code>
|
||||||
that is not an underlying (tilde) type, unification adds the
|
that is not an underlying (tilde) type, unification adds the
|
||||||
mapping <code>P ➞ T</code> to the map.
|
mapping <code>P ➞ T</code> to the map.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
If <code>C</code> does not have a type <code>U</code>
|
If <code>C</code> does not have a core type
|
||||||
as described above
|
|
||||||
and <code>P</code> has a known type argument <code>A</code>,
|
and <code>P</code> has a known type argument <code>A</code>,
|
||||||
<code>A</code> must have all methods of <code>C</code>, if any,
|
<code>A</code> must have all methods of <code>C</code>, if any,
|
||||||
and corresponding method types must unify exactly.
|
and corresponding method types must unify exactly.
|
||||||
@ -5300,10 +5284,10 @@ var x *int = nil
|
|||||||
<h3 id="Receive_operator">Receive operator</h3>
|
<h3 id="Receive_operator">Receive operator</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
For an operand <code>ch</code> of <a href="#Channel_types">channel type</a>,
|
For an operand <code>ch</code> whose <a href="#Core_types">core type</a> is a
|
||||||
|
<a href="#Channel_types">channel</a>,
|
||||||
the value of the receive operation <code><-ch</code> is the value received
|
the value of the receive operation <code><-ch</code> is the value received
|
||||||
from the channel <code>ch</code>.
|
from the channel <code>ch</code>. The channel direction must permit receive operations,
|
||||||
The channel direction must permit receive operations,
|
|
||||||
and the type of the receive operation is the element type of the channel.
|
and the type of the receive operation is the element type of the channel.
|
||||||
The expression blocks until a value is available.
|
The expression blocks until a value is available.
|
||||||
Receiving from a <code>nil</code> channel blocks forever.
|
Receiving from a <code>nil</code> channel blocks forever.
|
||||||
@ -5319,12 +5303,6 @@ f(<-ch)
|
|||||||
<-strobe // wait until clock pulse and discard received value
|
<-strobe // wait until clock pulse and discard received value
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
|
||||||
If the operand type is a <a href="#Type_parameter_declarations">type parameter</a>,
|
|
||||||
all types in its type set must be channel types that permit receive operations, and
|
|
||||||
they must all have the same element type, which is the type of the receive operation.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
A receive expression used in an <a href="#Assignment_statements">assignment statement</a> or initialization of the special form
|
A receive expression used in an <a href="#Assignment_statements">assignment statement</a> or initialization of the special form
|
||||||
</p>
|
</p>
|
||||||
@ -5620,8 +5598,6 @@ myString([]myRune{0x1f30e}) // "\U0001f30e" == "🌎"
|
|||||||
<li>
|
<li>
|
||||||
Converting a value of a string type to a slice of bytes type
|
Converting a value of a string type to a slice of bytes type
|
||||||
yields a non-nil slice whose successive elements are the bytes of the string.
|
yields a non-nil slice whose successive elements are the bytes of the string.
|
||||||
The <a href="#Length_and_capacity">capacity</a> of the resulting slice is
|
|
||||||
implementation-specific and may be larger than the slice length.
|
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
[]byte("hellø") // []byte{'h', 'e', 'l', 'l', '\xc3', '\xb8'}
|
[]byte("hellø") // []byte{'h', 'e', 'l', 'l', '\xc3', '\xb8'}
|
||||||
@ -5637,8 +5613,6 @@ bytes("hellø") // []byte{'h', 'e', 'l', 'l', '\xc3', '\xb8'}
|
|||||||
<li>
|
<li>
|
||||||
Converting a value of a string type to a slice of runes type
|
Converting a value of a string type to a slice of runes type
|
||||||
yields a slice containing the individual Unicode code points of the string.
|
yields a slice containing the individual Unicode code points of the string.
|
||||||
The <a href="#Length_and_capacity">capacity</a> of the resulting slice is
|
|
||||||
implementation-specific and may be larger than the slice length.
|
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
[]rune(myString("白鵬翔")) // []rune{0x767d, 0x9d6c, 0x7fd4}
|
[]rune(myString("白鵬翔")) // []rune{0x767d, 0x9d6c, 0x7fd4}
|
||||||
@ -5840,7 +5814,7 @@ Otherwise, when evaluating the <a href="#Operands">operands</a> of an
|
|||||||
expression, assignment, or
|
expression, assignment, or
|
||||||
<a href="#Return_statements">return statement</a>,
|
<a href="#Return_statements">return statement</a>,
|
||||||
all function calls, method calls,
|
all function calls, method calls,
|
||||||
<a href="#Receive_operator">receive operations</a>,
|
<a href="#Receive operator">receive operations</a>,
|
||||||
and <a href="#Logical_operators">binary logical operations</a>
|
and <a href="#Logical_operators">binary logical operations</a>
|
||||||
are evaluated in lexical left-to-right order.
|
are evaluated in lexical left-to-right order.
|
||||||
</p>
|
</p>
|
||||||
@ -5908,7 +5882,8 @@ Statements control execution.
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="ebnf">
|
<pre class="ebnf">
|
||||||
Statement = Declaration | LabeledStmt | SimpleStmt |
|
Statement =
|
||||||
|
Declaration | LabeledStmt | SimpleStmt |
|
||||||
GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt |
|
GoStmt | ReturnStmt | BreakStmt | ContinueStmt | GotoStmt |
|
||||||
FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt |
|
FallthroughStmt | Block | IfStmt | SwitchStmt | SelectStmt | ForStmt |
|
||||||
DeferStmt .
|
DeferStmt .
|
||||||
@ -6060,7 +6035,8 @@ len("foo") // illegal if len is the built-in function
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
A send statement sends a value on a channel.
|
A send statement sends a value on a channel.
|
||||||
The channel expression must be of <a href="#Channel_types">channel type</a>,
|
The channel expression's <a href="#Core_types">core type</a>
|
||||||
|
must be a <a href="#Channel_types">channel</a>,
|
||||||
the channel direction must permit send operations,
|
the channel direction must permit send operations,
|
||||||
and the type of the value to be sent must be <a href="#Assignability">assignable</a>
|
and the type of the value to be sent must be <a href="#Assignability">assignable</a>
|
||||||
to the channel's element type.
|
to the channel's element type.
|
||||||
@ -6084,13 +6060,6 @@ A send on a <code>nil</code> channel blocks forever.
|
|||||||
ch <- 3 // send value 3 to channel ch
|
ch <- 3 // send value 3 to channel ch
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
|
||||||
If the type of the channel expression is a
|
|
||||||
<a href="#Type_parameter_declarations">type parameter</a>,
|
|
||||||
all types in its type set must be channel types that permit send operations,
|
|
||||||
they must all have the same element type,
|
|
||||||
and the type of the value to be sent must be assignable to that element type.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h3 id="IncDec_statements">IncDec statements</h3>
|
<h3 id="IncDec_statements">IncDec statements</h3>
|
||||||
|
|
||||||
@ -6258,26 +6227,6 @@ to the type of the operand to which it is assigned, with the following special c
|
|||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<p>
|
|
||||||
When a value is assigned to a variable, only the data that is stored in the variable
|
|
||||||
is replaced. If the value contains a <a href="#Representation_of_values">reference</a>,
|
|
||||||
the assignment copies the reference but does not make a copy of the referenced data
|
|
||||||
(such as the underlying array of a slice).
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
var s1 = []int{1, 2, 3}
|
|
||||||
var s2 = s1 // s2 stores the slice descriptor of s1
|
|
||||||
s1 = s1[:1] // s1's length is 1 but it still shares its underlying array with s2
|
|
||||||
s2[0] = 42 // setting s2[0] changes s1[0] as well
|
|
||||||
fmt.Println(s1, s2) // prints [42] [42 2 3]
|
|
||||||
|
|
||||||
var m1 = make(map[string]int)
|
|
||||||
var m2 = m1 // m2 stores the map descriptor of m1
|
|
||||||
m1["foo"] = 42 // setting m1["foo"] changes m2["foo"] as well
|
|
||||||
fmt.Println(m2["foo"]) // prints 42
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<h3 id="If_statements">If statements</h3>
|
<h3 id="If_statements">If statements</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -6683,7 +6632,8 @@ RangeClause = [ ExpressionList "=" | IdentifierList ":=" ] "range" Expression .
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
The expression on the right in the "range" clause is called the <i>range expression</i>,
|
The expression on the right in the "range" clause is called the <i>range expression</i>,
|
||||||
which may be an array, pointer to an array, slice, string, map, channel permitting
|
its <a href="#Core_types">core type</a> must be
|
||||||
|
an array, pointer to an array, slice, string, map, channel permitting
|
||||||
<a href="#Receive_operator">receive operations</a>, an integer, or
|
<a href="#Receive_operator">receive operations</a>, an integer, or
|
||||||
a function with specific signature (see below).
|
a function with specific signature (see below).
|
||||||
As with an assignment, if present the operands on the left must be
|
As with an assignment, if present the operands on the left must be
|
||||||
@ -6897,12 +6847,6 @@ for k, v := range t.Walk {
|
|||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
|
||||||
If the type of the range expression is a <a href="#Type_parameter_declarations">type parameter</a>,
|
|
||||||
all types in its type set must have the same underlying type and the range expression must be valid
|
|
||||||
for that type, or, if the type set contains channel types, it must only contain channel types with
|
|
||||||
identical element types, and all channel types must permit receive operations.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h3 id="Go_statements">Go statements</h3>
|
<h3 id="Go_statements">Go statements</h3>
|
||||||
|
|
||||||
@ -7376,28 +7320,23 @@ by the arguments overlaps.
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
The <a href="#Function_types">variadic</a> function <code>append</code>
|
The <a href="#Function_types">variadic</a> function <code>append</code>
|
||||||
appends zero or more values <code>x</code> to a slice <code>s</code> of
|
appends zero or more values <code>x</code> to a slice <code>s</code>
|
||||||
type <code>S</code> and returns the resulting slice, also of type
|
and returns the resulting slice of the same type as <code>s</code>.
|
||||||
<code>S</code>.
|
The <a href="#Core_types">core type</a> of <code>s</code> must be a slice
|
||||||
|
of type <code>[]E</code>.
|
||||||
The values <code>x</code> are passed to a parameter of type <code>...E</code>
|
The values <code>x</code> are passed to a parameter of type <code>...E</code>
|
||||||
where <code>E</code> is the element type of <code>S</code>
|
|
||||||
and the respective <a href="#Passing_arguments_to_..._parameters">parameter
|
and the respective <a href="#Passing_arguments_to_..._parameters">parameter
|
||||||
passing rules</a> apply.
|
passing rules</a> apply.
|
||||||
As a special case, <code>append</code> also accepts a first argument assignable
|
As a special case, if the core type of <code>s</code> is <code>[]byte</code>,
|
||||||
to type <code>[]byte</code> with a second argument of string type followed by
|
<code>append</code> also accepts a second argument with core type
|
||||||
<code>...</code>.
|
<a href="#Core_types"><code>bytestring</code></a> followed by <code>...</code>.
|
||||||
This form appends the bytes of the string.
|
This form appends the bytes of the byte slice or string.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="grammar">
|
<pre class="grammar">
|
||||||
append(s S, x ...E) S // E is the element type of S
|
append(s S, x ...E) S // core type of S is []E
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
|
||||||
If <code>S</code> is a <a href="#Type_parameter_declarations">type parameter</a>,
|
|
||||||
all types in its type set must have the same underlying slice type <code>[]E</code>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
If the capacity of <code>s</code> is not large enough to fit the additional
|
If the capacity of <code>s</code> is not large enough to fit the additional
|
||||||
values, <code>append</code> <a href="#Allocation">allocates</a> a new, sufficiently large underlying
|
values, <code>append</code> <a href="#Allocation">allocates</a> a new, sufficiently large underlying
|
||||||
@ -7423,14 +7362,14 @@ b = append(b, "bar"...) // append string contents b is []byte{'b
|
|||||||
The function <code>copy</code> copies slice elements from
|
The function <code>copy</code> copies slice elements from
|
||||||
a source <code>src</code> to a destination <code>dst</code> and returns the
|
a source <code>src</code> to a destination <code>dst</code> and returns the
|
||||||
number of elements copied.
|
number of elements copied.
|
||||||
Both arguments must have <a href="#Type_identity">identical</a> element type
|
The <a href="#Core_types">core types</a> of both arguments must be slices
|
||||||
<code>E</code> and must be assignable to a slice of type <code>[]E</code>.
|
with <a href="#Type_identity">identical</a> element type.
|
||||||
The number of elements copied is the minimum of
|
The number of elements copied is the minimum of
|
||||||
<code>len(src)</code> and <code>len(dst)</code>.
|
<code>len(src)</code> and <code>len(dst)</code>.
|
||||||
As a special case, <code>copy</code> also accepts a destination argument
|
As a special case, if the destination's core type is <code>[]byte</code>,
|
||||||
assignable to type <code>[]byte</code> with a source argument of a
|
<code>copy</code> also accepts a source argument with core type
|
||||||
<code>string</code> type.
|
<a href="#Core_types"><code>bytestring</code></a>.
|
||||||
This form copies the bytes from the string into the byte slice.
|
This form copies the bytes from the byte slice or string into the byte slice.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="grammar">
|
<pre class="grammar">
|
||||||
@ -7438,11 +7377,6 @@ copy(dst, src []T) int
|
|||||||
copy(dst []byte, src string) int
|
copy(dst []byte, src string) int
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
|
||||||
If the type of one or both arguments is a <a href="#Type_parameter_declarations">type parameter</a>,
|
|
||||||
all types in their respective type sets must have the same underlying slice type <code>[]E</code>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Examples:
|
Examples:
|
||||||
</p>
|
</p>
|
||||||
@ -7493,7 +7427,8 @@ If the map or slice is <code>nil</code>, <code>clear</code> is a no-op.
|
|||||||
<h3 id="Close">Close</h3>
|
<h3 id="Close">Close</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
For a channel <code>ch</code>, the built-in function <code>close(ch)</code>
|
For an argument <code>ch</code> with a <a href="#Core_types">core type</a>
|
||||||
|
that is a <a href="#Channel_types">channel</a>, the built-in function <code>close</code>
|
||||||
records that no more values will be sent on the channel.
|
records that no more values will be sent on the channel.
|
||||||
It is an error if <code>ch</code> is a receive-only channel.
|
It is an error if <code>ch</code> is a receive-only channel.
|
||||||
Sending to or closing a closed channel causes a <a href="#Run_time_panics">run-time panic</a>.
|
Sending to or closing a closed channel causes a <a href="#Run_time_panics">run-time panic</a>.
|
||||||
@ -7505,12 +7440,6 @@ The multi-valued <a href="#Receive_operator">receive operation</a>
|
|||||||
returns a received value along with an indication of whether the channel is closed.
|
returns a received value along with an indication of whether the channel is closed.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
|
||||||
If the type of the argument to <code>close</code> is a
|
|
||||||
<a href="#Type_parameter_declarations">type parameter</a>,
|
|
||||||
all types in its type set must be channels with the same element type.
|
|
||||||
It is an error if any of those channels is a receive-only channel.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<h3 id="Complex_numbers">Manipulating complex numbers</h3>
|
<h3 id="Complex_numbers">Manipulating complex numbers</h3>
|
||||||
|
|
||||||
@ -7680,15 +7609,16 @@ var z complex128
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
The built-in function <code>make</code> takes a type <code>T</code>,
|
The built-in function <code>make</code> takes a type <code>T</code>,
|
||||||
which must be a slice, map or channel type, or a type parameter,
|
|
||||||
optionally followed by a type-specific list of expressions.
|
optionally followed by a type-specific list of expressions.
|
||||||
|
The <a href="#Core_types">core type</a> of <code>T</code> must
|
||||||
|
be a slice, map or channel.
|
||||||
It returns a value of type <code>T</code> (not <code>*T</code>).
|
It returns a value of type <code>T</code> (not <code>*T</code>).
|
||||||
The memory is initialized as described in the section on
|
The memory is initialized as described in the section on
|
||||||
<a href="#The_zero_value">initial values</a>.
|
<a href="#The_zero_value">initial values</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre class="grammar">
|
<pre class="grammar">
|
||||||
Call Type T Result
|
Call Core type Result
|
||||||
|
|
||||||
make(T, n) slice slice of type T with length n and capacity n
|
make(T, n) slice slice of type T with length n and capacity n
|
||||||
make(T, n, m) slice slice of type T with length n and capacity m
|
make(T, n, m) slice slice of type T with length n and capacity m
|
||||||
@ -7698,18 +7628,8 @@ make(T, n) map map of type T with initial space for approxim
|
|||||||
|
|
||||||
make(T) channel unbuffered channel of type T
|
make(T) channel unbuffered channel of type T
|
||||||
make(T, n) channel buffered channel of type T, buffer size n
|
make(T, n) channel buffered channel of type T, buffer size n
|
||||||
|
|
||||||
make(T, n) type parameter see below
|
|
||||||
make(T, n, m) type parameter see below
|
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
|
||||||
If the first argument is a <a href="#Type_parameter_declarations">type parameter</a>,
|
|
||||||
all types in its type set must have the same underlying type, which must be a slice
|
|
||||||
or map type, or, if there are channel types, there must only be channel types, they
|
|
||||||
must all have the same element type, and the channel directions must not conflict.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Each of the size arguments <code>n</code> and <code>m</code> must be of <a href="#Numeric_types">integer type</a>,
|
Each of the size arguments <code>n</code> and <code>m</code> must be of <a href="#Numeric_types">integer type</a>,
|
||||||
have a <a href="#Interface_types">type set</a> containing only integer types,
|
have a <a href="#Interface_types">type set</a> containing only integer types,
|
||||||
@ -7894,7 +7814,7 @@ causes a <a href="#Run_time_panics">run-time panic</a>.
|
|||||||
<p>
|
<p>
|
||||||
The <code>protect</code> function in the example below invokes
|
The <code>protect</code> function in the example below invokes
|
||||||
the function argument <code>g</code> and protects callers from
|
the function argument <code>g</code> and protects callers from
|
||||||
run-time panics caused by <code>g</code>.
|
run-time panics raised by <code>g</code>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@ -8452,14 +8372,17 @@ func String(ptr *byte, len IntegerType) string
|
|||||||
func StringData(str string) *byte
|
func StringData(str string) *byte
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
These conversions also apply to type parameters with suitable core types.
|
||||||
|
Determine if we can simply use core type instead of underlying type here,
|
||||||
|
of if the general conversion rules take care of this.
|
||||||
|
-->
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
A <code>Pointer</code> is a <a href="#Pointer_types">pointer type</a> but a <code>Pointer</code>
|
A <code>Pointer</code> is a <a href="#Pointer_types">pointer type</a> but a <code>Pointer</code>
|
||||||
value may not be <a href="#Address_operators">dereferenced</a>.
|
value may not be <a href="#Address_operators">dereferenced</a>.
|
||||||
Any pointer or value of <a href="#Underlying_types">underlying type</a> <code>uintptr</code> can be
|
Any pointer or value of <a href="#Core_types">core type</a> <code>uintptr</code> can be
|
||||||
<a href="#Conversions">converted</a> to a type of underlying type <code>Pointer</code> and vice versa.
|
<a href="#Conversions">converted</a> to a type of core type <code>Pointer</code> and vice versa.
|
||||||
If the respective types are <a href="#Type_parameter_declarations">type parameters</a>, all types in
|
|
||||||
their respective type sets must have the same underlying type, which must be <code>uintptr</code> and
|
|
||||||
<code>Pointer</code>, respectively.
|
|
||||||
The effect of converting between <code>Pointer</code> and <code>uintptr</code> is implementation-defined.
|
The effect of converting between <code>Pointer</code> and <code>uintptr</code> is implementation-defined.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@ -8480,7 +8403,7 @@ var p ptr = nil
|
|||||||
<p>
|
<p>
|
||||||
The functions <code>Alignof</code> and <code>Sizeof</code> take an expression <code>x</code>
|
The functions <code>Alignof</code> and <code>Sizeof</code> take an expression <code>x</code>
|
||||||
of any type and return the alignment or size, respectively, of a hypothetical variable <code>v</code>
|
of any type and return the alignment or size, respectively, of a hypothetical variable <code>v</code>
|
||||||
as if <code>v</code> were declared via <code>var v = x</code>.
|
as if <code>v</code> was declared via <code>var v = x</code>.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The function <code>Offsetof</code> takes a (possibly parenthesized) <a href="#Selectors">selector</a>
|
The function <code>Offsetof</code> takes a (possibly parenthesized) <a href="#Selectors">selector</a>
|
||||||
@ -8764,15 +8687,6 @@ integer values from zero to an upper limit.
|
|||||||
function as range expression.
|
function as range expression.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</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>
|
<h3 id="Type_unification_rules">Type unification rules</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -8813,9 +8727,9 @@ following conditions is true:
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Exactly one type is an <a href="#Type_inference">unbound</a>
|
Exactly one type is an <a href="#Type_inference">unbound</a>
|
||||||
type parameter, and all the types in its type set unify with
|
type parameter with a <a href="#Core_types">core type</a>,
|
||||||
the other type
|
and that core type unifies with the other type per the
|
||||||
per the unification rules for <code>≡<sub>A</sub></code>
|
unification rules for <code>≡<sub>A</sub></code>
|
||||||
(loose unification at the top level and exact unification
|
(loose unification at the top level and exact unification
|
||||||
for element types).
|
for element types).
|
||||||
</li>
|
</li>
|
||||||
|
122
doc/godebug.md
122
doc/godebug.md
@ -34,7 +34,6 @@ For example, if a Go program is running in an environment that contains
|
|||||||
|
|
||||||
then that Go program will disable the use of HTTP/2 by default in both
|
then that Go program will disable the use of HTTP/2 by default in both
|
||||||
the HTTP client and the HTTP server.
|
the HTTP client and the HTTP server.
|
||||||
Unrecognized settings in the `GODEBUG` environment variable are ignored.
|
|
||||||
It is also possible to set the default `GODEBUG` for a given program
|
It is also possible to set the default `GODEBUG` for a given program
|
||||||
(discussed below).
|
(discussed below).
|
||||||
|
|
||||||
@ -109,9 +108,7 @@ Only the work module's `go.mod` is consulted for `godebug` directives.
|
|||||||
Any directives in required dependency modules are ignored.
|
Any directives in required dependency modules are ignored.
|
||||||
It is an error to list a `godebug` with an unrecognized setting.
|
It is an error to list a `godebug` with an unrecognized setting.
|
||||||
(Toolchains older than Go 1.23 reject all `godebug` lines, since they do not
|
(Toolchains older than Go 1.23 reject all `godebug` lines, since they do not
|
||||||
understand `godebug` at all.) When a workspace is in use, `godebug`
|
understand `godebug` at all.)
|
||||||
directives in `go.mod` files are ignored, and `go.work` will be consulted
|
|
||||||
for `godebug` directives instead.
|
|
||||||
|
|
||||||
The defaults from the `go` and `godebug` lines apply to all main
|
The defaults from the `go` and `godebug` lines apply to all main
|
||||||
packages that are built. For more fine-grained control,
|
packages that are built. For more fine-grained control,
|
||||||
@ -153,117 +150,6 @@ for example,
|
|||||||
see the [runtime documentation](/pkg/runtime#hdr-Environment_Variables)
|
see the [runtime documentation](/pkg/runtime#hdr-Environment_Variables)
|
||||||
and the [go command documentation](/cmd/go#hdr-Build_and_test_caching).
|
and the [go command documentation](/cmd/go#hdr-Build_and_test_caching).
|
||||||
|
|
||||||
### Go 1.25
|
|
||||||
|
|
||||||
Go 1.25 added a new `decoratemappings` setting that controls whether the Go
|
|
||||||
runtime annotates OS anonymous memory mappings with context about their
|
|
||||||
purpose. These annotations appear in /proc/self/maps and /proc/self/smaps as
|
|
||||||
"[anon: Go: ...]". This setting is only used on Linux. For Go 1.25, it defaults
|
|
||||||
to `decoratemappings=1`, enabling annotations. Using `decoratemappings=0`
|
|
||||||
reverts to the pre-Go 1.25 behavior. This setting is fixed at program startup
|
|
||||||
time, and can't be modified by changing the `GODEBUG` environment variable
|
|
||||||
after the program starts.
|
|
||||||
|
|
||||||
Go 1.25 added a new `embedfollowsymlinks` setting that controls whether the
|
|
||||||
Go command will follow symlinks to regular files embedding files.
|
|
||||||
The default value `embedfollowsymlinks=0` does not allow following
|
|
||||||
symlinks. `embedfollowsymlinks=1` will allow following symlinks.
|
|
||||||
|
|
||||||
Go 1.25 added a new `containermaxprocs` setting that controls whether the Go
|
|
||||||
runtime will consider cgroup CPU limits when setting the default GOMAXPROCS.
|
|
||||||
The default value `containermaxprocs=1` will use cgroup limits in addition to
|
|
||||||
the total logical CPU count and CPU affinity. `containermaxprocs=0` will
|
|
||||||
disable consideration of cgroup limits. This setting only affects Linux.
|
|
||||||
|
|
||||||
Go 1.25 added a new `updatemaxprocs` setting that controls whether the Go
|
|
||||||
runtime will periodically update GOMAXPROCS for new CPU affinity or cgroup
|
|
||||||
limits. The default value `updatemaxprocs=1` will enable periodic updates.
|
|
||||||
`updatemaxprocs=0` will disable periodic updates.
|
|
||||||
|
|
||||||
Go 1.25 disabled SHA-1 signature algorithms in TLS 1.2 according to RFC 9155.
|
|
||||||
The default can be reverted using the `tlssha1=1` setting.
|
|
||||||
|
|
||||||
Go 1.25 switched to SHA-256 to fill in missing SubjectKeyId in
|
|
||||||
crypto/x509.CreateCertificate. The setting `x509sha256skid=0` reverts to SHA-1.
|
|
||||||
|
|
||||||
Go 1.25 corrected the semantics of contention reports for runtime-internal locks,
|
|
||||||
and so removed the [`runtimecontentionstacks` setting](/pkg/runtime#hdr-Environment_Variable).
|
|
||||||
|
|
||||||
### Go 1.24
|
|
||||||
|
|
||||||
Go 1.24 added a new `fips140` setting that controls whether the Go
|
|
||||||
Cryptographic Module operates in FIPS 140-3 mode.
|
|
||||||
The possible values are:
|
|
||||||
- "off": no special support for FIPS 140-3 mode. This is the default.
|
|
||||||
- "on": the Go Cryptographic Module operates in FIPS 140-3 mode.
|
|
||||||
- "only": like "on", but cryptographic algorithms not approved by
|
|
||||||
FIPS 140-3 return an error or panic.
|
|
||||||
For more information, see [FIPS 140-3 Compliance](/doc/security/fips140).
|
|
||||||
This setting is fixed at program startup time, and can't be modified
|
|
||||||
by changing the `GODEBUG` environment variable after the program starts.
|
|
||||||
|
|
||||||
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 listeners. Using multipathtcp="0" reverts to the
|
|
||||||
pre-Go 1.24 behavior.
|
|
||||||
|
|
||||||
Go 1.24 changed the behavior of `go test -json` to emit build errors as JSON
|
|
||||||
instead of text.
|
|
||||||
These new JSON events are distinguished by new `Action` values,
|
|
||||||
but can still cause problems with CI systems that aren't robust to these events.
|
|
||||||
This behavior can be controlled with the `gotestjsonbuildtext` setting.
|
|
||||||
Using `gotestjsonbuildtext=1` restores the 1.23 behavior.
|
|
||||||
This setting will be removed in a future release, Go 1.28 at the earliest.
|
|
||||||
|
|
||||||
Go 1.24 changed [`crypto/rsa`](/pkg/crypto/rsa) to require RSA keys to be at
|
|
||||||
least 1024 bits. This behavior can be controlled with the `rsa1024min` setting.
|
|
||||||
Using `rsa1024min=0` restores the Go 1.23 behavior.
|
|
||||||
|
|
||||||
Go 1.24 introduced a mechanism for enabling platform specific Data Independent
|
|
||||||
Timing (DIT) modes in the [`crypto/subtle`](/pkg/crypto/subtle) package. This
|
|
||||||
mode can be enabled for an entire program with the `dataindependenttiming` setting.
|
|
||||||
For Go 1.24 it defaults to `dataindependenttiming=0`. There is no change in default
|
|
||||||
behavior from Go 1.23 when `dataindependenttiming` is unset.
|
|
||||||
Using `dataindependenttiming=1` enables the DIT mode for the entire Go program.
|
|
||||||
When enabled, DIT will be enabled when calling into C from Go. When enabled,
|
|
||||||
calling into Go code from C will enable DIT, and disable it before returning to
|
|
||||||
C if it was not enabled when Go code was entered.
|
|
||||||
This currently only affects arm64 programs. For all other platforms it is a no-op.
|
|
||||||
|
|
||||||
Go 1.24 removed the `x509sha1` setting. `crypto/x509` no longer supports verifying
|
|
||||||
signatures on certificates that use SHA-1 based signature algorithms.
|
|
||||||
|
|
||||||
Go 1.24 changes the default value of the [`x509usepolicies`
|
|
||||||
setting.](/pkg/crypto/x509/#CreateCertificate) from `0` to `1`. When marshalling
|
|
||||||
certificates, policies are now taken from the
|
|
||||||
[`Certificate.Policies`](/pkg/crypto/x509/#Certificate.Policies) field rather
|
|
||||||
than the
|
|
||||||
[`Certificate.PolicyIdentifiers`](/pkg/crypto/x509/#Certificate.PolicyIdentifiers)
|
|
||||||
field by default.
|
|
||||||
|
|
||||||
Go 1.24 enabled the post-quantum key exchange mechanism
|
|
||||||
X25519MLKEM768 by default. The default can be reverted using the
|
|
||||||
[`tlsmlkem` setting](/pkg/crypto/tls/#Config.CurvePreferences).
|
|
||||||
This can be useful when dealing with buggy TLS servers that do not handle large records correctly,
|
|
||||||
causing a timeout during the handshake (see [TLS post-quantum TL;DR fail](https://tldr.fail/)).
|
|
||||||
Go 1.24 also removed X25519Kyber768Draft00 and the Go 1.23 `tlskyber` setting.
|
|
||||||
|
|
||||||
Go 1.24 made [`ParsePKCS1PrivateKey`](/pkg/crypto/x509/#ParsePKCS1PrivateKey)
|
|
||||||
use and validate the CRT parameters in the encoded private key. This behavior
|
|
||||||
can be controlled with the `x509rsacrt` setting. Using `x509rsacrt=0` restores
|
|
||||||
the Go 1.23 behavior.
|
|
||||||
|
|
||||||
### Go 1.23
|
### Go 1.23
|
||||||
|
|
||||||
Go 1.23 changed the channels created by package time to be unbuffered
|
Go 1.23 changed the channels created by package time to be unbuffered
|
||||||
@ -293,8 +179,6 @@ Previous versions default to `winreadlinkvolume=0`.
|
|||||||
Go 1.23 enabled the experimental post-quantum key exchange mechanism
|
Go 1.23 enabled the experimental post-quantum key exchange mechanism
|
||||||
X25519Kyber768Draft00 by default. The default can be reverted using the
|
X25519Kyber768Draft00 by default. The default can be reverted using the
|
||||||
[`tlskyber` setting](/pkg/crypto/tls/#Config.CurvePreferences).
|
[`tlskyber` setting](/pkg/crypto/tls/#Config.CurvePreferences).
|
||||||
This can be useful when dealing with buggy TLS servers that do not handle large records correctly,
|
|
||||||
causing a timeout during the handshake (see [TLS post-quantum TL;DR fail](https://tldr.fail/)).
|
|
||||||
|
|
||||||
Go 1.23 changed the behavior of
|
Go 1.23 changed the behavior of
|
||||||
[crypto/x509.ParseCertificate](/pkg/crypto/x509/#ParseCertificate) to reject
|
[crypto/x509.ParseCertificate](/pkg/crypto/x509/#ParseCertificate) to reject
|
||||||
@ -390,7 +274,7 @@ certificate policy OIDs with components larger than 31 bits. By default this
|
|||||||
field is only used during parsing, when it is populated with policy OIDs, but
|
field is only used during parsing, when it is populated with policy OIDs, but
|
||||||
not used during marshaling. It can be used to marshal these larger OIDs, instead
|
not used during marshaling. It can be used to marshal these larger OIDs, instead
|
||||||
of the existing PolicyIdentifiers field, by using the
|
of the existing PolicyIdentifiers field, by using the
|
||||||
[`x509usepolicies` setting](/pkg/crypto/x509/#CreateCertificate).
|
[`x509usepolicies` setting.](/pkg/crypto/x509/#CreateCertificate).
|
||||||
|
|
||||||
|
|
||||||
### Go 1.21
|
### Go 1.21
|
||||||
@ -458,7 +342,7 @@ There is no plan to remove this setting.
|
|||||||
|
|
||||||
Go 1.18 removed support for SHA1 in most X.509 certificates,
|
Go 1.18 removed support for SHA1 in most X.509 certificates,
|
||||||
controlled by the [`x509sha1` setting](/pkg/crypto/x509#InsecureAlgorithmError).
|
controlled by the [`x509sha1` setting](/pkg/crypto/x509#InsecureAlgorithmError).
|
||||||
This setting was removed in Go 1.24.
|
This setting will be removed in a future release, Go 1.22 at the earliest.
|
||||||
|
|
||||||
### Go 1.10
|
### Go 1.10
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
<!--
|
||||||
|
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>
|
<style>
|
||||||
main ul li { margin: 0.5em 0; }
|
main ul li { margin: 0.5em 0; }
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
### Minor changes to the library {#minor_library_changes}
|
### Minor changes to the library {#minor_library_changes}
|
||||||
|
|
||||||
#### go/types
|
|
||||||
|
|
||||||
The `Var.Kind` method returns an enumeration of type `VarKind` that
|
|
||||||
classifies the variable (package-level, local, receiver, parameter,
|
|
||||||
result, or struct field). See issue #70250.
|
|
||||||
|
|
||||||
Callers of `NewVar` or `NewParam` are encouraged to call `Var.SetKind`
|
|
||||||
to ensure that this attribute is set correctly in all cases.
|
|
||||||
|
@ -1,8 +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>
|
<style>
|
||||||
main ul li { margin: 0.5em 0; }
|
main ul li { margin: 0.5em 0; }
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
## DRAFT RELEASE NOTES — Introduction to Go 1.N {#introduction}
|
## DRAFT RELEASE NOTES — Introduction to Go 1.23 {#introduction}
|
||||||
|
|
||||||
**Go 1.25 is not yet released. These are work-in-progress release notes.
|
**Go 1.23 is not yet released. These are work-in-progress release notes.
|
||||||
Go 1.25 is expected to be released in August 2025.**
|
Go 1.23 is expected to be released in August 2024.**
|
||||||
|
@ -1,3 +1,18 @@
|
|||||||
## Changes to the language {#language}
|
## Changes to the language {#language}
|
||||||
|
|
||||||
|
<!-- go.dev/issue/61405, CL 557835, CL 584596 -->
|
||||||
|
Go 1.23 makes the (Go 1.22) ["range-over-func" experiment](/wiki/RangefuncExperiment) a part of the language.
|
||||||
|
The "range" clause in a "for-range" loop now accepts iterator functions of the following types
|
||||||
|
|
||||||
|
func(func() bool)
|
||||||
|
func(func(K) bool)
|
||||||
|
func(func(K, V) bool)
|
||||||
|
|
||||||
|
as range expressions.
|
||||||
|
Calls of the iterator argument function produce the iteration values for the "for-range" loop.
|
||||||
|
For details see the [iter] package documentation and the [language spec](/ref/spec#For_range).
|
||||||
|
For motivation see the 2022 ["range-over-func" discussion](/issue/56413).
|
||||||
|
|
||||||
|
<!-- go.dev/issue/46477, CL 566856, CL 586955, CL 586956 -->
|
||||||
|
Go 1.23 includes preview support for [generic type aliases](/issue/46477).
|
||||||
|
Building the toolchain with `GOEXPERIMENT=aliastypeparams` enables this feature.
|
||||||
|
@ -1,42 +1,84 @@
|
|||||||
## Tools {#tools}
|
## Tools {#tools}
|
||||||
|
|
||||||
|
### Telemetry
|
||||||
|
|
||||||
|
<!-- go.dev/issue/58894, go.dev/issue/67111 -->
|
||||||
|
Starting in Go 1.23, the Go toolchain can collect usage and breakage
|
||||||
|
statistics that help the Go team understand how the Go toolchain is
|
||||||
|
used and how well it is working. We refer to these statistics as
|
||||||
|
[Go telemetry](/doc/telemetry).
|
||||||
|
|
||||||
|
Go telemetry is an _opt-in system_, controlled by the
|
||||||
|
[`go` `telemetry` command](/cmd/go/#hdr-Manage_telemetry_data_and_settings).
|
||||||
|
By default, the toolchain programs
|
||||||
|
collect statistics in counter files that can be inspected locally
|
||||||
|
but are otherwise unused (`go` `telemetry` `local`).
|
||||||
|
|
||||||
|
To help us keep Go working well and understand Go usage,
|
||||||
|
please consider opting in to Go telemetry by running
|
||||||
|
`go` `telemetry` `on`.
|
||||||
|
In that mode,
|
||||||
|
anonymous counter reports are uploaded to
|
||||||
|
[telemetry.go.dev](https://telemetry.go.dev) weekly,
|
||||||
|
where they are aggregated into graphs and also made
|
||||||
|
available for download by any Go contributors or users
|
||||||
|
wanting to analyze the data.
|
||||||
|
See “[Go Telemetry](/doc/telemetry)” for more details
|
||||||
|
about the Go Telemetry system.
|
||||||
|
|
||||||
### Go command {#go-command}
|
### Go command {#go-command}
|
||||||
|
|
||||||
The `go build` `-asan` option now defaults to doing leak detection at
|
Setting the `GOROOT_FINAL` environment variable no longer has an effect
|
||||||
program exit.
|
([#62047](/issue/62047)).
|
||||||
This will report an error if memory allocated by C is not freed and is
|
Distributions that install the `go` command to a location other than
|
||||||
not referenced by any other memory allocated by either C or Go.
|
`$GOROOT/bin/go` should install a symlink instead of relocating
|
||||||
These new error reports may be disabled by setting
|
or copying the `go` binary.
|
||||||
`ASAN_OPTIONS=detect_leaks=0` in the environment when running the
|
|
||||||
program.
|
|
||||||
|
|
||||||
<!-- go.dev/issue/71294 -->
|
<!-- go.dev/issue/34208, CL 563137, CL 586095 -->
|
||||||
|
The new `go` `env` `-changed` flag causes the command to print only
|
||||||
|
those settings whose effective value differs from the default value
|
||||||
|
that would be obtained in an empty environment with no prior uses of the `-w` flag.
|
||||||
|
|
||||||
The new `work` package pattern matches all packages in the work (formerly called main)
|
<!-- go.dev/issue/27005, CL 585401 -->
|
||||||
modules: either the single work module in module mode or the set of workspace modules
|
The new `go` `mod` `tidy` `-diff` flag causes the command not to modify
|
||||||
in workspace mode.
|
the files but instead print the necessary changes as a unified diff.
|
||||||
|
It exits with a non-zero code if updates are needed.
|
||||||
|
|
||||||
<!-- go.dev/issue/65847 -->
|
<!-- go.dev/issue/52792, CL 562775 -->
|
||||||
|
The `go` `list` `-m` `-json` command now includes new `Sum` and `GoModSum` fields.
|
||||||
|
This is similar to the existing behavior of the `go` `mod` `download` `-json` command.
|
||||||
|
|
||||||
When the go command updates the `go` line in a `go.mod` or `go.work` file,
|
<!-- go.dev/issue/65573 ("cmd/go: separate default GODEBUGs from go language version") -->
|
||||||
it [no longer](/ref/mod#go-mod-file-toolchain) adds a toolchain line
|
The new `godebug` directive in `go.mod` and `go.work` declares a
|
||||||
specifying the command's current version.
|
[GODEBUG setting](/doc/godebug) to apply for the work module or workspace in use.
|
||||||
|
|
||||||
### Cgo {#cgo}
|
|
||||||
|
|
||||||
### Vet {#vet}
|
### Vet {#vet}
|
||||||
|
|
||||||
The `go vet` command includes new analyzers:
|
<!-- go.dev/issue/46136 -->
|
||||||
|
The `go vet` subcommand now includes the
|
||||||
|
[stdversion](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/stdversion)
|
||||||
|
analyzer, which flags references to symbols that are too new for the version
|
||||||
|
of Go in effect in the referring file. (The effective version is determined
|
||||||
|
by the `go` directive in the file's enclosing `go.mod` file, and
|
||||||
|
by any [`//go:build` constraints](/cmd/go#hdr-Build_constraints)
|
||||||
|
in the file.)
|
||||||
|
|
||||||
<!-- go.dev/issue/18022 -->
|
For example, it will report a diagnostic for a reference to the
|
||||||
|
`reflect.TypeFor` function (introduced in go1.22) from a file in a
|
||||||
|
module whose go.mod file specifies `go 1.21`.
|
||||||
|
|
||||||
- [waitgroup](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/waitgroup),
|
### Cgo {#cgo}
|
||||||
which reports misplaced calls to [sync.WaitGroup.Add]; and
|
|
||||||
|
|
||||||
<!-- go.dev/issue/28308 -->
|
<!-- go.dev/issue/66456 -->
|
||||||
|
[cmd/cgo] supports the new `-ldflags` flag for passing flags to the C linker.
|
||||||
|
The `go` command uses it automatically, avoiding "argument list too long"
|
||||||
|
errors with a very large `CGO_LDFLAGS`.
|
||||||
|
|
||||||
- [hostport](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/hostport),
|
### Trace {#trace}
|
||||||
which reports uses of `fmt.Sprintf("%s:%d", host, port)` to
|
|
||||||
construct addresses for [net.Dial], as these will not work with
|
|
||||||
IPv6; instead it suggests using [net.JoinHostPort].
|
|
||||||
|
|
||||||
|
<!-- go.dev/issue/65316 -->
|
||||||
|
The `trace` tool now better tolerates partially broken traces by attempting to
|
||||||
|
recover what trace data it can. This functionality is particularly helpful when
|
||||||
|
viewing a trace that was collected during a program crash, since the trace data
|
||||||
|
leading up to the crash will now [be recoverable](/issue/65319) under most
|
||||||
|
circumstances.
|
||||||
|
@ -1,63 +1,7 @@
|
|||||||
## Runtime {#runtime}
|
## Runtime {#runtime}
|
||||||
|
|
||||||
<!-- go.dev/issue/71517 -->
|
The traceback printed by the runtime after an unhandled panic or other
|
||||||
|
fatal error now indents the second and subsequent lines of the error
|
||||||
The message printed when a program exits due to an unhandled panic
|
message (for example, the argument to panic) by a single tab, so that
|
||||||
that was recovered and repanicked no longer repeats the text of
|
it can be unambiguously distinguished from the stack trace of the
|
||||||
the panic value.
|
first goroutine. See [#64590](/issue/64590) for discussion.
|
||||||
|
|
||||||
Previously, a program which panicked with `panic("PANIC")`,
|
|
||||||
recovered the panic, and then repanicked with the original
|
|
||||||
value would print:
|
|
||||||
|
|
||||||
panic: PANIC [recovered]
|
|
||||||
panic: PANIC
|
|
||||||
|
|
||||||
This program will now print:
|
|
||||||
|
|
||||||
panic: PANIC [recovered, repanicked]
|
|
||||||
|
|
||||||
<!-- go.dev/issue/73193 -->
|
|
||||||
|
|
||||||
The default behavior of the `GOMAXPROCS` has changed. In prior versions of Go,
|
|
||||||
`GOMAXPROCS` defaults to the number of logical CPUs available at startup
|
|
||||||
([runtime.NumCPU]). Go 1.25 introduces two changes:
|
|
||||||
|
|
||||||
1. On Linux, the runtime considers the CPU bandwidth limit of the cgroup
|
|
||||||
containing the process, if any. If the CPU bandwidth limit is lower than the
|
|
||||||
number of logical CPUs available, `GOMAXPROCS` will default to the lower
|
|
||||||
limit. In container runtime systems like Kubernetes, cgroup CPU bandwidth
|
|
||||||
limits generally correspond to the "CPU limit" option. The Go runtime does
|
|
||||||
not consider the "CPU requests" option.
|
|
||||||
|
|
||||||
2. On all OSes, the runtime periodically updates `GOMAXPROCS` if the number
|
|
||||||
of logical CPUs available or the cgroup CPU bandwidth limit change.
|
|
||||||
|
|
||||||
Both of these behaviors are automatically disabled if `GOMAXPROCS` is set
|
|
||||||
manually via the `GOMAXPROCS` environment variable or a call to
|
|
||||||
[runtime.GOMAXPROCS]. They can also be disabled explicitly with the [GODEBUG
|
|
||||||
settings](/doc/godebug) `containermaxprocs=0` and `updatemaxprocs=0`,
|
|
||||||
respectively.
|
|
||||||
|
|
||||||
In order to support reading updated cgroup limits, the runtime will keep cached
|
|
||||||
file descriptors for the cgroup files for the duration of the process lifetime.
|
|
||||||
|
|
||||||
<!-- go.dev/issue/71546 -->
|
|
||||||
|
|
||||||
On Linux systems with kernel support for anonymous VMA names
|
|
||||||
(`CONFIG_ANON_VMA_NAME`), the Go runtime will annotate anonymous memory
|
|
||||||
mappings with context about their purpose. e.g., `[anon: Go: heap]` for heap
|
|
||||||
memory. This can be disabled with the [GODEBUG setting](/doc/godebug)
|
|
||||||
`decoratemappings=0`.
|
|
||||||
|
|
||||||
<!-- go.dev/issue/73581 -->
|
|
||||||
|
|
||||||
A new experimental garbage collector is now available as an experiment. The
|
|
||||||
new design aims to improve the efficiency of garbage collection through better
|
|
||||||
locality and CPU scalability in the mark algorithm. Benchmark result vary, but
|
|
||||||
we expect somewhere between a 10—40% reduction in garbage collection overhead
|
|
||||||
in real-world programs that heavily use the garbage collector.
|
|
||||||
|
|
||||||
The new garbage collector may be enabled by setting `GOEXPERIMENT=greenteagc`
|
|
||||||
at build time. See the [GitHub issue](/issue/73581) for more details on the design
|
|
||||||
and instructions on how to report feedback.
|
|
||||||
|
@ -1,44 +1,38 @@
|
|||||||
## Compiler {#compiler}
|
## Compiler {#compiler}
|
||||||
|
|
||||||
<!-- https://go.dev/issue/26379 -->
|
The build time overhead to building with [Profile Guided Optimization](/doc/pgo) has been reduced significantly.
|
||||||
|
Previously, large builds could see 100%+ build time increase from enabling PGO.
|
||||||
|
In Go 1.23, overhead should be in the single digit percentages.
|
||||||
|
|
||||||
The compiler and linker in Go 1.25 now generate debug information
|
<!-- https://go.dev/issue/62737 , https://golang.org/cl/576681, https://golang.org/cl/577615 -->
|
||||||
using [DWARF version 5](https://dwarfstd.org/dwarf5std.html); the
|
The compiler in Go 1.23 can now overlap the stack frame slots of local variables
|
||||||
newer DWARF version reduces the space required for debugging
|
accessed in disjoint regions of a function, which reduces stack usage
|
||||||
information in Go binaries.
|
for Go applications.
|
||||||
DWARF 5 generation is gated by the "dwarf5" GOEXPERIMENT; this
|
|
||||||
functionality can be disabled (for now) using GOEXPERIMENT=nodwarf5.
|
|
||||||
|
|
||||||
<!-- https://go.dev/issue/72860, CL 657715 -->
|
<!-- https://go.dev/cl/577935 -->
|
||||||
|
For 386 and amd64, the compiler will use information from PGO to align certain
|
||||||
The compiler [has been fixed](/cl/657715)
|
hot blocks in loops. This improves performance an additional 1-1.5% at
|
||||||
to ensure that nil pointer checks are performed promptly. Programs like the following,
|
a cost of an additional 0.1% text and binary size. This is currently only implemented
|
||||||
which used to execute successfully, will now panic with a nil-pointer exception:
|
on 386 and amd64 because it has not shown an improvement on other platforms.
|
||||||
|
Hot block alignment can be disabled with `-gcflags=[<packages>=]-d=alignhot=0`
|
||||||
```
|
|
||||||
package main
|
|
||||||
|
|
||||||
import "os"
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
f, err := os.Open("nonExistentFile")
|
|
||||||
name := f.Name()
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
println(name)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
This program is incorrect in that it uses the result of `os.Open` before checking
|
|
||||||
the error. The main result of `os.Open` can be a nil pointer if the error result is non-nil.
|
|
||||||
But because of [a compiler bug](/issue/72860), this program ran successfully under
|
|
||||||
Go versions 1.21 through 1.24 (in violation of the Go spec). It will no longer run
|
|
||||||
successfully in Go 1.25. If this change is affecting your code, the solution is to put
|
|
||||||
the non-nil error check earlier in your code, preferably immediately after
|
|
||||||
the error-generating statement.
|
|
||||||
|
|
||||||
## Assembler {#assembler}
|
## Assembler {#assembler}
|
||||||
|
|
||||||
## Linker {#linker}
|
## Linker {#linker}
|
||||||
|
|
||||||
|
<!-- go.dev/issue/67401, CL 585556, CL 587220, and many more -->
|
||||||
|
The linker now disallows using a `//go:linkname` directive to refer to
|
||||||
|
internal symbols in the standard library (including the runtime) that
|
||||||
|
are not marked with `//go:linkname` on their definitions.
|
||||||
|
Similarly, the linker disallows references to such symbols from assembly
|
||||||
|
code.
|
||||||
|
For backward compatibility, existing usages of `//go:linkname` found in
|
||||||
|
a large open-source code corpus remain supported.
|
||||||
|
Any new references to standard library internal symbols will be disallowed.
|
||||||
|
|
||||||
|
A linker command line flag `-checklinkname=0` can be used to disable
|
||||||
|
this check, for debugging and experimenting purposes.
|
||||||
|
|
||||||
|
<!-- CL 473495 -->
|
||||||
|
When building a dynamically linked ELF binary (including PIE binary), the
|
||||||
|
new `-bindnow` flag enables immediate function binding.
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
## Standard library {#library}
|
## Core library {#library}
|
||||||
|
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
### New testing/synctest package
|
|
||||||
|
|
||||||
The new [testing/synctest](/pkg/testing/synctest) package
|
|
||||||
provides support for testing concurrent code.
|
|
||||||
|
|
||||||
The [synctest.Test] function runs a test function in an isolated
|
|
||||||
"bubble". Within the bubble, [time](/pkg/time) package functions
|
|
||||||
operate on a fake clock.
|
|
||||||
|
|
||||||
The [synctest.Wait] function waits for all goroutines in the
|
|
||||||
current bubble to block.
|
|
32
doc/next/6-stdlib/1-time.md
Normal file
32
doc/next/6-stdlib/1-time.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
### Timer changes
|
||||||
|
|
||||||
|
Go 1.23 makes two significant changes to the implementation of
|
||||||
|
[time.Timer] and [time.Ticker].
|
||||||
|
|
||||||
|
<!-- go.dev/issue/61542 -->
|
||||||
|
First, `Timer`s and `Ticker`s that are no longer referred to by the program
|
||||||
|
become eligible for garbage collection immediately, even if their
|
||||||
|
`Stop` methods have not been called.
|
||||||
|
Earlier versions of Go did not collect unstopped `Timer`s until after
|
||||||
|
they had fired and never collected unstopped `Ticker`s.
|
||||||
|
|
||||||
|
<!-- go.dev/issue/37196 -->
|
||||||
|
Second, the timer channel associated with a `Timer` or `Ticker` is
|
||||||
|
now unbuffered, with capacity 0.
|
||||||
|
The main effect of this change is that Go now guarantees
|
||||||
|
that for any call to a `Reset` or `Stop` method, no stale values
|
||||||
|
prepared before that call will be sent or received after the call.
|
||||||
|
Earlier versions of Go used channels with a one-element buffer,
|
||||||
|
making it difficult to use `Reset` and `Stop` correctly.
|
||||||
|
A visible effect of this change is that `len` and `cap` of timer channels
|
||||||
|
now returns 0 instead of 1, which may affect programs that
|
||||||
|
poll the length to decide whether a receive on the timer channel
|
||||||
|
will succeed.
|
||||||
|
Such code should use a non-blocking receive instead.
|
||||||
|
|
||||||
|
These new behaviors are only enabled when the main Go program
|
||||||
|
is in a module with a `go.mod` `go` line using Go 1.23.0 or later.
|
||||||
|
When Go 1.23 builds older programs, the old behaviors remain in effect.
|
||||||
|
The new [GODEBUG setting](/doc/godebug) [`asynctimerchan=1`](/pkg/time/#NewTimer)
|
||||||
|
can be used to revert back to asynchronous channel behaviors
|
||||||
|
even when a program names Go 1.23.0 or later in its `go.mod` file.
|
13
doc/next/6-stdlib/2-unique.md
Normal file
13
doc/next/6-stdlib/2-unique.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
### New unique package
|
||||||
|
|
||||||
|
The new [unique] package provides facilities for
|
||||||
|
canonicalizing values (like "interning" or "hash-consing").
|
||||||
|
|
||||||
|
Any value of comparable type may be canonicalized with the new
|
||||||
|
`Make[T]` function, which produces a reference to a canonical copy of
|
||||||
|
the value in the form of a `Handle[T]`.
|
||||||
|
Two `Handle[T]` are equal if and only if the values used to produce the
|
||||||
|
handles are equal, allowing programs to deduplicate values and reduce
|
||||||
|
their memory footprint.
|
||||||
|
Comparing two `Handle[T]` values is efficient, reducing down to a simple
|
||||||
|
pointer comparison.
|
29
doc/next/6-stdlib/3-iter.md
Normal file
29
doc/next/6-stdlib/3-iter.md
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
### Iterators
|
||||||
|
|
||||||
|
The new [iter] package provides the basic definitions for working with
|
||||||
|
user-defined iterators.
|
||||||
|
|
||||||
|
The [slices] package adds several functions that work with iterators:
|
||||||
|
- [All](/pkg/slices#All) returns an iterator over slice indexes and values.
|
||||||
|
- [Values](/pkg/slices#Values) returns an iterator over slice elements.
|
||||||
|
- [Backward](/pkg/slices#Backward) returns an iterator that loops over
|
||||||
|
a slice backward.
|
||||||
|
- [Collect](/pkg/slices#Collect) collects values from an iterator into
|
||||||
|
a new slice.
|
||||||
|
- [AppendSeq](/pkg/slices#AppendSeq) appends values from an iterator to
|
||||||
|
an existing slice.
|
||||||
|
- [Sorted](/pkg/slices#Sorted) collects values from an iterator into a
|
||||||
|
new slice, and then sorts the slice.
|
||||||
|
- [SortedFunc](/pkg/slices#SortedFunc) is like `Sorted` but with a
|
||||||
|
comparison function.
|
||||||
|
- [SortedStableFunc](/pkg/slices#SortedStableFunc) is like `SortFunc`
|
||||||
|
but uses a stable sort algorithm.
|
||||||
|
- [Chunk](/pkg/slices#Chunk) returns an iterator over consecutive
|
||||||
|
sub-slices of up to n elements of a slice.
|
||||||
|
|
||||||
|
The [maps] package adds several functions that work with iterators:
|
||||||
|
- [All](/pkg/maps#All) returns an iterator over key-value pairs from a map.
|
||||||
|
- [Keys](/pkg/maps#Keys) returns an iterator over keys in a map.
|
||||||
|
- [Values](/pkg/maps#Values) returns an iterator over values in a map.
|
||||||
|
- [Insert](/pkg/maps#Insert) adds the key-value pairs from an iterator to an existing map.
|
||||||
|
- [Collect](/pkg/maps#Collect) collects key-value pairs from an iterator into a new map and returns it.
|
11
doc/next/6-stdlib/4-structs.md
Normal file
11
doc/next/6-stdlib/4-structs.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
### New structs package
|
||||||
|
|
||||||
|
The new [structs] package provides
|
||||||
|
types for struct fields that modify properties of
|
||||||
|
the containing struct type such as memory layout.
|
||||||
|
|
||||||
|
In this release, the only such type is
|
||||||
|
[`HostLayout`](/pkg/structs#HostLayout)
|
||||||
|
which indicates that a structure with a field of that
|
||||||
|
type has a layout that conforms to host platform
|
||||||
|
expectations.
|
@ -1,2 +0,0 @@
|
|||||||
The [*Writer.AddFS] implementation now supports symbolic links
|
|
||||||
for filesystems that implement [io/fs.ReadLinkFS].
|
|
4
doc/next/6-stdlib/99-minor/archive/tar/50102.md
Normal file
4
doc/next/6-stdlib/99-minor/archive/tar/50102.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
If the argument to [FileInfoHeader] implements the new [FileInfoNames]
|
||||||
|
interface, then the interface methods will be used to set the Uname/Gname
|
||||||
|
of the file header. This allows applications to override the system-dependent
|
||||||
|
Uname/Gname lookup.
|
@ -1 +0,0 @@
|
|||||||
[MessageSigner] is a new signing interface that can be implemented by signers that wish to hash the message to be signed themselves. A new function is also introduced, [SignMessage] which attempts to update a [Signer] interface to [MessageSigner], using the [MessageSigner.SignMessage] method if successful, and [Signer.Sign] if not. This can be used when code wishes to support both [Signer] and [MessageSigner].
|
|
@ -1,3 +0,0 @@
|
|||||||
The new [ParseRawPrivateKey], [ParseUncompressedPublicKey], [PrivateKey.Bytes],
|
|
||||||
and [PublicKey.Bytes] functions and methods implement low-level encodings,
|
|
||||||
replacing the need to use crypto/elliptic or math/big functions and methods.
|
|
@ -1,2 +0,0 @@
|
|||||||
The hidden and undocumented `Inverse` and `CombinedMult` methods on some [Curve]
|
|
||||||
implementations have been removed.
|
|
@ -1 +0,0 @@
|
|||||||
The new [SHA3.Clone] method implements [hash.Cloner](/pkg/hash#Cloner).
|
|
3
doc/next/6-stdlib/99-minor/crypto/tls/63369.md
Normal file
3
doc/next/6-stdlib/99-minor/crypto/tls/63369.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
The TLS client now supports the Encrypted Client Hello [draft specification](https://www.ietf.org/archive/id/draft-ietf-tls-esni-18.html).
|
||||||
|
This feature can be enabled by setting the [Config.EncryptedClientHelloConfigList]
|
||||||
|
field to an encoded ECHConfigList for the host that is being connected to.
|
3
doc/next/6-stdlib/99-minor/crypto/tls/63691.md
Normal file
3
doc/next/6-stdlib/99-minor/crypto/tls/63691.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
The [QUICConn] type used by QUIC implementations includes new events
|
||||||
|
reporting on the state of session resumption, and provides a way for
|
||||||
|
the QUIC layer to add data to session tickets and session cache entries.
|
3
doc/next/6-stdlib/99-minor/crypto/tls/66214.md
Normal file
3
doc/next/6-stdlib/99-minor/crypto/tls/66214.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
3DES cipher suites were removed from the default list used when
|
||||||
|
[Config.CipherSuites] is nil. The default can be reverted by adding `tls3des=1` to
|
||||||
|
the GODEBUG environment variable.
|
3
doc/next/6-stdlib/99-minor/crypto/tls/67061.md
Normal file
3
doc/next/6-stdlib/99-minor/crypto/tls/67061.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
The experimental post-quantum key exchange mechanism X25519Kyber768Draft00
|
||||||
|
is now enabled by default when [Config.CurvePreferences] is nil.
|
||||||
|
The default can be reverted by adding `tlskyber=0` to the GODEBUG environment variable.
|
3
doc/next/6-stdlib/99-minor/crypto/tls/67065.md
Normal file
3
doc/next/6-stdlib/99-minor/crypto/tls/67065.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Go 1.23 changed the behavior of [X509KeyPair] and [LoadX509KeyPair]
|
||||||
|
to populate the [Certificate.Leaf] field of the returned [Certificate].
|
||||||
|
The new `x509keypairleaf` [GODEBUG setting](/doc/godebug) is added for this behavior.
|
@ -1,2 +0,0 @@
|
|||||||
The new [ConnectionState.CurveID] field exposes the key exchange mechanism used
|
|
||||||
to establish the connection.
|
|
@ -1,3 +0,0 @@
|
|||||||
The new [Config.GetEncryptedClientHelloKeys] callback can be used to set the
|
|
||||||
[EncryptedClientHelloKey]s for a server to use when a client sends an Encrypted
|
|
||||||
Client Hello extension.
|
|
@ -1,3 +0,0 @@
|
|||||||
SHA-1 signature algorithms are now disallowed in TLS 1.2 handshakes, per
|
|
||||||
[RFC 9155](https://www.rfc-editor.org/rfc/rfc9155.html).
|
|
||||||
They can be re-enabled with the `tlssha1=1` GODEBUG option.
|
|
@ -1,2 +0,0 @@
|
|||||||
When [FIPS 140-3 mode](/doc/security/fips140) is enabled, Extended Master Secret
|
|
||||||
is now required in TLS 1.2, and Ed25519 and X25519MLKEM768 are now allowed.
|
|
@ -1 +0,0 @@
|
|||||||
TLS servers now prefer the highest supported protocol version, even if it isn't the client's most preferred protocol version.
|
|
3
doc/next/6-stdlib/99-minor/crypto/x509/45990.md
Normal file
3
doc/next/6-stdlib/99-minor/crypto/x509/45990.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[CreateCertificateRequest] now correct supports RSA-PSS signature algorithms.
|
||||||
|
|
||||||
|
[CreateCertificateRequest] and [CreateRevocationList] now verify the generated signature using the signer’s public key. If the signature is invalid, an error is returned. This has been the behavior of [CreateCertificate] since Go 1.16.
|
4
doc/next/6-stdlib/99-minor/crypto/x509/62048.md
Normal file
4
doc/next/6-stdlib/99-minor/crypto/x509/62048.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
The [`x509sha1` GODEBUG setting](/pkg/crypto/x509#InsecureAlgorithmError) will
|
||||||
|
be removed in the next Go major release (Go 1.24). This will mean that crypto/x509
|
||||||
|
will no longer support verifying signatures on certificates that use SHA-1 based
|
||||||
|
signature algorithms.
|
@ -1 +0,0 @@
|
|||||||
[CreateCertificate], [CreateCertificateRequest], and [CreateRevocationList] can now accept a [crypto.MessageSigner] signing interface as well as [crypto.Signer]. This allows these functions to use signers which implement "one-shot" signing interfaces, where hashing is done as part of the signing operation, instead of by the caller.
|
|
3
doc/next/6-stdlib/99-minor/crypto/x509/66249.md
Normal file
3
doc/next/6-stdlib/99-minor/crypto/x509/66249.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
The new [ParseOID] function parses a dot-encoded ASN.1 Object Identifier string.
|
||||||
|
The [OID] type now implements the [encoding.BinaryMarshaler],
|
||||||
|
[encoding.BinaryUnmarshaler], [encoding.TextMarshaler], [encoding.TextUnmarshaler] interfaces.
|
@ -1,2 +0,0 @@
|
|||||||
[CreateCertificate] now uses truncated SHA-256 to populate the `SubjectKeyId` if
|
|
||||||
it is missing. The GODEBUG setting `x509sha256skid=0` reverts to SHA-1.
|
|
3
doc/next/6-stdlib/99-minor/database/sql/64707.md
Normal file
3
doc/next/6-stdlib/99-minor/database/sql/64707.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Errors returned by [driver.Valuer] implementations are now wrapped for
|
||||||
|
improved error handling during operations like [DB.Query], [DB.Exec],
|
||||||
|
and [DB.QueryRow].
|
3
doc/next/6-stdlib/99-minor/debug/elf/66054.md
Normal file
3
doc/next/6-stdlib/99-minor/debug/elf/66054.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
The `debug/elf` package now defines [PT_OPENBSD_NOBTCFI]. This [ProgType] is
|
||||||
|
used to disable Branch Tracking Control Flow Integrity (BTCFI) enforcement
|
||||||
|
on OpenBSD binaries.
|
2
doc/next/6-stdlib/99-minor/debug/elf/66836.md
Normal file
2
doc/next/6-stdlib/99-minor/debug/elf/66836.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Now defines the symbol type constants [STT_RELC], [STT_SRELC], and
|
||||||
|
[STT_GNU_IFUNC].
|
@ -1,4 +0,0 @@
|
|||||||
The [debug/elf] package adds two new constants:
|
|
||||||
- [PT_RISCV_ATTRIBUTES]
|
|
||||||
- [SHT_RISCV_ATTRIBUTES]
|
|
||||||
for RISC-V ELF parsing.
|
|
3
doc/next/6-stdlib/99-minor/encoding/binary/60023.md
Normal file
3
doc/next/6-stdlib/99-minor/encoding/binary/60023.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
The new [Encode] and [Decode] functions are byte slice equivalents
|
||||||
|
to [Read] and [Write].
|
||||||
|
[Append] allows marshaling multiple data into the same byte slice.
|
2
doc/next/6-stdlib/99-minor/go/ast/66339.md
Normal file
2
doc/next/6-stdlib/99-minor/go/ast/66339.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
The new [Preorder] function returns a convenient iterator over all the
|
||||||
|
nodes of a syntax tree.
|
@ -1,4 +0,0 @@
|
|||||||
The new [PreorderStack] function, like [Inspect], traverses a syntax
|
|
||||||
tree and provides control over descent into subtrees, but as a
|
|
||||||
convenience it also provides the stack of enclosing nodes at each
|
|
||||||
point.
|
|
@ -1 +0,0 @@
|
|||||||
The [ParseDir] function is deprecated.
|
|
@ -1,4 +0,0 @@
|
|||||||
The new [FileSet.AddExistingFiles] method enables existing Files to be
|
|
||||||
added to a FileSet, or a FileSet to be constructed for an arbitrary
|
|
||||||
set of Files, alleviating the problems associated with a single global
|
|
||||||
FileSet in long-lived applications.
|
|
1
doc/next/6-stdlib/99-minor/go/types/46477.md
Normal file
1
doc/next/6-stdlib/99-minor/go/types/46477.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!-- see ../../../../2-language.md -->
|
3
doc/next/6-stdlib/99-minor/go/types/65772.md
Normal file
3
doc/next/6-stdlib/99-minor/go/types/65772.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
The [Func] type, which represents a function or method symbol, now
|
||||||
|
has a [Func.Signature] method that returns the function's type, which
|
||||||
|
is always a `Signature`.
|
3
doc/next/6-stdlib/99-minor/go/types/66559.md
Normal file
3
doc/next/6-stdlib/99-minor/go/types/66559.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
The [Alias] type now has an [Rhs] method that returns the type on the
|
||||||
|
right-hand side of its declaration: given `type A = B`, the `Rhs` of A
|
||||||
|
is B. ([#66559](/issue/66559))
|
2
doc/next/6-stdlib/99-minor/go/types/67143.md
Normal file
2
doc/next/6-stdlib/99-minor/go/types/67143.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
The methods [Alias.Origin], [Alias.SetTypeParams], [Alias.TypeParams],
|
||||||
|
and [Alias.TypeArgs] have been added. They are needed for generic alias types.
|
@ -1,3 +0,0 @@
|
|||||||
[Var] now has a [Var.Kind] method that classifies the variable as one
|
|
||||||
of: package-level, receiver, parameter, result, or local variable, or
|
|
||||||
a struct field.
|
|
@ -1,3 +0,0 @@
|
|||||||
The new [LookupSelection] function looks up the field or method of a
|
|
||||||
given name and receiver type, like the existing [LookupFieldOrMethod]
|
|
||||||
function, but returns the result in the form of a [Selection].
|
|
4
doc/next/6-stdlib/99-minor/go/types/cl-577715.md
Normal file
4
doc/next/6-stdlib/99-minor/go/types/cl-577715.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<!-- CL 577715, CL 579076 -->
|
||||||
|
By default, go/types now produces [Alias] type nodes for type aliases.
|
||||||
|
This behavior can be controlled by the `GODEBUG` `gotypesalias` flag.
|
||||||
|
Its default has changed from 0 in Go 1.22 to 1 in Go 1.23.
|
@ -1,3 +0,0 @@
|
|||||||
The new [XOF](/pkg/hash#XOF) interface can be implemented by "extendable output
|
|
||||||
functions", which are hash functions with arbitrary or unlimited output length
|
|
||||||
such as [SHAKE](https://pkg.go.dev/crypto/sha3#SHAKE).
|
|
@ -1,2 +0,0 @@
|
|||||||
Hashes implementing the new [Cloner] interface can return a copy of their state.
|
|
||||||
All standard library [Hash] implementations now implement [Cloner].
|
|
@ -1 +0,0 @@
|
|||||||
The new [Hash.Clone] method implements [hash.Cloner](/pkg/hash#Cloner).
|
|
@ -1 +0,0 @@
|
|||||||
A new [ReadLinkFS] interface provides the ability to read symbolic links in a filesystem.
|
|
1
doc/next/6-stdlib/99-minor/iter/61897.md
Normal file
1
doc/next/6-stdlib/99-minor/iter/61897.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!-- see ../../3-iter.md -->
|
@ -1 +0,0 @@
|
|||||||
[GroupAttrs] creates a group [Attr] from a slice of [Attr] values.
|
|
@ -1 +0,0 @@
|
|||||||
[Record] now has a Source() method, returning its source location or nil if unavailable.
|
|
1
doc/next/6-stdlib/99-minor/maps/61900.md
Normal file
1
doc/next/6-stdlib/99-minor/maps/61900.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!-- see ../../3-iter.md -->
|
2
doc/next/6-stdlib/99-minor/math/rand/v2/61716.md
Normal file
2
doc/next/6-stdlib/99-minor/math/rand/v2/61716.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
The [Uint] function and [Rand.Uint] method have been added.
|
||||||
|
They were inadvertently left out of Go 1.22.
|
1
doc/next/6-stdlib/99-minor/math/rand/v2/67059.md
Normal file
1
doc/next/6-stdlib/99-minor/math/rand/v2/67059.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
The new [ChaCha8.Read] method implements the [io.Reader] interface.
|
@ -1,2 +0,0 @@
|
|||||||
The new helper function [FieldContentDisposition] builds multipart
|
|
||||||
Content-Disposition header fields.
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user