1
0
mirror of https://github.com/golang/go synced 2024-11-08 18:56:25 -07:00
Commit Graph

54570 Commits

Author SHA1 Message Date
Cherry Mui
706d84fca2 cmd/link: suppress -no_pie deprecation warning on darwin
Apparently the new darwin linker starts to emit a warning about
-no_pie deprecation. Maybe we want to switch to PIE by default.
For now, suppress the warning. This also makes it easier for
backporting to previous releases.

For #54482.

Change-Id: I1a3b74c237a9d00ec3b030fc3a9940a31e5cd37e
Reviewed-on: https://go-review.googlesource.com/c/go/+/430937
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-16 15:09:42 +00:00
Austin Clements
5abf200d65 cmd/dist: simplify exec.Cmd helpers for Go 1.19
When running on Go 1.19, we can further simplify some of the exec.Cmd
helpers due to API improvements. There's not much point in doing this
while the bootstrap is still 1.17, but this will queue up this
simplification in an obvious way for when we next upgrade the
bootstrap toolchain (#54265).

Updates #44505.

Change-Id: I2ebc3d5c584375ec862a1d48138ab134bd9b2366
Reviewed-on: https://go-review.googlesource.com/c/go/+/427958
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-16 15:08:37 +00:00
Austin Clements
d9f90df2b4 cmd/dist: simplify exec.Cmd helpers
Now that the required Go bootstrap version is 1.17, we can simplify
some of the logic for working with exec.Cmd.Env as those APIs have
been simplified.

Updates #44505.

Change-Id: Ia62ab9830320c7daf65a15f2313471dfaba687b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/427957
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-16 15:08:31 +00:00
Shengyu Zhang
88b51d2e63 go/printer: make ExampleFprint correctly run as online example
function "ExampleFprint" will be rewritten to function "main"
when displayed on the godoc pages, so the online example is failed to
run:

    Output:

    panic: function not found

    goroutine 1 [running]:
    main.parseFunc({0x4f772e, 0xf}, {0x4f713f, 0xd})
            /tmp/sandbox1264544227/prog.go:23 +0x13b
    main.main()
            /tmp/sandbox1264544227/prog.go:30 +0x45

See: https://pkg.go.dev/go/printer#example-Fprint

Add printSelf function to prevent the function not found when running in godoc
sandbox. Beside, deleting the dummy test function to make the example show
the entire file, as we want to show the newly added printSelf function.

Change-Id: Ia2b772937081b58a0fce9860838959c95f2d650c
GitHub-Last-Rev: bac1189173
GitHub-Pull-Request: golang/go#53141
Reviewed-on: https://go-review.googlesource.com/c/go/+/409314
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2022-09-16 14:55:02 +00:00
Russ Cox
b35b4a31e1 cmd/go: delete useless env var setting in test
The correct spelling is asyncpreemptoff=1,
but clearly this test doesn't need it.

Change-Id: Ic69cf5be04bf90d357a6e4d8ae3f9011f1779922
Reviewed-on: https://go-review.googlesource.com/c/go/+/430575
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-16 14:49:13 +00:00
Russ Cox
e4a2c38af5 cmd/go, testing: add go test -skip flag
For proposal #41583, add a new 'go test -skip' flag to make it easy
to disable specific tests, benchmarks, examples, or fuzz targets.

Fixes #41583.

Change-Id: Id12a6575f505dafdce4a149aedc454a002e93afa
Reviewed-on: https://go-review.googlesource.com/c/go/+/421439
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-09-16 14:48:54 +00:00
Russ Cox
819e3394c9 cmd/internal/objabi: record GO$GOARCH setting in object header
The object header string is meant to record the relevant toolchain
configuration, so that we don't import or link object files that are
incompatible with each other. One important part of compatibility
is the sub-architecture version (GOARM for GOARCH=arm, and so on).

Add the sub-architecture info to the object header line so that
binaries cannot be built that have inconsistent sub-architecture
configurations across the build.

This check is only important when the build system makes a mistake.
Builds using the go command don't make this kind of mistake anymore,
but we just debugged a difficult problem inside Google where a custom
build system had built part of a program with GOARM=5 and part of
a program with GOARM=7, resulting in corrupted execution when
signal-based preemption was attempted. Updating the check will avoid
this kind of problem in the future, in any custom build system, or if the
go command makes a mistake.

After this change:

% sed 3q pkg/darwin_amd64/runtime.a
!<arch>
__.PKGDEF       0           0     0     644     30525     `
go object darwin amd64 devel go1.20-102ebe10b7 Wed Aug 17 14:31:01 2022 -0400 GOAMD64=v1 X:regabiwrappers,regabiargs
%

Change-Id: I901e0758f1002dd2c58292dc65e2d06da86e4495
Reviewed-on: https://go-review.googlesource.com/c/go/+/427174
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-16 12:40:45 +00:00
Yuval Pavel Zholkover
e0e1ce9888 runtime: switch FreeBSD to use the non-COMPAT_FREEBSD11 version of the kevent syscall
Update #53280

Change-Id: I1c8d4510fbe8bdfe9a41575bde54ea2fbf6b67e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/413174
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Yuval Pavel Zholkover <paulzhol@gmail.com>
2022-09-16 06:31:07 +00:00
Yuval Pavel Zholkover
d8220ac32f syscall: remove FreeBSD 11 and below 64bit inode compatibility shims
Update #53280

Change-Id: Iaa7c0cf5dbefaa8e14c2de499f99755911c17672
Reviewed-on: https://go-review.googlesource.com/c/go/+/411596
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
2022-09-16 01:17:28 +00:00
Cuong Manh Le
805f174e5c reflect: allow conversion from slice to array
Updates #46505

Change-Id: Ib8f52d6ae199338f278731267c966da85dd0acdd
Reviewed-on: https://go-review.googlesource.com/c/go/+/430475
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-16 00:17:05 +00:00
Rob Pike
36760ca9fd text/template/parse: simplify I/O in lexing
The concurrent model for delivering tokens was fine for pedagogy,
but has caused a few problems as the package has evolved (that is,
got more complicated). It's easy to eliminate it, simplifying or
removing some of the hacks used to work around these prolems.

The old lexer would deliver tokens over a channel to the parsing
goroutine, and continue running until EOF. In this rewrite, we
instead run the machine until a token is ready, and shut it down
until the next token is needed. The mechanism is just to return nil
as the state function, which requires a bit more threading of return
values through the state functions but is not difficult. The change
is modest.

A couple of error messages change, but otherwise the change has no
external effect. This is just an internal cleanup, long overdue.

benchmark                      old ns/op     new ns/op     delta
BenchmarkParseLarge-20         12222729      6769966       -44.61%
BenchmarkVariableString-20     73.5          73.4          -0.16%
BenchmarkListString-20         1827          1841          +0.77%

benchmark                      old allocs     new allocs     delta
BenchmarkVariableString-20     3              3              +0.00%
BenchmarkListString-20         31             31             +0.00%

benchmark                      old bytes     new bytes     delta
BenchmarkVariableString-20     72            72            +0.00%
BenchmarkListString-20         1473          1473          +0.00%

Fixes #53261

Change-Id: I4133bed2f8df16d398b707fb9509230325765c57
Reviewed-on: https://go-review.googlesource.com/c/go/+/421883
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2022-09-15 21:33:37 +00:00
Paul E. Murphy
3a067b288e cmd/internal/obj/ppc64: add ISA 3.1 instructions
Use ppc64map (from x/arch) to generate ISA 3.1 support for the
assembler. A new file asm9_gtables.go is added which contains
generated code to encode ISA 3.1 instructions, a function to assist
filling out the oprange structure, a lookup table for the fixed
bits of each instructions, and a slice of string name. Generated
functions are shared if their bitwise encoding match, and the
translation from an obj.Prog structure matches.

The generated file is entirely self-contained, and does not require
regenerating any other files for changes within it. If opcodes in
a.out.go are reordered or changed, anames.go must be updated in
the same way as before.

Future improvements could shrink the generated opcode table
to 32 bit entries as there is much less variation of the
encoding of the prefix word, but it is not always identical
for instructions which share a similar encoding of arguments
(e.g PLWA and PLWZ).

Updates #44549

Change-Id: Ie83fa02497c9ad2280678d68391043d3aae63175
Reviewed-on: https://go-review.googlesource.com/c/go/+/419535
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
2022-09-15 21:12:43 +00:00
Archana R
c075c21ba5 cmd/asm, cmd/internal/obj/ppc64: increase asm test coverage for PPC64
This CL adds tests for some of the instructions that were
missing. A minor change was made to asm9.go to ensure EXTSWSLICC
test works.

Change-Id: I95cd096c85778fc93856d213aa4fb14c35228cec
Reviewed-on: https://go-review.googlesource.com/c/go/+/430376
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Paul Murphy <murp@ibm.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
2022-09-15 21:12:10 +00:00
cuiweixie
dedce99c06 os: convert Process.isdone to atomic type
Change-Id: Ia3213d22678be0d56bf4f34dfe458441f7f5da97
Reviewed-on: https://go-review.googlesource.com/c/go/+/426077
Run-TryBot: Michael Pratt <mpratt@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
2022-09-15 21:11:27 +00:00
cuiweixie
e50dd0e974 database: convert DB.{waitDuration,numClosed} to atomic type
Change-Id: I4a67a5e51a98938c07b3c38442f8d852db97cb2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/426085
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: xie cui <523516579@qq.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2022-09-15 21:11:10 +00:00
Paul E. Murphy
7fda98a8d9 cmd/link: support -fno-plt compiled gcc objects on ppc64le
This is the initial trivial implemenation. Further improvements can be
made for local calls.

A test is added, but the -fno-plt option is ignored by gcc if binutils
does not support inline plt relocations, so the test is effectively
skipped on such hosts.

Fixes #53345

Change-Id: Ibf31c26b1a8551c942b21019df8782c00b7a563e
Reviewed-on: https://go-review.googlesource.com/c/go/+/412714
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
2022-09-15 21:11:05 +00:00
Joe Tsai
e7a2014fac time: move RFC 3339 optimizations to separate file
The optimizations were added in CL 425197 and CL 421877.
Move this functionality to a separate file to keep format.go smaller
and to document the justification for why this optimization exists.

Change-Id: I1e4e1ace19f9d596d8c0cf49ab6062f63a87b5bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/430675
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
2022-09-15 21:10:36 +00:00
Tobias Klauser
f15582c477 syscall: use fcntl F_DUP2FD_CLOEXEC in forkAndExecInChild on dragonfly
Use fcntl(oldfd, F_DUP2FD_CLOEXEC, newfd) to duplicate the file
descriptor and mark is as close-on-exec instead of dup2 & fcntl.

DragonFly BSD implements dup3 like this in libc since version 5.4.

Change-Id: I80c765faa288add8ffb236284c9e8c4f8e6c6769
Reviewed-on: https://go-review.googlesource.com/c/go/+/430535
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-15 21:09:41 +00:00
cui fliter
95ec579eb6 strconv: add a test case when base is illegal
Increase unit test coverage of strconv/itoa.go from 83.8% to 85%

Change-Id: I0abdfc70a3f06251106f229c12ffb105eeb43fc8
GitHub-Last-Rev: da9755368b
GitHub-Pull-Request: golang/go#55014
Reviewed-on: https://go-review.googlesource.com/c/go/+/430137
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
2022-09-15 21:09:39 +00:00
Erik Pellizzon
f6436c60e4 hash/crc32: remove redundant code
Merge the CRC32 Update and Write functions using an unexported function, to avoid duplication of code and make it more readable.
The only difference between them is the check of the initialization of the IEEE table, and a boolean value specifies that.

Throughout the crc32.go file, in the switches the default value is inserted inside the switch statement, this change uniforms the style of the MakeTable function, making it like the other pieces of code.

Change-Id: I3889f6c6671210c82f0d7250cea67907bccf3ce7
GitHub-Last-Rev: b8777ee213
GitHub-Pull-Request: golang/go#55044
Reviewed-on: https://go-review.googlesource.com/c/go/+/430456
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-15 21:07:21 +00:00
Tobias Klauser
a7db14241c syscall: use fcntl F_DUP2FD_CLOEXEC in forkAndExecInChild on solaris
Use fcntl(oldfd, F_DUP2FD_CLOEXEC, newfd) to duplicate the file
descriptor and mark is as close-on-exec instead of dup2 & fcntl.

Note that the value for F_DUP2FD_CLOEXEC is different on Solaris and
Illumos and thus the definition is moved from zerrors_solaris_amd64.go
to solaris/illumos specific files.

Change-Id: I9a52801d1a01471ec3f065520575e3fafee92855
Reviewed-on: https://go-review.googlesource.com/c/go/+/428375
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-15 21:07:18 +00:00
kurochan
e0822b55ac text/template: fixed typo in a nested template definition
The text was mistakenly quoted with backquotes.

Change-Id: I77ed4adac8c78b719bea61c08f1c377ed4ac4c9d
GitHub-Last-Rev: 6f1430fe16
GitHub-Pull-Request: golang/go#55059
Reviewed-on: https://go-review.googlesource.com/c/go/+/430775
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
2022-09-15 21:05:40 +00:00
Wayne Zuo
629c0b3a6e cmd/compile: make encoding/binary appends cheaper to inline
Go 1.19 introduce new append-like APIs in package encoding/binary, this
change teaches the inliner to treat calls to these methods as cheap, so
that code using them will be more inlineable.

Updates #42958

Change-Id: Ie3dd4906e285430f435bdedbf8a11fdffce9302d
Reviewed-on: https://go-review.googlesource.com/c/go/+/431015
Auto-Submit: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-09-15 21:05:02 +00:00
Wayne Zuo
5760fde4df cmd/compile: avoid sign extension after word arithmetic on riscv64
These instructions already do sign extension on output, so we can get rid of it.

Note: (MOVWreg (MULW x y)) may araise from divisions by constant,
generic rules replace them with multiply and may produce (Rsh32x64 (Mul32 _ _) _).

Change-Id: I41bc9b519e38bc6027311de604dadb962cd0bbf4
Reviewed-on: https://go-review.googlesource.com/c/go/+/429757
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
2022-09-15 21:04:37 +00:00
cuiweixie
501df45199 cmd/go: use strings.Builder
Change-Id: I0db93b7bdcd622ce9e23df183de4737744e6d6ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/428294
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
2022-09-15 21:04:34 +00:00
Tobias Klauser
7722b3c86d internal/syscall/unix: remove superfluous var declarations in {Unlink,Open}at
Change-Id: Id58e3aebf325433768675523bf34c0b7e0e34aea
Reviewed-on: https://go-review.googlesource.com/c/go/+/431235
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-15 21:04:12 +00:00
Joe Tsai
a29739145d compress/flate: update NewReader documentation
Calling close is no longer necessary.
It was was originally necessary to cleanup goroutines
spawned to decompress the stream.
This has not been the case since CL 4548079.

Update the documentation to mention how it handles trailing data
after the end of the DEFLATE stream.

Change-Id: Ieacba264230560713b7b8d604665223fd096f4ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/430377
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-09-15 20:02:32 +00:00
Joel Sing
44ad662a49 runtime: optimise memclrNoHeapPointers on riscv64
Implement a more optimised memclrNoHeapPointers on riscv64, where up
to 64 bytes are zeroed per loop after achieving alignment.

name                     old time/op    new time/op     delta
Memclr/5-4                 53.1ns _ 0%     37.0ns _ 4%   -30.37%  (p=0.002 n=3+3)
Memclr/16-4                42.3ns _ 0%     34.8ns _ 0%   -17.81%  (p=0.000 n=3+3)
Memclr/64-4                67.8ns _ 0%     44.0ns _ 1%   -35.09%  (p=0.000 n=3+3)
Memclr/256-4                185ns _ 0%       78ns _ 1%   -57.52%  (p=0.000 n=3+3)
Memclr/4096-4              2.50_s _ 1%     0.76_s _ 1%   -69.72%  (p=0.000 n=3+3)
Memclr/65536-4             55.6_s _ 0%     31.4_s _ 0%   -43.56%  (p=0.000 n=3+3)
Memclr/1M-4                1.15ms _ 0%     0.72ms _ 1%   -37.14%  (p=0.000 n=3+3)
Memclr/4M-4                12.1ms _ 3%     10.1ms _ 0%   -16.51%  (p=0.007 n=3+3)
Memclr/8M-4                25.2ms _ 1%     21.5ms _ 0%   -14.75%  (p=0.001 n=3+3)
Memclr/16M-4               52.8ms _ 5%     43.4ms _ 0%   -17.95%  (p=0.019 n=3+3)
Memclr/64M-4                202ms _ 1%      173ms _ 0%   -14.42%  (p=0.001 n=3+3)
MemclrRange/1K_2K-4        54.0_s _ 1%     22.0_s _ 0%   -59.26%  (p=0.000 n=3+3)
MemclrRange/2K_8K-4         176_s _ 1%       64_s _ 1%   -63.77%  (p=0.000 n=3+3)
MemclrRange/4K_16K-4        172_s _ 6%       60_s _ 0%   -65.38%  (p=0.002 n=3+3)
MemclrRange/160K_228K-4    1.54ms _ 1%     0.91ms _ 0%   -40.60%  (p=0.000 n=3+3)

name                     old speed      new speed       delta
Memclr/5-4               94.1MB/s _ 0%  135.3MB/s _ 4%   +43.70%  (p=0.004 n=3+3)
Memclr/16-4               378MB/s _ 0%    460MB/s _ 0%   +21.67%  (p=0.000 n=3+3)
Memclr/64-4               943MB/s _ 0%   1454MB/s _ 1%   +54.07%  (p=0.000 n=3+3)
Memclr/256-4             1.39GB/s _ 0%   3.26GB/s _ 1%  +135.38%  (p=0.000 n=3+3)
Memclr/4096-4            1.64GB/s _ 1%   5.41GB/s _ 1%  +230.28%  (p=0.000 n=3+3)
Memclr/65536-4           1.18GB/s _ 0%   2.09GB/s _ 0%   +77.19%  (p=0.000 n=3+3)
Memclr/1M-4               914MB/s _ 0%   1454MB/s _ 1%   +59.08%  (p=0.000 n=3+3)
Memclr/4M-4               346MB/s _ 3%    415MB/s _ 0%   +19.73%  (p=0.004 n=3+3)
Memclr/8M-4               332MB/s _ 1%    390MB/s _ 0%   +17.29%  (p=0.000 n=3+3)
Memclr/16M-4              318MB/s _ 5%    387MB/s _ 0%   +21.72%  (p=0.013 n=3+3)
Memclr/64M-4              333MB/s _ 1%    389MB/s _ 0%   +16.84%  (p=0.001 n=3+3)
MemclrRange/1K_2K-4      1.78GB/s _ 1%   4.36GB/s _ 0%  +145.48%  (p=0.000 n=3+3)
MemclrRange/2K_8K-4      1.89GB/s _ 1%   5.22GB/s _ 1%  +176.03%  (p=0.000 n=3+3)
MemclrRange/4K_16K-4     1.88GB/s _ 5%   5.42GB/s _ 0%  +188.40%  (p=0.000 n=3+3)
MemclrRange/160K_228K-4  1.08GB/s _ 1%   1.82GB/s _ 0%   +68.35%  (p=0.000 n=3+3)

Change-Id: Ide566f148f890f70217ed08fd472ee5893d3511c
Reviewed-on: https://go-review.googlesource.com/c/go/+/426255
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-15 19:29:39 +00:00
Cherry Mui
5231ba2f05 cmd/link: stop passing -pagezero_size to darwin linker
We added -pagezero_size in CL 72730, where it was intented for iOS.
The current code passes it only on macOS/AMD64 instead. It is not
really necessary there. Also, the new darwin linker starts to emit
a warning about deprecation of the flag. Stop passing it.

For #54482.

Change-Id: If9db7a1645c37d4284e48f075856912df8d8c1a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/430936
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
2022-09-15 14:57:53 +00:00
Keith Randall
e665de2861 runtime/race: introduce subarch versioning of race syso
Allow us to select a race .syso file based on subarch values.

Note that this doesn't actually change the syso used. This CL
just moves things around in preparation for adding v3-specific
versions in future CLs.

Change-Id: I14e3c273a7c6f07b13b22193b7a851ea94c765cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/424034
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
2022-09-15 14:08:12 +00:00
Tobias Klauser
7c3284401f cmd, syscall: use syscall.Mmap on solaris for Go ≥ 1.20
CL 413374 added syscall.Mmap on solaris. Use it in cmd/compile and
cmd/link if the bootstrap toolchain is Go ≥ 1.20.

For #52875
For #54265

Change-Id: I9a0534bf97926eecf0c6f1f9218e855344ba158f
Reviewed-on: https://go-review.googlesource.com/c/go/+/430496
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
2022-09-15 06:23:50 +00:00
Kévin Dunglas
972870da11 net/http/httputil: forward 1xx responses in ReverseProxy
Support for 1xx responses has recently been merged in
net/http (CL 269997).

As discussed in this CL
(https://go-review.googlesource.com/c/go/+/269997/comments/1ff70bef_c25a829a),
support for forwarding 1xx responses in ReverseProxy has been extracted
in this separate patch.

According to RFC 7231, "a proxy MUST forward 1xx responses unless the
proxy itself requested the generation of the 1xx response".
Consequently, all received 1xx responses are automatically forwarded as long as the
underlying transport supports ClientTrace.Got1xxResponse.

Fixes #26088
Fixes #51914

Change-Id: I3a35ea023b798bfe56b7fb8696d5a49695229cfd
GitHub-Last-Rev: dab8a461fb
GitHub-Pull-Request: golang/go#53164
Reviewed-on: https://go-review.googlesource.com/c/go/+/409536
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
Run-TryBot: hopehook <hopehook@golangcn.org>
2022-09-14 23:59:32 +00:00
Emmanuel T Odeke
4baa486983 all: remove unnecessary allocations from w.WriteString(fmt.Sprint*(...)) by fmt.Fprint*(w, ...)
Noticed in a manual audit from a customer codebase that the pattern

    w.WriteString(fmt.Sprint*(args...))

was less efficient and in most cases we can just invoke:

    fmt.Fprint*(w, args...)

and from the simple benchmarks we can see quick wins in all dimensions:

$ benchstat before.txt after.txt
name            old time/op    new time/op    delta
DetailString-8    5.48µs ±23%    4.40µs ±11%  -19.79%  (p=0.000 n=20+17)

name            old alloc/op   new alloc/op   delta
DetailString-8    2.63kB ± 0%    2.11kB ± 0%  -19.76%  (p=0.000 n=20+20)

name            old allocs/op  new allocs/op  delta
DetailString-8      63.0 ± 0%      50.0 ± 0%  -20.63%  (p=0.000 n=20+20)

Change-Id: I47a2827cd34d6b92644900b1bd5f4c0a3287bdb1
Reviewed-on: https://go-review.googlesource.com/c/go/+/429861
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: hopehook <hopehook@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2022-09-14 16:11:21 +00:00
Ali Yousefi Sabzevar
a7e9a379e9 go/types, types2: improve readability of _InvalidUntypedConversion docs
Remove an unnecessary 'an' from errorcodes.go.

Change-Id: Iabe8ce479077cbfff936d57c788a9b39d7e5b34e
Reviewed-on: https://go-review.googlesource.com/c/go/+/430495
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-09-14 15:19:55 +00:00
Anuraag Agrawal
9503bcae2b strings: reuse the input string for Repeat count of 1
The existing implementation allocates a new string even when the
count is 1, where we know the output is the same as the input.
While we wouldn't expect a count of 1 for hardcoded values of the
parameter, it is expected when the parameter is computed based on
a different value (e.g., the length of a input slice).

name            old time/op  new time/op  delta
Repeat/5x0-10   2.03ns ± 0%  2.02ns ± 0%   ~     (p=1.000 n=1+1)
Repeat/5x1-10   13.7ns ± 0%   2.0ns ± 0%   ~     (p=1.000 n=1+1)
Repeat/5x2-10   18.2ns ± 0%  18.1ns ± 0%   ~     (p=1.000 n=1+1)
Repeat/5x6-10   27.0ns ± 0%  27.0ns ± 0%   ~     (p=1.000 n=1+1)
Repeat/10x0-10  2.02ns ± 0%  2.02ns ± 0%   ~     (p=1.000 n=1+1)
Repeat/10x1-10  16.1ns ± 0%   2.0ns ± 0%   ~     (p=1.000 n=1+1)
Repeat/10x2-10  20.8ns ± 0%  20.9ns ± 0%   ~     (p=1.000 n=1+1)
Repeat/10x6-10  29.2ns ± 0%  29.4ns ± 0%   ~     (p=1.000 n=1+1)

Change-Id: I48e08e08f8f6d6914d62b3d6a61d563d637bec59
GitHub-Last-Rev: 068f58e08b
GitHub-Pull-Request: golang/go#53321
Reviewed-on: https://go-review.googlesource.com/c/go/+/411477
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2022-09-14 14:56:07 +00:00
Ian Lance Taylor
d60e51e353 go/build: remove unnecessary copies of package variables
These variables never change, we don't need second copies of them.

Also rename bPlusBuild to plusBuild, since it is the only remaining
variable with a "b" prefix.

Change-Id: I97089b001d23e9b0f2096e19d9ceed7a9bbb377d
Reviewed-on: https://go-review.googlesource.com/c/go/+/429636
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-14 14:52:52 +00:00
Bryan C. Mills
72e07dbee0 cmd/go/testdata/script: remove reference to fixed issue
The issue referenced in work_prune.txt was fixed in CL 362754, but we
forgot to update the TODO or mark the issue as fixed in the commit
message.

Updates #48331.

Change-Id: Id2115e496aeaef275dd3c8d32c5c5564e6addb07
Reviewed-on: https://go-review.googlesource.com/c/go/+/425485
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-09-14 14:30:53 +00:00
Ian Lance Taylor
ebbaba2813 path/filepath: document that WalkDir uses OS paths
Fixes #52812

Change-Id: Idb70d0540bbf9ecdc64293c62a23f07ee3be883c
Reviewed-on: https://go-review.googlesource.com/c/go/+/405615
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Caleb Spare <cespare@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-14 14:19:13 +00:00
Tobias Klauser
244127e4b4 all: move //go:build lines below copyright notice
Change-Id: Ib6196f01b1927ea8a84c095f445320f03a514dd1
Reviewed-on: https://go-review.googlesource.com/c/go/+/429796
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-09-14 14:17:04 +00:00
jiepeng
585c438615 cmd/go/internal/vcs: replace [A-Za-z0-9_] with \w in regexps
Change-Id: Ibcc7dbb528585b019ff1b743792a52f43a4c2233
GitHub-Last-Rev: e907fb00e3
GitHub-Pull-Request: golang/go#54882
Reviewed-on: https://go-review.googlesource.com/c/go/+/428535
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-14 11:32:35 +00:00
Cherry Mui
a813be86df cmd/compile: don't use R25 as input for LoweredMove on ARM64
The rule uses R25 as a scratch register. If the input is R25 it
will be clobbered on the way, causing wrong result.

Change-Id: I464eadbdef0f3a5e90f9ef8c818393baa4335b87
Reviewed-on: https://go-review.googlesource.com/c/go/+/430015
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Eric Fang <eric.fang@arm.com>
2022-09-13 17:43:40 +00:00
cui fliter
f78efc0178 runtime: convert timer.status to atomic type
For #53821

Change-Id: I7cb6a16626964d5023b96609d9921bfe4a679d8f
GitHub-Last-Rev: ddfce125be
GitHub-Pull-Request: golang/go#54865
Reviewed-on: https://go-review.googlesource.com/c/go/+/428196
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-13 17:41:56 +00:00
Vladimir Varankin
39b31a3eb2 net/http: make DefaultTransport docs about HTTP proxy consistent
The changes improve the documentation for DefaultTransport, making
the style with how the HTTP proxy environment variables are being
referred to, consistent with the rest of the project's
documentation.

Also mention HTTPS_PROXY environment variables, as suggested in #32649.

Change-Id: I4e6b49881d7b30b5a0d4699531fa7c2929fc49f7
GitHub-Last-Rev: 2fc751937b
GitHub-Pull-Request: golang/go#54996
Reviewed-on: https://go-review.googlesource.com/c/go/+/430135
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-13 17:41:36 +00:00
Cuong Manh Le
5bbee7a095 reflect: move benchmarks to its own file
all_test.go is quite big, so let it contain tests only.

Change-Id: I5003db4a8b1e2384ea8470f5e89e1c26d61d10ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/429759
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-09-13 17:41:16 +00:00
Leonard Wang
6f7c9ea855 runtime: set userForced while holding gcsema
Fixes #52515

Change-Id: If10068a97733daf61aba72da5ed3935db8eed8b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/401776
Reviewed-by: hopehook <hopehook@golangcn.org>
Run-TryBot: hopehook <hopehook@golangcn.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-13 17:41:06 +00:00
Cuong Manh Le
242adb784c syscall: simplify unsafe.Slice usage
Same as CL 429915.

Change-Id: I83f4d3bd980294d5bae387d875368b069be2d91a
Reviewed-on: https://go-review.googlesource.com/c/go/+/429955
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: hopehook <hopehook@golangcn.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
2022-09-13 17:40:53 +00:00
Joel Sing
e084d84420 cmd/internal/objabi: declare HeadType String on a non-pointer receiver
objabi.HeadType is typically used as a non-pointer type, however the String function
is declared on a pointer receiver. This means that in most cases its integer value
is printed, rather than the value from the String function.

Change-Id: I3d28d9680e88a714bc1152ed5e1df4ac43d7a33f
Reviewed-on: https://go-review.googlesource.com/c/go/+/430556
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
2022-09-13 17:39:55 +00:00
cui fliter
09f3ff174c strings: add a test case of growLen is negative
Before committing,  the test coverage of strings/builder.go is 97.4%
After committing,  the test coverage of strings/builder.go is 100%

Change-Id: I22643b1c4632b5ca7ef98362f32bb85faae80bad
GitHub-Last-Rev: 2a55ca3e33
GitHub-Pull-Request: golang/go#55004
Reviewed-on: https://go-review.googlesource.com/c/go/+/430156
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
2022-09-13 17:39:52 +00:00
Joel Sing
77420fa119 cmd/link: generate an error if the entry symbol cannot be found
If the entry symbol cannot be found (for example, a new port is being brought
up and no rt0 code has been provided), the linker will currently panic. Rather
than panicing, generate an error that aids in debugging:

	missing entry symbol "_rt0_arm64_openbsd"

Change-Id: I9cc38eaab48f730d596ca7fa9e9e3d68250ae4d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/430555
Auto-Submit: Jenny Rakoczy <jenny@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-09-13 17:39:33 +00:00
Joe Tsai
f7396aaea0 time: optimize Parse for RFC3339 and RFC3339Nano
RFC 3339 is the most common time representation,
being used in an overwhelming 57.3% of all specified formats,
while the next competitor only holds 7.5% usage.
Specially optimize parsing to handle the RFC 3339 format.
To reduce the complexity of error checking,
parseRFC3339 simply returns a bool indicating parsing success.
It leaves error handling to the general parse path.

To assist in fuzzing, the internal parse function was left unmodified
so that we could test that parseRFC3339 and parse agree with each other.

Performance:

	name             old time/op  new time/op  delta
	ParseRFC3339UTC  112ns ± 1%   37ns ± 1%    -67.37%  (p=0.000 n=9+9)
	ParseRFC3339TZ   259ns ± 2%   67ns ± 1%    -73.92%  (p=0.000 n=10+9)

Credit goes to Amarjeet Anand for a prior CL attemping to optimize this.
See CL 425014.

Fixes #54093

Change-Id: I14f4e8c52b092d44ceef6863f261842ed7e83f4c
Reviewed-on: https://go-review.googlesource.com/c/go/+/425197
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
2022-09-13 17:35:58 +00:00