mirror of
https://github.com/golang/go
synced 2024-11-26 01:57:56 -07:00
[release-branch.go1.23] all: merge master (8f1ec59
) into release-branch.go1.23
Merge List: + 2024-07-158f1ec59bdb
strings: re-introduce noescape wrapper + 2024-07-155d36bc18d5
net/http: document io.Seeker requirement for fs.FS arguments + 2024-07-12071b8d51c1
cmd: vendor golang.org/x/telemetry@268b4a8ec2d7 + 2024-07-124e77872d16
go/types: fix assertion failure when range over int is not permitted + 2024-07-128bc32ab6b1
os: clean up after TestIssue60181 + 2024-07-11b31e9a63a4
unsafe: say "functions like syscall.Syscall", not only Syscall + 2024-07-11a71bb570d0
all: make struct comments match struct names + 2024-07-11611f18c4e9
strings: more cross-references in docstrings + 2024-07-1108a6e080ca
database/sql/driver: fix name in comment + 2024-07-11dfaaa91f05
os: clarify that IsNotExist, IsExist, IsPermission and IsTimeout work with nil errors + 2024-07-105881d857c5
crypto/tls: add support for -expect-no-hrr to bogo_shim_test + 2024-07-10b3040679ad
math: remove riscv64 assembly implementations of rounding + 2024-07-1070e453b436
context: handle nil values for valueCtx.String() + 2024-07-09183a40db6d
runtime: avoid multiple records with identical stacks from MutexProfile + 2024-07-09e89e880eac
crypto/tls: add support for -reject-alpn and -decline-alpn flags to bogo_shim_test + 2024-07-0973186ba002
crypto/internal/cryptotest: add common tests for the hash.Hash interface + 2024-07-0887ec2c959c
testing: remove call to os.Exit in documentation for TestMain + 2024-07-086d89b38ed8
unsafe: clarify when String bytes can be modified + 2024-07-075565462a86
cmd/dist: remove iter,slices,maps test on GOEXPERIMENT=rangefunc + 2024-07-07b43d6c57de
io: add test for Pipe constructor allocations + 2024-07-07d0146bd85b
os/exec: only use cachedLookExtensions if Cmd.Path is unmodified + 2024-07-05ad77cefeb2
cmd/compile: correct RewriteMultiValueCall fatal message + 2024-07-05be152920b9
cmd/compile: fix ICE when compiling global a, b = f() + 2024-07-0382c14346d8
cmd/link: don't disable memory profiling when pprof.WriteHeapProfile is used + 2024-07-037d19d508a9
cmd/cgo: read CGO_LDFLAGS environment variable + 2024-07-035f50b1e3bf
cmd/compile: fix mis-compilation when switching over channels + 2024-07-0371f9dbb1e4
cmd/compile: emit error message on mismatch import path + 2024-07-03148755a27b
cmd/link: document -checklinkname option + 2024-07-02f12ac5be70
time: fix time zone parsing when format includes time zone seconds + 2024-07-0209aeb6e33a
os: add TODO about removing test exception + 2024-07-0194982a0782
cmd/go/internal/workcmd: remove a potentially confusing statement + 2024-07-01f71c00b616
cmd/link: align .reloc block starts by 32 bits for PE target + 2024-07-01d3c93f2f00
cmd/go: update go clean help message + 2024-07-01cdbf5f2f7e
sync: refer to Locker interface methods in RWMutex.RLocker doc + 2024-07-01c33144c47c
runtime: fix nil pointer in TestGoroutineParallelism2 when offline + 2024-06-2882c371a307
cmd/compile: drop internal range-over-func vars from DWARF output + 2024-06-28773767def0
net/http: avoid appending an existing trailing slash to path again + 2024-06-287f90b960a9
cmd/compile: don't elide zero extension on top of signed values + 2024-06-27ea537cca31
cmd/go/internal/help: add documentation for language version downgrading + 2024-06-27b0927fdd49
slices: update docs for All, Backward, Values + 2024-06-265a18e79687
cmd/link: don't skip code sign even if dsymutil didn't generate a file + 2024-06-265f319b7507
cmd/link: don't let dsymutil delete our temp directory + 2024-06-26a2e90be996
os: rewrite TestChtimesWithZeroTimes + 2024-06-2590bcc552c0
crypto/tls: apply QUIC session event flag to QUICResumeSession events + 2024-06-25b1fd047508
cmd/internal/obj/arm64: fix return with register + 2024-06-25b3b4556c24
cmd/compile: update README to reflect dead code elimination changes + 2024-06-2468315bc8ce
cmd: run go mod tidy after CL 593684 + 2024-06-24f214a76075
cmd/vendor: vendor x/telemetry@38a4430 + 2024-06-2429b1a6765f
net/http: document that Request.Clone does not deep copy Body + 2024-06-24cf54a3d114
crypto/tls: replay test recordings without network + 2024-06-24b98803e8e5
os: TestChtimes: separate hasNoatime + 2024-06-240def9d5c02
cmd/internal/obj/arm64: Enable arm64 assembler tests for cross-compiler builds + 2024-06-24085cf0fcdc
net/netip: add test that Compare and reflect.DeepEqual match + 2024-06-24740043f516
net/netip: unexport fields of addrDetail + 2024-06-23e8ee1dc4f9
cmd/link/internal/ld: handle "\r" in MinGW "--print-prog-name" output + 2024-06-2244f1870666
cmd/link: handle dynamic import variables on Darwin in plugin mode + 2024-06-210af2148fdc
cmd: vendor golang.org/x/telemetry@a740542 + 2024-06-21cb3b34349b
doc/next: delete + 2024-06-21d79c350916
cmd/internal: separate counter package from telemetry package + 2024-06-2152ce25b44e
cmd/vendor: pull in golang.org/x/telemetry@b4de734 + 2024-06-21fed2c11d67
iter: minor doc comment updates + 2024-06-21d73a8a206a
cmd/cgo: fail on v, err := C.fn when fn is a builtin function + 2024-06-211b4f1dc95d
os: improve newFile, rm newDir + 2024-06-2172e2220b50
encoding/json: clarify the map's key type for Unmarshal + 2024-06-21e9a306e004
types2, go/types: correct NewTypeParam documentation + 2024-06-216fea409424
text/template/parse: fix handling of assignment/declaration in PipeNode.String + 2024-06-21d67839f58a
crypto/tls: add support for -expect-version to bogo_shim_test + 2024-06-21201129414f
sync/atomic: correct result names for Or methods + 2024-06-2120b79fd577
time: provide non-default metric for asynctimerchan + 2024-06-209d33956503
internal/godebugs: fix old value for httpservecontentkeepheaders + 2024-06-20477ad7dd51
cmd/compile: support generic alias type + 2024-06-184f77a83589
internal/syscall/unix: fix UTIME_OMIT for dragonfly Change-Id: I3864b03b8c377e8fe82014eee96dc7b77aea64e2
This commit is contained in:
commit
8bd4ed6cbb
@ -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 ECHRejectionError struct #63369
|
||||
pkg crypto/tls, type ECHRejectionError struct, RetryConfigList []uint8 #63369
|
||||
pkg crypto/tls, type QUICConfig struct, EnableStoreSessionEvent bool #63691
|
||||
pkg crypto/tls, type QUICConfig struct, EnableSessionEvents bool #63691
|
||||
pkg crypto/tls, type QUICEvent struct, SessionState *SessionState #63691
|
||||
pkg crypto/tls, type QUICSessionTicketOptions struct, Extra [][]uint8 #63691
|
||||
pkg crypto/x509, func ParseOID(string) (OID, error) #66249
|
||||
|
@ -1,14 +0,0 @@
|
||||
<!--
|
||||
NOTE: In this document and others in this directory, the convention is to
|
||||
set fixed-width phrases with non-fixed-width spaces, as in
|
||||
`hello` `world`.
|
||||
-->
|
||||
|
||||
<style>
|
||||
main ul li { margin: 0.5em 0; }
|
||||
</style>
|
||||
|
||||
## DRAFT RELEASE NOTES — Introduction to Go 1.23 {#introduction}
|
||||
|
||||
**Go 1.23 is not yet released. These are work-in-progress release notes.
|
||||
Go 1.23 is expected to be released in August 2024.**
|
@ -1,18 +0,0 @@
|
||||
## 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,84 +0,0 @@
|
||||
## 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}
|
||||
|
||||
Setting the `GOROOT_FINAL` environment variable no longer has an effect
|
||||
([#62047](/issue/62047)).
|
||||
Distributions that install the `go` command to a location other than
|
||||
`$GOROOT/bin/go` should install a symlink instead of relocating
|
||||
or copying the `go` binary.
|
||||
|
||||
<!-- 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.
|
||||
|
||||
<!-- go.dev/issue/27005, CL 585401 -->
|
||||
The new `go` `mod` `tidy` `-diff` flag causes the command not to modify
|
||||
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/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.
|
||||
|
||||
<!-- go.dev/issue/65573 ("cmd/go: separate default GODEBUGs from go language version") -->
|
||||
The new `godebug` directive in `go.mod` and `go.work` declares a
|
||||
[GODEBUG setting](/doc/godebug) to apply for the work module or workspace in use.
|
||||
|
||||
### Vet {#vet}
|
||||
|
||||
<!-- 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.)
|
||||
|
||||
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`.
|
||||
|
||||
### Cgo {#cgo}
|
||||
|
||||
<!-- 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`.
|
||||
|
||||
### Trace {#trace}
|
||||
|
||||
<!-- 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,7 +0,0 @@
|
||||
## Runtime {#runtime}
|
||||
|
||||
The traceback printed by the runtime after an unhandled panic or other
|
||||
fatal error now indents the second and subsequent lines of the error
|
||||
message (for example, the argument to panic) by a single tab, so that
|
||||
it can be unambiguously distinguished from the stack trace of the
|
||||
first goroutine. See [#64590](/issue/64590) for discussion.
|
@ -1,38 +0,0 @@
|
||||
## Compiler {#compiler}
|
||||
|
||||
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.
|
||||
|
||||
<!-- https://go.dev/issue/62737 , https://golang.org/cl/576681, https://golang.org/cl/577615 -->
|
||||
The compiler in Go 1.23 can now overlap the stack frame slots of local variables
|
||||
accessed in disjoint regions of a function, which reduces stack usage
|
||||
for Go applications.
|
||||
|
||||
<!-- https://go.dev/cl/577935 -->
|
||||
For 386 and amd64, the compiler will use information from PGO to align certain
|
||||
hot blocks in loops. This improves performance an additional 1-1.5% at
|
||||
a cost of an additional 0.1% text and binary size. This is currently only implemented
|
||||
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`
|
||||
|
||||
## Assembler {#assembler}
|
||||
|
||||
## 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 +0,0 @@
|
||||
## Core library {#library}
|
||||
|
@ -1,32 +0,0 @@
|
||||
### 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.
|
@ -1,13 +0,0 @@
|
||||
### 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.
|
@ -1,29 +0,0 @@
|
||||
### 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.
|
@ -1,11 +0,0 @@
|
||||
### 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,3 +0,0 @@
|
||||
### Minor changes to the library {#minor_library_changes}
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
API changes and other small changes to the standard library go here.
|
@ -1,4 +0,0 @@
|
||||
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,3 +0,0 @@
|
||||
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.
|
@ -1,3 +0,0 @@
|
||||
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.
|
@ -1,3 +0,0 @@
|
||||
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.
|
@ -1,3 +0,0 @@
|
||||
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.
|
@ -1,3 +0,0 @@
|
||||
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,3 +0,0 @@
|
||||
[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.
|
@ -1,4 +0,0 @@
|
||||
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,3 +0,0 @@
|
||||
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,3 +0,0 @@
|
||||
Errors returned by [driver.Valuer] implementations are now wrapped for
|
||||
improved error handling during operations like [DB.Query], [DB.Exec],
|
||||
and [DB.QueryRow].
|
@ -1,3 +0,0 @@
|
||||
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.
|
@ -1,2 +0,0 @@
|
||||
Now defines the symbol type constants [STT_RELC], [STT_SRELC], and
|
||||
[STT_GNU_IFUNC].
|
@ -1,3 +0,0 @@
|
||||
The new [Encode] and [Decode] functions are byte slice equivalents
|
||||
to [Read] and [Write].
|
||||
[Append] allows marshaling multiple data into the same byte slice.
|
@ -1,2 +0,0 @@
|
||||
The new [Preorder] function returns a convenient iterator over all the
|
||||
nodes of a syntax tree.
|
@ -1 +0,0 @@
|
||||
<!-- see ../../../../2-language.md -->
|
@ -1,3 +0,0 @@
|
||||
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`.
|
@ -1,3 +0,0 @@
|
||||
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))
|
@ -1,2 +0,0 @@
|
||||
The methods [Alias.Origin], [Alias.SetTypeParams], [Alias.TypeParams],
|
||||
and [Alias.TypeArgs] have been added. They are needed for generic alias types.
|
@ -1,4 +0,0 @@
|
||||
<!-- 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 +0,0 @@
|
||||
<!-- see ../../3-iter.md -->
|
@ -1 +0,0 @@
|
||||
<!-- see ../../3-iter.md -->
|
@ -1,2 +0,0 @@
|
||||
The [Uint] function and [Rand.Uint] method have been added.
|
||||
They were inadvertently left out of Go 1.22.
|
@ -1 +0,0 @@
|
||||
The new [ChaCha8.Read] method implements the [io.Reader] interface.
|
@ -1,3 +0,0 @@
|
||||
The new type [KeepAliveConfig] permits fine-tuning the keep-alive
|
||||
options for TCP connections, via a new [TCPConn.SetKeepAliveConfig]
|
||||
method and new KeepAliveConfig fields for [Dialer] and [ListenConfig].
|
@ -1,3 +0,0 @@
|
||||
The [DNSError] type now wraps errors caused by timeouts or cancellation.
|
||||
For example, `errors.Is(someDNSErr, context.DeadlineExceedeed)`
|
||||
will now report whether a DNS error was caused by a timeout.
|
@ -1,3 +0,0 @@
|
||||
The new `GODEBUG` setting `netedns0=0` disables sending EDNS0
|
||||
additional headers on DNS requests, as they reportedly break the DNS
|
||||
server on some modems.
|
@ -1,3 +0,0 @@
|
||||
[Cookie] now preserves double quotes surrounding a cookie value.
|
||||
The new [Cookie.Quoted] field indicates whether the [Cookie.Value]
|
||||
was originally quoted.
|
@ -1 +0,0 @@
|
||||
The new [Request.CookiesNamed] method retrieves all cookies that match the given name.
|
@ -1 +0,0 @@
|
||||
The new [Cookie.Partitioned] field identifies cookies with the Partitioned attribute.
|
@ -1,2 +0,0 @@
|
||||
The patterns used by [ServeMux] now allow one or more spaces or tabs after the method name.
|
||||
Previously, only a single space was permitted.
|
@ -1,7 +0,0 @@
|
||||
The new [ParseCookie] function parses a Cookie header value and
|
||||
returns all the cookies which were set in it. Since the same cookie
|
||||
name can appear multiple times the returned Values can contain
|
||||
more than one value for a given key.
|
||||
|
||||
The new [ParseSetCookie] function parses a Set-Cookie header value and
|
||||
returns a cookie. It returns an error on syntax error.
|
@ -1,16 +0,0 @@
|
||||
[ServeContent], [ServeFile], and [ServeFileFS] now remove
|
||||
the `Cache-Control`, `Content-Encoding`, `Etag`, and `Last-Modified`
|
||||
headers when serving an error. These headers usually apply to the
|
||||
non-error content, but not to the text of errors.
|
||||
|
||||
Middleware which wraps a [ResponseWriter] and applies on-the-fly
|
||||
encoding, such as `Content-Encoding: gzip`, will not function after
|
||||
this change. The previous behavior of [ServeContent], [ServeFile],
|
||||
and [ServeFileFS] may be restored by setting
|
||||
`GODEBUG=httpservecontentkeepheaders=1`.
|
||||
|
||||
Note that middleware which changes the size of the served content
|
||||
(such as by compressing it) already does not function properly when
|
||||
[ServeContent] handles a Range request. On-the-fly compression
|
||||
should use the `Transfer-Encoding` header instead of `Content-Encoding`.
|
||||
|
@ -1,3 +0,0 @@
|
||||
For inbound requests, the new [Request.Pattern] field contains the [ServeMux]
|
||||
pattern (if any) that matched the request. This field is not set when
|
||||
`GODEBUG=httpmuxgo121=1` is set.
|
@ -1,2 +0,0 @@
|
||||
The new [NewRequestWithContext] method creates an incoming request with
|
||||
a [context.Context].
|
@ -1,3 +0,0 @@
|
||||
The [Stat] function now sets the [ModeSocket] bit for
|
||||
files that are Unix sockets on Windows. These files are identified
|
||||
by having a reparse tag set to `IO_REPARSE_TAG_AF_UNIX`.
|
@ -1,7 +0,0 @@
|
||||
On Windows, the mode bits reported by [Lstat] and [Stat] for
|
||||
reparse points changed. Mount points no longer have [ModeSymlink] set,
|
||||
and reparse points that are not symlinks, Unix sockets, or dedup files
|
||||
now always have [ModeIrregular] set.
|
||||
This behavior is controlled by the `winsymlink` setting.
|
||||
For Go 1.23, it defaults to `winsymlink=1`.
|
||||
Previous versions default to `winsymlink=0`.
|
@ -1 +0,0 @@
|
||||
The [CopyFS] function copies an [io/fs.FS] into the local filesystem.
|
@ -1,5 +0,0 @@
|
||||
On Windows, [Readlink] no longer tries to normalize volumes
|
||||
to drive letters, which was not always even possible.
|
||||
This behavior is controlled by the `winreadlinkvolume` setting.
|
||||
For Go 1.23, it defaults to `winreadlinkvolume=1`.
|
||||
Previous versions default to `winreadlinkvolume=0`.
|
@ -1,2 +0,0 @@
|
||||
The new [Localize] function safely converts a slash-separated
|
||||
path into an operating system path.
|
@ -1,11 +0,0 @@
|
||||
On Windows, [EvalSymlinks] no longer evaluates mount points,
|
||||
which was a source of many inconsistencies and bugs.
|
||||
This behavior is controlled by the `winsymlink` setting.
|
||||
For Go 1.23, it defaults to `winsymlink=1`.
|
||||
Previous versions default to `winsymlink=0`.
|
||||
|
||||
On Windows, [EvalSymlinks] no longer tries to normalize
|
||||
volumes to drive letters, which was not always even possible.
|
||||
This behavior is controlled by the `winreadlinkvolume` setting.
|
||||
For Go 1.23, it defaults to `winreadlinkvolume=1`.
|
||||
Previous versions default to `winreadlinkvolume=0`.
|
@ -1,6 +0,0 @@
|
||||
The new methods synonymous with the method of the same name
|
||||
in [Value] are added to [Type]:
|
||||
1. [Type.OverflowComplex]
|
||||
2. [Type.OverflowFloat]
|
||||
3. [Type.OverflowInt]
|
||||
4. [Type.OverflowUint]
|
@ -1,3 +0,0 @@
|
||||
The new [SliceAt] function is analogous to [NewAt], but for slices.
|
||||
|
||||
The [Value.Pointer] and [Value.UnsafePointer] methods now support values of kind [String].
|
@ -1,4 +0,0 @@
|
||||
The new methods [Value.Seq] and [Value.Seq2] return sequences that iterate over the value
|
||||
as though it were used in a for/range loop.
|
||||
The new methods [Type.CanSeq] and [Type.CanSeq2] report whether calling
|
||||
[Value.Seq] and [Value.Seq2], respectively, will succeed without panicking.
|
@ -1,5 +0,0 @@
|
||||
The [SetCrashOutput] function allows the user to specify an alternate
|
||||
file to which the runtime should write its fatal crash report.
|
||||
It may be used to construct an automated reporting mechanism for all
|
||||
unexpected crashes, not just those in goroutines that explicitly use
|
||||
`recover`.
|
@ -1 +0,0 @@
|
||||
<!-- pacify TestCheckAPIFragments -->
|
@ -1,2 +0,0 @@
|
||||
The maximum stack depth for alloc, mutex, block, threadcreate and goroutine
|
||||
profiles has been raised from 32 to 128 frames.
|
@ -1,4 +0,0 @@
|
||||
<!-- go.dev/issue/65319 -->
|
||||
The runtime now explicitly flushes trace data when a program crashes due to an
|
||||
uncaught panic. This means that more complete trace data will be available in a
|
||||
trace if the program crashes while tracing is active.
|
@ -1 +0,0 @@
|
||||
<!-- see ../../3-iter.md -->
|
@ -1 +0,0 @@
|
||||
<!-- see ../../3-iter.md -->
|
@ -1,2 +0,0 @@
|
||||
The [Repeat] function returns a new slice that repeats the
|
||||
provided slice the given number of times.
|
@ -1 +0,0 @@
|
||||
<!-- This is a new package; covered in 6-stdlib/3-structs.md. -->
|
@ -1,2 +0,0 @@
|
||||
The [Map.Clear] method deletes all the entries, resulting in
|
||||
an empty [Map]. It is analogous to `clear`.
|
@ -1,3 +0,0 @@
|
||||
<!-- Issue #61395 -->
|
||||
The new [And] and [Or] operators apply a bitwise `AND` or `OR` to
|
||||
the given input, returning the old value.
|
@ -1 +0,0 @@
|
||||
The syscall package now defines [WSAENOPROTOOPT] on Windows.
|
@ -1 +0,0 @@
|
||||
The [GetsockoptInt] function is now supported on Windows.
|
@ -1,3 +0,0 @@
|
||||
[TestFS] now returns a structured error that can be unwrapped
|
||||
(via method `Unwrap() []error`). This allows inspecting errors
|
||||
using [errors.Is] or [errors.As].
|
@ -1 +0,0 @@
|
||||
Templates now support the new "else with" action, which reduces template complexity in some use cases.
|
@ -1,2 +0,0 @@
|
||||
[Parse] and [ParseInLocation] now return an error if the time zone
|
||||
offset is out of range.
|
@ -1,3 +0,0 @@
|
||||
The [RuneLen] function returns the number of 16-bit words in
|
||||
the UTF-16 encoding of the rune. It returns -1 if the rune
|
||||
is not a valid value to encode in UTF-16.
|
@ -1 +0,0 @@
|
||||
<!-- This is a new package; covered in 6-stdlib/2-unique.md. -->
|
@ -1,38 +0,0 @@
|
||||
## Ports {#ports}
|
||||
|
||||
### Darwin {#darwin}
|
||||
|
||||
<!-- go.dev/issue/64207 -->
|
||||
As [announced](go1.22#darwin) in the Go 1.22 release notes,
|
||||
Go 1.23 requires macOS 11 Big Sur or later;
|
||||
support for previous versions has been discontinued.
|
||||
|
||||
### Linux {#linux}
|
||||
|
||||
<!-- go.dev/issue/67001 -->
|
||||
Go 1.23 is the last release that requires Linux kernel version 2.6.32 or later. Go 1.24 will require Linux kernel version 3.17 or later, with an exception that systems running 3.10 or later will continue to be supported if the kernel has been patched to support the getrandom system call.
|
||||
|
||||
### OpenBSD {#openbsd}
|
||||
|
||||
<!-- go.dev/issue/55999, CL 518629, CL 518630 -->
|
||||
Go 1.23 adds experimental support for OpenBSD on 64-bit RISC-V (`GOOS=openbsd`, `GOARCH=riscv64`).
|
||||
|
||||
### ARM64 {#arm64}
|
||||
|
||||
<!-- go.dev/issue/60905, CL 559555 -->
|
||||
Go 1.23 introduces a new `GOARM64` environment variable, which specifies the minimum target version of the ARM64 architecture at compile time. Allowed values are `v8.{0-9}` and `v9.{0-5}`. This may be followed by an option specifying extensions implemented by target hardware. Valid options are `,lse` and `,crypto`.
|
||||
|
||||
The `GOARM64` environment variable defaults to `v8.0`.
|
||||
|
||||
### RISC-V {#riscv}
|
||||
|
||||
<!-- go.dev/issue/61476, CL 541135 -->
|
||||
Go 1.23 introduces a new `GORISCV64` environment variable, which selects the [RISC-V user-mode application profile](https://github.com/riscv/riscv-profiles/blob/main/src/profiles.adoc) for which to compile. Allowed values are `rva20u64` and `rva22u64`.
|
||||
|
||||
The `GORISCV64` environment variable defaults to `rva20u64`.
|
||||
|
||||
### Wasm {#wasm}
|
||||
|
||||
<!-- go.dev/issue/63718 -->
|
||||
The `go_wasip1_wasm_exec` script in `GOROOT/misc/wasm` has dropped support
|
||||
for versions of `wasmtime` < 14.0.0.
|
@ -1,51 +0,0 @@
|
||||
<!-- These items need to be completed and moved to an appropriate location in the release notes. -->
|
||||
|
||||
<!-- These items need to be reviewed, and mentioned in the Go 1.23 release notes if applicable.
|
||||
|
||||
None right now; more may come up later on.
|
||||
-->
|
||||
|
||||
<!-- Maybe should be documented? Maybe shouldn't? Someone familiar with the change needs to determine.
|
||||
|
||||
CL 359594 ("x/website/_content/ref/mod: document dotless module paths") - resolved go.dev/issue/32819 ("cmd/go: document that module names without dots are reserved") and also mentioned accepted proposal go.dev/issue/37641
|
||||
CL 570681 ("os: make FindProcess use pidfd on Linux") mentions accepted proposal go.dev/issue/51246 (described as fully implemented in Go 1.22) and NeedsInvestigation continuation issue go.dev/issue/62654.
|
||||
CL 555075 ("x/tools/go/ssa: support range-over-func") - x/tools CL implements range-over-func support in x/tools/go/ssa for accepted proposal https://go.dev/issue/66601; this particular proposal and change doesn't seem to need a dedicated mention in Go 1.23 release notes but someone more familiar should take another look
|
||||
-->
|
||||
|
||||
<!-- Items that don't need to be mentioned in Go 1.23 release notes but are picked up by relnote todo.
|
||||
|
||||
CL 458895 - an x/playground fix that mentioned an accepted cmd/go proposal go.dev/issue/40728 in Go 1.16 milestone...
|
||||
CL 582097 - an x/build CL working on relnote itself; it doesn't need a release note
|
||||
CL 561935 - crypto CL that used purego tag and mentioned accepted-but-not-implemented proposal https://go.dev/issue/23172 to document purego tag; doesn't need a release note
|
||||
CL 568340 - fixed a spurious race in time.Ticker.Reset (added via accepted proposal https://go.dev/issue/33184), doesn't seem to need a release note
|
||||
CL 562619 - x/website CL documented minimum bootstrap version on go.dev, mentioning accepted proposals go.dev/issue/54265 and go.dev/issue/44505; doesn't need a release note
|
||||
CL 557055 - x/tools CL implemented accepted proposal https://go.dev/issue/46941 for x/tools/go/ssa
|
||||
CL 564275 - an x/tools CL that updates test data in preparation for accepted proposal https://go.dev/issue/51473; said proposal isn't implemented for Go 1.23 and so it doesn't need a release note
|
||||
CL 572535 - used "unix" build tag in more places, mentioned accepted proposal https://go.dev/issue/51572; doesn't need a release note
|
||||
CL 555255 - an x/tools CL implements accepted proposal https://go.dev/issue/53367 for x/tools/go/cfg
|
||||
CL 585216 - an x/build CL mentions accepted proposal https://go.dev/issue/56001 because it fixed a bug causing downloads not to be produced for that new-to-Go-1.22 port; this isn't relevant to Go 1.23 release notes
|
||||
CL 481062 - added examples for accepted proposal https://go.dev/issue/56102; doesn't need a release note
|
||||
CL 497195 - an x/net CL adds one of 4 fields for accepted proposal https://go.dev/issue/57893 in x/net/http2; seemingly not related to net/http and so doesn't need a Go 1.23 release note
|
||||
CL 463097, CL 568198 - x/net CLs that implemented accepted proposal https://go.dev/issue/57953 for x/net/websocket; no need for rel note
|
||||
many x/net CLs - work on accepted proposal https://go.dev/issue/58547 to add a QUIC implementation to x/net/quic
|
||||
CL 514775 - implements a performance optimization for accepted proposal https://go.dev/issue/59488
|
||||
CL 484995 - x/sys CL implements accepted proposal https://go.dev/issue/59537 to add x/sys/unix API
|
||||
CL 555597 - optimizes TypeFor (added in accepted proposal https://go.dev/issue/60088) for non-interface types; doesn't seem to need a release note
|
||||
a few x/tools CLs deprecated and deleted the experimental golang.org/x/tools/cmd/getgo tool per accepted proposal https://go.dev/issue/60951; an unreleased change and not something that's in scope of Go 1.23 release notes
|
||||
many x/vuln CLs to implement accepted proposal https://go.dev/issue/61347 ("x/vuln: convert govulncheck output to sarif format") in govulncheck
|
||||
CL 516355 - x/crypto CL that implemented accepted proposal https://go.dev/issue/61447 for x/crypto/ssh; doesn't need a Go 1.23 release note
|
||||
CL 559799 - a Go 1.22 release note edit CL mentioned a Go 1.22 accepted proposal https://go.dev/issue/62039, a little after Go 1.23 development began
|
||||
CL 581555 - an x/tools CL mentioned accepted proposal https://go.dev/issue/62292 for x/tools/go/aalysis; doesn't need a Go 1.23 release note
|
||||
CL 578355 - mentioned accepted proposal https://go.dev/issue/63131 to add GOARCH=wasm32, but that proposal hasn't been implemented in Go 1.23 so it doesn't need a release note
|
||||
CL 543335 - x/exp CL that backported a change to behavior in slices package (accepted proposal https://go.dev/issue/63393) to x/exp/slices; doesn't need a Go 1.23 release note
|
||||
CL 556820 - x/tools CL implemented accepted proposal https://go.dev/issue/64548 for x/tools/go/analysis
|
||||
CL 557056 - x/tools CL implemented accepted proposal https://go.dev/issue/64608 for x/tools/go/packages
|
||||
CL 558695 - x/crypto CL worked on accepted proposal https://go.dev/issue/64962 for x/crypto/ssh
|
||||
CL 572016 - x/tools CL implemented accepted proposal https://go.dev/issue/65754 for x/tools/go/cfg
|
||||
a few x/tools CLs tagged and deleted the golang.org/x/tools/cmd/guru command per accepted proposal https://go.dev/issue/65880; an unreleased change and not something that's in scope of Go 1.23 release notes
|
||||
CL 580076 - seemingly internal cmd/go change to propagate module information for accepted proposal https://go.dev/issue/66315; doesn't seem to warrant a release note
|
||||
CL 529816 - the 'tests' vet check was initially added to the 'go test' suite per accepted proposal https://go.dev/issue/44251, but the change was rolled back in CL 571695, with no roll forward as of 2024-05-23; nothing to document in Go 1.23 release notes for it at this time
|
||||
CL 564035 - changed encoding/xml, but the change was too disrptive and rolled back in CL 570175, reopening tracking issue go.dev/issue/65691; nothing to document in Go 1.23 release notes
|
||||
CL 587855 - a demonstration of benefit of accepted proposal https://go.dev/issue/60529; actual change isn't happening in Go 1.23 so doesn't need a release note
|
||||
CL 526875 - x/crypto CL implemented accepted proposal https://go.dev/issue/62518 for x/crypto/ssh
|
||||
-->
|
@ -28,7 +28,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"cmd/internal/objfile"
|
||||
"cmd/internal/telemetry"
|
||||
"cmd/internal/telemetry/counter"
|
||||
)
|
||||
|
||||
func printUsage(w *os.File) {
|
||||
@ -46,7 +46,7 @@ func usage() {
|
||||
func main() {
|
||||
log.SetFlags(0)
|
||||
log.SetPrefix("addr2line: ")
|
||||
telemetry.OpenCounters()
|
||||
counter.Open()
|
||||
|
||||
// pprof expects this behavior when checking for addr2line
|
||||
if len(os.Args) > 1 && os.Args[1] == "--help" {
|
||||
@ -56,8 +56,8 @@ func main() {
|
||||
|
||||
flag.Usage = usage
|
||||
flag.Parse()
|
||||
telemetry.Inc("addr2line/invocations")
|
||||
telemetry.CountFlags("addr2line/flag:", *flag.CommandLine)
|
||||
counter.Inc("addr2line/invocations")
|
||||
counter.CountFlags("addr2line/flag:", *flag.CommandLine)
|
||||
if flag.NArg() != 1 {
|
||||
usage()
|
||||
}
|
||||
|
6
src/cmd/asm/internal/asm/testdata/arm64.s
vendored
6
src/cmd/asm/internal/asm/testdata/arm64.s
vendored
@ -961,7 +961,11 @@ again:
|
||||
CASPD (R2, R3), (R2), (R8, R9) // 487c2248
|
||||
|
||||
// RET
|
||||
RET
|
||||
RET // c0035fd6
|
||||
RET R0 // 00005fd6
|
||||
RET R6 // c0005fd6
|
||||
RET R27 // 60035fd6
|
||||
RET R30 // c0035fd6
|
||||
RET foo(SB)
|
||||
|
||||
// B/BL/B.cond cases, and canonical names JMP, CALL.
|
||||
|
@ -20,20 +20,20 @@ import (
|
||||
"cmd/internal/bio"
|
||||
"cmd/internal/obj"
|
||||
"cmd/internal/objabi"
|
||||
"cmd/internal/telemetry"
|
||||
"cmd/internal/telemetry/counter"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.SetFlags(0)
|
||||
log.SetPrefix("asm: ")
|
||||
telemetry.OpenCounters()
|
||||
counter.Open()
|
||||
|
||||
buildcfg.Check()
|
||||
GOARCH := buildcfg.GOARCH
|
||||
|
||||
flags.Parse()
|
||||
telemetry.Inc("asm/invocations")
|
||||
telemetry.CountFlags("asm/flag:", *flag.CommandLine)
|
||||
counter.Inc("asm/invocations")
|
||||
counter.CountFlags("asm/flag:", *flag.CommandLine)
|
||||
|
||||
architecture := arch.Set(GOARCH, *flags.Shared || *flags.Dynlink)
|
||||
if architecture == nil {
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"cmd/internal/buildid"
|
||||
"cmd/internal/telemetry"
|
||||
"cmd/internal/telemetry/counter"
|
||||
)
|
||||
|
||||
func usage() {
|
||||
@ -26,11 +26,11 @@ var wflag = flag.Bool("w", false, "write build ID")
|
||||
func main() {
|
||||
log.SetPrefix("buildid: ")
|
||||
log.SetFlags(0)
|
||||
telemetry.OpenCounters()
|
||||
counter.Open()
|
||||
flag.Usage = usage
|
||||
flag.Parse()
|
||||
telemetry.Inc("buildid/invocations")
|
||||
telemetry.CountFlags("buildid/flag:", *flag.CommandLine)
|
||||
counter.Inc("buildid/invocations")
|
||||
counter.CountFlags("buildid/flag:", *flag.CommandLine)
|
||||
if flag.NArg() != 1 {
|
||||
usage()
|
||||
}
|
||||
|
@ -1601,8 +1601,8 @@ func (p *Package) rewriteName(f *File, r *Ref, addPosition bool) ast.Expr {
|
||||
break
|
||||
}
|
||||
if r.Context == ctxCall2 {
|
||||
if r.Name.Go == "_CMalloc" {
|
||||
error_(r.Pos(), "no two-result form for C.malloc")
|
||||
if builtinDefs[r.Name.Go] != "" {
|
||||
error_(r.Pos(), "no two-result form for C.%s", r.Name.Go)
|
||||
break
|
||||
}
|
||||
// Invent new Name for the two-result function.
|
||||
|
@ -127,6 +127,7 @@ func TestReportsTypeErrors(t *testing.T) {
|
||||
"issue33061.go",
|
||||
"issue50710.go",
|
||||
"issue67517.go",
|
||||
"issue67707.go",
|
||||
} {
|
||||
check(t, file)
|
||||
}
|
||||
|
15
src/cmd/cgo/internal/testerrors/testdata/issue67707.go
vendored
Normal file
15
src/cmd/cgo/internal/testerrors/testdata/issue67707.go
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2024 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package p
|
||||
|
||||
import "C"
|
||||
|
||||
func F() *C.char {
|
||||
s, err := C.CString("hi") // ERROR HERE: no two-result form
|
||||
if err != nil {
|
||||
println(err)
|
||||
}
|
||||
return s
|
||||
}
|
@ -414,3 +414,11 @@ func TestTextSectionSplit(t *testing.T) {
|
||||
t.Errorf("runtime.text.1 not found, text section not split?")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIssue67976(t *testing.T) {
|
||||
// Issue 67976: build failure with loading a dynimport variable (the runtime/pprof
|
||||
// package does this on darwin) in a plugin on darwin/amd64.
|
||||
// The test program uses runtime/pprof in a plugin.
|
||||
globalSkip(t)
|
||||
goCmd(t, "build", "-buildmode=plugin", "-o", "issue67976.so", "./issue67976/plugin.go")
|
||||
}
|
||||
|
16
src/cmd/cgo/internal/testplugin/testdata/issue67976/plugin.go
vendored
Normal file
16
src/cmd/cgo/internal/testplugin/testdata/issue67976/plugin.go
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright 2024 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"runtime/pprof"
|
||||
)
|
||||
|
||||
func main() {}
|
||||
|
||||
func Start() {
|
||||
pprof.StartCPUProfile(io.Discard)
|
||||
}
|
@ -28,7 +28,7 @@ import (
|
||||
"cmd/internal/edit"
|
||||
"cmd/internal/notsha256"
|
||||
"cmd/internal/objabi"
|
||||
"cmd/internal/telemetry"
|
||||
"cmd/internal/telemetry/counter"
|
||||
)
|
||||
|
||||
// A Package collects information about the package we're going to write.
|
||||
@ -258,11 +258,11 @@ var goarch, goos, gomips, gomips64 string
|
||||
var gccBaseCmd []string
|
||||
|
||||
func main() {
|
||||
telemetry.OpenCounters()
|
||||
counter.Open()
|
||||
objabi.AddVersionFlag() // -V
|
||||
objabi.Flagparse(usage)
|
||||
telemetry.Inc("cgo/invocations")
|
||||
telemetry.CountFlags("cgo/flag:", *flag.CommandLine)
|
||||
counter.Inc("cgo/invocations")
|
||||
counter.CountFlags("cgo/flag:", *flag.CommandLine)
|
||||
|
||||
if *gccgoDefineCgoIncomplete {
|
||||
if !*gccgo {
|
||||
@ -343,6 +343,21 @@ func main() {
|
||||
p.addToFlag("LDFLAGS", args)
|
||||
}
|
||||
|
||||
// For backward compatibility for Bazel, record CGO_LDFLAGS
|
||||
// from the environment for external linking.
|
||||
// This should not happen with cmd/go, which removes CGO_LDFLAGS
|
||||
// from the environment when invoking cgo.
|
||||
// This can be removed when we no longer need to support
|
||||
// older versions of Bazel. See issue #66456 and
|
||||
// https://github.com/bazelbuild/rules_go/issues/3979.
|
||||
if envFlags := os.Getenv("CGO_LDFLAGS"); envFlags != "" {
|
||||
args, err := splitQuoted(envFlags)
|
||||
if err != nil {
|
||||
fatalf("bad CGO_LDFLAGS: %q (%s)", envFlags, err)
|
||||
}
|
||||
p.addToFlag("LDFLAGS", args)
|
||||
}
|
||||
|
||||
// Need a unique prefix for the global C symbols that
|
||||
// we use to coordinate between gcc and ourselves.
|
||||
// We already put _cgo_ at the beginning, so the main
|
||||
|
@ -63,7 +63,6 @@ Unified IR is also involved in import/export of packages and inlining.
|
||||
|
||||
### 4. Middle end
|
||||
|
||||
* `cmd/compile/internal/deadcode` (dead code elimination)
|
||||
* `cmd/compile/internal/inline` (function call inlining)
|
||||
* `cmd/compile/internal/devirtualize` (devirtualization of known interface method calls)
|
||||
* `cmd/compile/internal/escape` (escape analysis)
|
||||
@ -72,6 +71,8 @@ Several optimization passes are performed on the IR representation:
|
||||
dead code elimination, (early) devirtualization, function call
|
||||
inlining, and escape analysis.
|
||||
|
||||
The early dead code elimination pass is integrated into the unified IR writer phase.
|
||||
|
||||
### 5. Walk
|
||||
|
||||
* `cmd/compile/internal/walk` (order of evaluation, desugaring)
|
||||
|
@ -6,7 +6,7 @@ package base
|
||||
|
||||
import (
|
||||
"cmd/internal/cov/covcmd"
|
||||
"cmd/internal/telemetry"
|
||||
"cmd/internal/telemetry/counter"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
@ -195,7 +195,7 @@ func ParseFlags() {
|
||||
objabi.AddVersionFlag() // -V
|
||||
registerFlags()
|
||||
objabi.Flagparse(usage)
|
||||
telemetry.CountFlags("compile/flag:", *flag.CommandLine)
|
||||
counter.CountFlags("compile/flag:", *flag.CommandLine)
|
||||
|
||||
if gcd := os.Getenv("GOCOMPILEDEBUG"); gcd != "" {
|
||||
// This will only override the flags set in gcd;
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"cmd/internal/src"
|
||||
"cmd/internal/telemetry"
|
||||
"cmd/internal/telemetry/counter"
|
||||
)
|
||||
|
||||
// An errorMsg is a queued error message, waiting to be printed.
|
||||
@ -195,7 +195,7 @@ func Fatalf(format string, args ...interface{}) {
|
||||
FatalfAt(Pos, format, args...)
|
||||
}
|
||||
|
||||
var bugStack = telemetry.NewStackCounter("compile/bug", 16) // 16 is arbitrary; used by gopls and crashmonitor
|
||||
var bugStack = counter.NewStack("compile/bug", 16) // 16 is arbitrary; used by gopls and crashmonitor
|
||||
|
||||
// FatalfAt reports a fatal error - an internal problem - at pos and exits.
|
||||
// If other errors have already been printed, then FatalfAt just quietly exits.
|
||||
|
@ -91,6 +91,9 @@ func Info(fnsym *obj.LSym, infosym *obj.LSym, curfn obj.Func) (scopes []dwarf.Sc
|
||||
default:
|
||||
continue
|
||||
}
|
||||
if !ssa.IsVarWantedForDebug(n) {
|
||||
continue
|
||||
}
|
||||
apdecls = append(apdecls, n)
|
||||
if n.Type().Kind() == types.TSSA {
|
||||
// Can happen for TypeInt128 types. This only happens for
|
||||
@ -194,6 +197,9 @@ func createDwarfVars(fnsym *obj.LSym, complexOK bool, fn *ir.Func, apDecls []*ir
|
||||
// DWARF-gen. See issue 48573 for more details.
|
||||
debugInfo := fn.DebugInfo.(*ssa.FuncDebug)
|
||||
for _, n := range debugInfo.RegOutputParams {
|
||||
if !ssa.IsVarWantedForDebug(n) {
|
||||
continue
|
||||
}
|
||||
if n.Class != ir.PPARAMOUT || !n.IsOutputParamInRegisters() {
|
||||
panic("invalid ir.Name on debugInfo.RegOutputParams list")
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ import (
|
||||
"cmd/internal/obj"
|
||||
"cmd/internal/objabi"
|
||||
"cmd/internal/src"
|
||||
"cmd/internal/telemetry"
|
||||
"cmd/internal/telemetry/counter"
|
||||
"flag"
|
||||
"fmt"
|
||||
"internal/buildcfg"
|
||||
@ -59,8 +59,8 @@ func handlePanic() {
|
||||
// code, and finally writes the compiled package definition to disk.
|
||||
func Main(archInit func(*ssagen.ArchInfo)) {
|
||||
base.Timer.Start("fe", "init")
|
||||
telemetry.OpenCounters()
|
||||
telemetry.Inc("compile/invocations")
|
||||
counter.Open()
|
||||
counter.Inc("compile/invocations")
|
||||
|
||||
defer handlePanic()
|
||||
|
||||
|
@ -7,6 +7,7 @@ package noder
|
||||
import (
|
||||
"fmt"
|
||||
"internal/pkgbits"
|
||||
"internal/types/errors"
|
||||
"io"
|
||||
"runtime"
|
||||
"sort"
|
||||
@ -403,7 +404,10 @@ func readPackage(pr *pkgReader, importpkg *types.Pkg, localStub bool) {
|
||||
r := pr.newReader(pkgbits.RelocMeta, pkgbits.PublicRootIdx, pkgbits.SyncPublic)
|
||||
|
||||
pkg := r.pkg()
|
||||
base.Assertf(pkg == importpkg, "have package %q (%p), want package %q (%p)", pkg.Path, pkg, importpkg.Path, importpkg)
|
||||
if pkg != importpkg {
|
||||
base.ErrorfAt(base.AutogeneratedPos, errors.BadImportPath, "mismatched import path, have %q (%p), want %q (%p)", pkg.Path, pkg, importpkg.Path, importpkg)
|
||||
base.ErrorExit()
|
||||
}
|
||||
|
||||
r.Bool() // TODO(mdempsky): Remove; was "has init"
|
||||
|
||||
|
@ -1582,6 +1582,7 @@ func (w *writer) switchStmt(stmt *syntax.SwitchStmt) {
|
||||
w.stmt(stmt.Init)
|
||||
|
||||
var iface, tagType types2.Type
|
||||
var tagTypeIsChan bool
|
||||
if guard, ok := stmt.Tag.(*syntax.TypeSwitchGuard); w.Bool(ok) {
|
||||
iface = w.p.typeOf(guard.X)
|
||||
|
||||
@ -1603,6 +1604,7 @@ func (w *writer) switchStmt(stmt *syntax.SwitchStmt) {
|
||||
tv := w.p.typeAndValue(tag)
|
||||
tagType = tv.Type
|
||||
tagValue = tv.Value
|
||||
_, tagTypeIsChan = tagType.Underlying().(*types2.Chan)
|
||||
} else {
|
||||
tagType = types2.Typ[types2.Bool]
|
||||
tagValue = constant.MakeBool(true)
|
||||
@ -1655,12 +1657,18 @@ func (w *writer) switchStmt(stmt *syntax.SwitchStmt) {
|
||||
// have the same type. If there are any case values that can't be
|
||||
// converted to the tag value's type, then convert everything to
|
||||
// `any` instead.
|
||||
Outer:
|
||||
for _, clause := range stmt.Body {
|
||||
for _, cas := range syntax.UnpackListExpr(clause.Cases) {
|
||||
if casType := w.p.typeOf(cas); !types2.AssignableTo(casType, tagType) {
|
||||
tagType = types2.NewInterfaceType(nil, nil)
|
||||
break Outer
|
||||
//
|
||||
// Except that we need to keep comparisons of channel values from
|
||||
// being wrapped in any(). See issue #67190.
|
||||
|
||||
if !tagTypeIsChan {
|
||||
Outer:
|
||||
for _, clause := range stmt.Body {
|
||||
for _, cas := range syntax.UnpackListExpr(clause.Cases) {
|
||||
if casType := w.p.typeOf(cas); !types2.AssignableTo(casType, tagType) {
|
||||
tagType = types2.NewInterfaceType(nil, nil)
|
||||
break Outer
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1696,7 +1704,11 @@ func (w *writer) switchStmt(stmt *syntax.SwitchStmt) {
|
||||
w.Sync(pkgbits.SyncExprs)
|
||||
w.Len(len(cases))
|
||||
for _, cas := range cases {
|
||||
w.implicitConvExpr(tagType, cas)
|
||||
typ := tagType
|
||||
if tagTypeIsChan {
|
||||
typ = nil
|
||||
}
|
||||
w.implicitConvExpr(typ, cas)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1137,7 +1137,7 @@ func (r *rewriter) setStateAt(index int, stateVal abi.RF_State) *syntax.AssignSt
|
||||
func (r *rewriter) bodyFunc(body []syntax.Stmt, lhs []syntax.Expr, def bool, ftyp *types2.Signature, start, end syntax.Pos) *syntax.FuncLit {
|
||||
// Starting X(bodyFunc); build up bodyFunc first.
|
||||
var params, results []*types2.Var
|
||||
results = append(results, types2.NewVar(start, nil, "", r.bool.Type()))
|
||||
results = append(results, types2.NewVar(start, nil, "#r", r.bool.Type()))
|
||||
bodyFunc := &syntax.FuncLit{
|
||||
// Note: Type is ignored but needs to be non-nil to avoid panic in syntax.Inspect.
|
||||
Type: &syntax.FuncType{},
|
||||
|
@ -600,7 +600,7 @@ func BuildFuncDebug(ctxt *obj.Link, f *Func, loggingLevel int, stackOffset func(
|
||||
state.vars = state.vars[:0]
|
||||
for i, slot := range f.Names {
|
||||
state.slots = append(state.slots, *slot)
|
||||
if ir.IsSynthetic(slot.N) {
|
||||
if ir.IsSynthetic(slot.N) || !IsVarWantedForDebug(slot.N) {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -620,7 +620,7 @@ func BuildFuncDebug(ctxt *obj.Link, f *Func, loggingLevel int, stackOffset func(
|
||||
for _, v := range b.Values {
|
||||
if v.Op == OpVarDef {
|
||||
n := v.Aux.(*ir.Name)
|
||||
if ir.IsSynthetic(n) {
|
||||
if ir.IsSynthetic(n) || !IsVarWantedForDebug(n) {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -665,7 +665,7 @@ func BuildFuncDebug(ctxt *obj.Link, f *Func, loggingLevel int, stackOffset func(
|
||||
state.initializeCache(f, len(state.varParts), len(state.slots))
|
||||
|
||||
for i, slot := range f.Names {
|
||||
if ir.IsSynthetic(slot.N) {
|
||||
if ir.IsSynthetic(slot.N) || !IsVarWantedForDebug(slot.N) {
|
||||
continue
|
||||
}
|
||||
for _, value := range f.NamedValues[*slot] {
|
||||
@ -1087,7 +1087,7 @@ func (state *debugState) processValue(v *Value, vSlots []SlotID, vReg *Register)
|
||||
switch {
|
||||
case v.Op == OpVarDef:
|
||||
n := v.Aux.(*ir.Name)
|
||||
if ir.IsSynthetic(n) {
|
||||
if ir.IsSynthetic(n) || !IsVarWantedForDebug(n) {
|
||||
break
|
||||
}
|
||||
|
||||
@ -1835,6 +1835,9 @@ func BuildFuncDebugNoOptimized(ctxt *obj.Link, f *Func, loggingEnabled bool, sta
|
||||
// will be sorted out elsewhere
|
||||
continue
|
||||
}
|
||||
if !IsVarWantedForDebug(inp.Name) {
|
||||
continue
|
||||
}
|
||||
addVarSlot(inp.Name, inp.Type)
|
||||
params = append(params, inp)
|
||||
}
|
||||
@ -1855,6 +1858,9 @@ func BuildFuncDebugNoOptimized(ctxt *obj.Link, f *Func, loggingEnabled bool, sta
|
||||
// will be sorted out elsewhere
|
||||
continue
|
||||
}
|
||||
if !IsVarWantedForDebug(inp.Name) {
|
||||
continue
|
||||
}
|
||||
|
||||
sl := rval.Slots[pidx]
|
||||
n := rval.Vars[pidx]
|
||||
@ -1948,3 +1954,19 @@ func BuildFuncDebugNoOptimized(ctxt *obj.Link, f *Func, loggingEnabled bool, sta
|
||||
pidx++
|
||||
}
|
||||
}
|
||||
|
||||
// IsVarWantedForDebug returns true if the debug info for the node should
|
||||
// be generated.
|
||||
// For example, internal variables for range-over-func loops have little
|
||||
// value to users, so we don't generate debug info for them.
|
||||
func IsVarWantedForDebug(n ir.Node) bool {
|
||||
name := n.Sym().Name
|
||||
if len(name) > 0 && name[0] == '&' {
|
||||
name = name[1:]
|
||||
}
|
||||
if len(name) > 0 && name[0] == '#' {
|
||||
// #yield is used by delve.
|
||||
return strings.HasPrefix(name, "#yield")
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -1287,6 +1287,11 @@ func areAdjacentOffsets(off1, off2, size int64) bool {
|
||||
// depth limits recursion depth. In AMD64.rules 3 is used as limit,
|
||||
// because it catches same amount of cases as 4.
|
||||
func zeroUpper32Bits(x *Value, depth int) bool {
|
||||
if x.Type.IsSigned() && x.Type.Size() < 8 {
|
||||
// If the value is signed, it might get re-sign-extended
|
||||
// during spill and restore. See issue 68227.
|
||||
return false
|
||||
}
|
||||
switch x.Op {
|
||||
case OpAMD64MOVLconst, OpAMD64MOVLload, OpAMD64MOVLQZX, OpAMD64MOVLloadidx1,
|
||||
OpAMD64MOVWload, OpAMD64MOVWloadidx1, OpAMD64MOVBload, OpAMD64MOVBloadidx1,
|
||||
@ -1305,7 +1310,7 @@ func zeroUpper32Bits(x *Value, depth int) bool {
|
||||
case OpArg: // note: but not ArgIntReg
|
||||
// amd64 always loads args from the stack unsigned.
|
||||
// most other architectures load them sign/zero extended based on the type.
|
||||
return x.Type.Size() == 4 && (x.Type.IsUnsigned() || x.Block.Func.Config.arch == "amd64")
|
||||
return x.Type.Size() == 4 && x.Block.Func.Config.arch == "amd64"
|
||||
case OpPhi, OpSelect0, OpSelect1:
|
||||
// Phis can use each-other as an arguments, instead of tracking visited values,
|
||||
// just limit recursion depth.
|
||||
@ -1325,11 +1330,14 @@ func zeroUpper32Bits(x *Value, depth int) bool {
|
||||
|
||||
// zeroUpper48Bits is similar to zeroUpper32Bits, but for upper 48 bits.
|
||||
func zeroUpper48Bits(x *Value, depth int) bool {
|
||||
if x.Type.IsSigned() && x.Type.Size() < 8 {
|
||||
return false
|
||||
}
|
||||
switch x.Op {
|
||||
case OpAMD64MOVWQZX, OpAMD64MOVWload, OpAMD64MOVWloadidx1, OpAMD64MOVWloadidx2:
|
||||
return true
|
||||
case OpArg: // note: but not ArgIntReg
|
||||
return x.Type.Size() == 2 && (x.Type.IsUnsigned() || x.Block.Func.Config.arch == "amd64")
|
||||
return x.Type.Size() == 2 && x.Block.Func.Config.arch == "amd64"
|
||||
case OpPhi, OpSelect0, OpSelect1:
|
||||
// Phis can use each-other as an arguments, instead of tracking visited values,
|
||||
// just limit recursion depth.
|
||||
@ -1349,11 +1357,14 @@ func zeroUpper48Bits(x *Value, depth int) bool {
|
||||
|
||||
// zeroUpper56Bits is similar to zeroUpper32Bits, but for upper 56 bits.
|
||||
func zeroUpper56Bits(x *Value, depth int) bool {
|
||||
if x.Type.IsSigned() && x.Type.Size() < 8 {
|
||||
return false
|
||||
}
|
||||
switch x.Op {
|
||||
case OpAMD64MOVBQZX, OpAMD64MOVBload, OpAMD64MOVBloadidx1:
|
||||
return true
|
||||
case OpArg: // note: but not ArgIntReg
|
||||
return x.Type.Size() == 1 && (x.Type.IsUnsigned() || x.Block.Func.Config.arch == "amd64")
|
||||
return x.Type.Size() == 1 && x.Block.Func.Config.arch == "amd64"
|
||||
case OpPhi, OpSelect0, OpSelect1:
|
||||
// Phis can use each-other as an arguments, instead of tracking visited values,
|
||||
// just limit recursion depth.
|
||||
|
@ -107,6 +107,20 @@ func (s *Schedule) tryStaticInit(n ir.Node) bool {
|
||||
case ir.OAS:
|
||||
n := n.(*ir.AssignStmt)
|
||||
lhs, rhs = []ir.Node{n.X}, n.Y
|
||||
case ir.OAS2:
|
||||
// Usually OAS2 has been rewritten to separate OASes by types2.
|
||||
// What's left here is "var a, b = tmp1, tmp2" as a result from rewriting
|
||||
// "var a, b = f()" that needs type conversion, which is not static.
|
||||
n := n.(*ir.AssignListStmt)
|
||||
for _, rhs := range n.Rhs {
|
||||
for rhs.Op() == ir.OCONVNOP {
|
||||
rhs = rhs.(*ir.ConvExpr).X
|
||||
}
|
||||
if name, ok := rhs.(*ir.Name); !ok || !name.AutoTemp() {
|
||||
base.FatalfAt(n.Pos(), "unexpected rhs, not an autotmp: %+v", rhs)
|
||||
}
|
||||
}
|
||||
return false
|
||||
case ir.OAS2DOTTYPE, ir.OAS2FUNC, ir.OAS2MAPR, ir.OAS2RECV:
|
||||
n := n.(*ir.AssignListStmt)
|
||||
if len(n.Lhs) < 2 || len(n.Rhs) != 1 {
|
||||
|
@ -663,14 +663,14 @@ func RewriteMultiValueCall(n ir.InitNode, call ir.Node) {
|
||||
|
||||
switch n := n.(type) {
|
||||
default:
|
||||
base.Fatalf("rewriteMultiValueCall %+v", n.Op())
|
||||
base.Fatalf("RewriteMultiValueCall %+v", n.Op())
|
||||
case *ir.CallExpr:
|
||||
n.Args = list
|
||||
case *ir.ReturnStmt:
|
||||
n.Results = list
|
||||
case *ir.AssignListStmt:
|
||||
if n.Op() != ir.OAS2FUNC {
|
||||
base.Fatalf("rewriteMultiValueCall: invalid op %v", n.Op())
|
||||
base.Fatalf("RewriteMultiValueCall: invalid op %v", n.Op())
|
||||
}
|
||||
as.SetOp(ir.OAS2FUNC)
|
||||
n.SetOp(ir.OAS2)
|
||||
|
@ -1092,3 +1092,32 @@ func _() {
|
||||
conf := Config{GoVersion: "go1.17"}
|
||||
mustTypecheck(src, &conf, nil)
|
||||
}
|
||||
|
||||
func TestIssue68334(t *testing.T) {
|
||||
const src = `
|
||||
package p
|
||||
|
||||
func f(x int) {
|
||||
for i, j := range x {
|
||||
_, _ = i, j
|
||||
}
|
||||
var a, b int
|
||||
for a, b = range x {
|
||||
_, _ = a, b
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
got := ""
|
||||
conf := Config{
|
||||
GoVersion: "go1.21", // #68334 requires GoVersion <= 1.21
|
||||
Error: func(err error) { got += err.Error() + "\n" }, // #68334 requires Error != nil
|
||||
}
|
||||
typecheck(src, &conf, nil) // do not crash
|
||||
|
||||
want := "p:5:20: cannot range over x (variable of type int): requires go1.22 or later\n" +
|
||||
"p:9:19: cannot range over x (variable of type int): requires go1.22 or later\n"
|
||||
if got != want {
|
||||
t.Errorf("got: %s want: %s", got, want)
|
||||
}
|
||||
}
|
||||
|
@ -920,14 +920,15 @@ func (check *Checker) rangeStmt(inner stmtContext, s *syntax.ForStmt, rclause *s
|
||||
|
||||
// initialize lhs iteration variable, if any
|
||||
typ := rhs[i]
|
||||
if typ == nil {
|
||||
if typ == nil || typ == Typ[Invalid] {
|
||||
// typ == Typ[Invalid] can happen if allowVersion fails.
|
||||
obj.typ = Typ[Invalid]
|
||||
obj.used = true // don't complain about unused variable
|
||||
continue
|
||||
}
|
||||
|
||||
if rangeOverInt {
|
||||
assert(i == 0) // at most one iteration variable (rhs[1] == nil for rangeOverInt)
|
||||
assert(i == 0) // at most one iteration variable (rhs[1] == nil or Typ[Invalid] for rangeOverInt)
|
||||
check.initVar(obj, &x, "range clause")
|
||||
} else {
|
||||
var y operand
|
||||
@ -957,12 +958,12 @@ func (check *Checker) rangeStmt(inner stmtContext, s *syntax.ForStmt, rclause *s
|
||||
|
||||
// assign to lhs iteration variable, if any
|
||||
typ := rhs[i]
|
||||
if typ == nil {
|
||||
if typ == nil || typ == Typ[Invalid] {
|
||||
continue
|
||||
}
|
||||
|
||||
if rangeOverInt {
|
||||
assert(i == 0) // at most one iteration variable (rhs[1] == nil for rangeOverInt)
|
||||
assert(i == 0) // at most one iteration variable (rhs[1] == nil or Typ[Invalid] for rangeOverInt)
|
||||
check.assignVar(lhs, nil, &x, "range clause")
|
||||
// If the assignment succeeded, if x was untyped before, it now
|
||||
// has a type inferred via the assignment. It must be an integer.
|
||||
|
@ -25,8 +25,8 @@ type TypeParam struct {
|
||||
}
|
||||
|
||||
// NewTypeParam returns a new TypeParam. Type parameters may be set on a Named
|
||||
// or Signature type by calling SetTypeParams. Setting a type parameter on more
|
||||
// than one type will result in a panic.
|
||||
// type by calling SetTypeParams. Setting a type parameter on more than one type
|
||||
// will result in a panic.
|
||||
//
|
||||
// The constraint argument can be nil, and set later via SetConstraint. If the
|
||||
// constraint is non-nil, it must be fully defined.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user