From ab4085ce84f8378b4ec2dfdbbc44c98cb92debe5 Mon Sep 17 00:00:00 2001
From: Michael Anthony Knyszek
Date: Fri, 9 Jul 2021 17:34:07 +0000
Subject: runtime/pprof: call runtime.GC twice in memory profile test
This change fixes #46500 by working around #45315 which may cause freed
objects to get missed in the heap profile published for the test.
By calling runtime.GC one more time this change ensures that all freed
objects are accounted for.
Fixes #46500.
Change-Id: Iedcd0b37dbaffa688b0ff8631a8b79f7a1169634
Reviewed-on: https://go-review.googlesource.com/c/go/+/333549
Trust: Michael Knyszek
Run-TryBot: Michael Knyszek
TryBot-Result: Go Bot
Reviewed-by: Austin Clements
---
src/runtime/pprof/mprof_test.go | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/runtime/pprof/mprof_test.go b/src/runtime/pprof/mprof_test.go
index 3ef40d3de7..b4680fbdee 100644
--- a/src/runtime/pprof/mprof_test.go
+++ b/src/runtime/pprof/mprof_test.go
@@ -86,6 +86,17 @@ func TestMemoryProfiler(t *testing.T) {
runtime.GC() // materialize stats
+ // TODO(mknyszek): Fix #45315 and remove this extra call.
+ //
+ // Unfortunately, it's possible for the sweep termination condition
+ // to flap, so with just one runtime.GC call, a freed object could be
+ // missed, leading this test to fail. A second call reduces the chance
+ // of this happening to zero, because sweeping actually has to finish
+ // to move on to the next GC, during which nothing will happen.
+ //
+ // See #46500 for more details.
+ runtime.GC()
+
memoryProfilerRun++
tests := []struct {
--
cgit v1.2.3-54-g00ecf
From cfbd73ba33fc6a3635b3a63096fd6c6bff9d73e8 Mon Sep 17 00:00:00 2001
From: Austin Clements
Date: Fri, 9 Jul 2021 16:22:32 -0400
Subject: doc/go1.17: editing pass over the "Compiler" section
Change-Id: I08c082f548daa7011a8dc42769371329684c90e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/333609
Trust: Austin Clements
Trust: Dan Scales
Reviewed-by: Dan Scales
---
doc/go1.17.html | 62 +++++++++++++++++++++++++++++++++------------------------
1 file changed, 36 insertions(+), 26 deletions(-)
diff --git a/doc/go1.17.html b/doc/go1.17.html
index 4fa30158bb..fa8f14de99 100644
--- a/doc/go1.17.html
+++ b/doc/go1.17.html
@@ -401,30 +401,37 @@ func Foo() bool {
Go 1.17 implements a new way of passing function arguments and results using
- registers instead of the stack. This work is enabled for Linux, macOS, and
- Windows on the 64-bit x86 architecture (the linux/amd64
,
- darwin/amd64
, windows/amd64
ports). For a
- representative set of Go packages and programs, benchmarking has shown
- performance improvements of about 5%, and a typical reduction in binary size
- of about 2%.
+ registers instead of the stack.
+ Benchmarks for a representative set of Go packages and programs show
+ performance improvements of about 5%, and a typical reduction in
+ binary size of about 2%.
+ This is currently enabled for Linux, macOS, and Windows on the
+ 64-bit x86 architecture (the linux/amd64
,
+ darwin/amd64
, and windows/amd64
ports).
- This change does not affect the functionality of any safe Go code. It can affect
- code outside the compatibility guidelines with
- minimal impact. To maintain compatibility with existing assembly functions,
- adapter functions converting between the new register-based calling convention
- and the previous stack-based calling convention (also known as ABI wrappers)
- are sometimes used. This is mostly invisible to users, except for assembly
- functions that have their addresses taken in Go. Using reflect.ValueOf(fn).Pointer()
- (or similar approaches such as via unsafe.Pointer
) to get the address
- of an assembly function will now return the address of the ABI wrapper. This is
- mostly harmless, except for special-purpose assembly code (such as accessing
- thread-local storage or requiring a special stack alignment). Assembly functions
- called indirectly from Go via func
values will now be made through
- ABI wrappers, which may cause a very small performance overhead. Also, calling
- Go functions from assembly may now go through ABI wrappers, with a very small
- performance overhead.
+ This change does not affect the functionality of any safe Go code
+ and is designed to have no impact on most assembly code.
+ It may affect code that violates
+ the unsafe.Pointer
+ rules when accessing function arguments, or that depends on
+ undocumented behavior involving comparing function code pointers.
+ To maintain compatibility with existing assembly functions, the
+ compiler generates adapter functions that convert between the new
+ register-based calling convention and the previous stack-based
+ calling convention.
+ These adapters are typically invisible to users, except that taking
+ the address of a Go function in assembly code or taking the address
+ of an assembly function in Go code
+ using reflect.ValueOf(fn).Pointer()
+ or unsafe.Pointer
will now return the address of the
+ adapter.
+ Code that depends on the value of these code pointers may no longer
+ behave as expected.
+ Adapters also may cause a very small performance overhead in two
+ cases: calling an assembly function indirectly from Go via
+ a func
value, and calling Go functions from assembly.
@@ -440,11 +447,14 @@ func Foo() bool {
- Functions containing closures can now be inlined. One effect of this change is
- that a function with a closure may actually produce a distinct closure function
- for each place that the function is inlined. Hence, this change could reveal
- bugs where Go functions are compared (incorrectly) by pointer value. Go
- functions are by definition not comparable.
+ Functions containing closures can now be inlined.
+ One effect of this change is that a function with a closure may
+ produce a distinct closure code pointer for each place that the
+ function is inlined.
+ Go function values are not directly comparable, but this change
+ could reveal bugs in code that uses reflect
+ or unsafe.Pointer
to bypass this language restriction
+ and compare functions by code pointer.
Core library
--
cgit v1.2.3-54-g00ecf
From a98589711da5e9d935e8d690cfca92892e86d557 Mon Sep 17 00:00:00 2001
From: Roland Shoemaker
Date: Wed, 9 Jun 2021 11:31:27 -0700
Subject: crypto/tls: test key type when casting
When casting the certificate public key in generateClientKeyExchange,
check the type is appropriate. This prevents a panic when a server
agrees to a RSA based key exchange, but then sends an ECDSA (or
other) certificate.
Fixes #47143
Fixes CVE-2021-34558
Thanks to Imre Rad for reporting this issue.
Change-Id: Iabccacca6052769a605cccefa1216a9f7b7f6aea
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1116723
Reviewed-by: Filippo Valsorda
Reviewed-by: Katie Hockman
Reviewed-on: https://go-review.googlesource.com/c/go/+/334031
Trust: Filippo Valsorda
Run-TryBot: Filippo Valsorda
TryBot-Result: Go Bot
Reviewed-by: Dmitri Shuralyov
---
src/crypto/tls/key_agreement.go | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/crypto/tls/key_agreement.go b/src/crypto/tls/key_agreement.go
index 8cfbd734f1..c28a64f3a8 100644
--- a/src/crypto/tls/key_agreement.go
+++ b/src/crypto/tls/key_agreement.go
@@ -86,7 +86,11 @@ func (ka rsaKeyAgreement) generateClientKeyExchange(config *Config, clientHello
return nil, nil, err
}
- encrypted, err := rsa.EncryptPKCS1v15(config.rand(), cert.PublicKey.(*rsa.PublicKey), preMasterSecret)
+ rsaKey, ok := cert.PublicKey.(*rsa.PublicKey)
+ if !ok {
+ return nil, nil, errors.New("tls: server certificate contains incorrect key type for selected ciphersuite")
+ }
+ encrypted, err := rsa.EncryptPKCS1v15(config.rand(), rsaKey, preMasterSecret)
if err != nil {
return nil, nil, err
}
--
cgit v1.2.3-54-g00ecf
From d8f348a589b3df4bb48636023be4ccf9ac96d307 Mon Sep 17 00:00:00 2001
From: "Bryan C. Mills"
Date: Tue, 13 Jul 2021 17:25:26 -0400
Subject: cmd/go: remove a duplicated word from 'go help mod graph'
For #46366
Change-Id: Ie9735027a3c4c0f4a604df30ca4d64dcdc62b45a
Reviewed-on: https://go-review.googlesource.com/c/go/+/334375
Trust: Bryan C. Mills
Run-TryBot: Bryan C. Mills
Reviewed-by: Jay Conrod
TryBot-Result: Go Bot
---
src/cmd/go/alldocs.go | 2 +-
src/cmd/go/internal/modcmd/graph.go | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 90eb3e2a00..954caae9fb 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -1193,7 +1193,7 @@
// and one of its requirements. Each module is identified as a string of the form
// path@version, except for the main module, which has no @version suffix.
//
-// The -go flag causes graph to report the module graph as loaded by by the
+// The -go flag causes graph to report the module graph as loaded by the
// given Go version, instead of the version indicated by the 'go' directive
// in the go.mod file.
//
diff --git a/src/cmd/go/internal/modcmd/graph.go b/src/cmd/go/internal/modcmd/graph.go
index 903bd9970f..ac81f26dad 100644
--- a/src/cmd/go/internal/modcmd/graph.go
+++ b/src/cmd/go/internal/modcmd/graph.go
@@ -26,7 +26,7 @@ in text form. Each line in the output has two space-separated fields: a module
and one of its requirements. Each module is identified as a string of the form
path@version, except for the main module, which has no @version suffix.
-The -go flag causes graph to report the module graph as loaded by by the
+The -go flag causes graph to report the module graph as loaded by the
given Go version, instead of the version indicated by the 'go' directive
in the go.mod file.
--
cgit v1.2.3-54-g00ecf
From 60ddf42b4627fb4ff5f92d2193c294456175af9a Mon Sep 17 00:00:00 2001
From: "Bryan C. Mills"
Date: Fri, 2 Jul 2021 16:41:22 -0400
Subject: cmd/go: change link in error message from /wiki to /doc.
The /doc link is currently a redirect (CL 334389),
but I plan to update it soon with a more detailed guide.
Updates #36460
Change-Id: I9e4a47ad0c8bcb7361cfa3e5b9d07ad241b13ba6
Reviewed-on: https://go-review.googlesource.com/c/go/+/332573
Trust: Bryan C. Mills
Reviewed-by: Jay Conrod
Reviewed-by: Michael Matloob
---
src/cmd/go/internal/modload/load.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cmd/go/internal/modload/load.go b/src/cmd/go/internal/modload/load.go
index 771b142b73..bce9ad85f4 100644
--- a/src/cmd/go/internal/modload/load.go
+++ b/src/cmd/go/internal/modload/load.go
@@ -1808,7 +1808,7 @@ func (ld *loader) checkTidyCompatibility(ctx context.Context, rs *Requirements)
fmt.Fprintf(os.Stderr, "If reproducibility with go %s is not needed:\n\tgo mod tidy%s -compat=%s\n", ld.TidyCompatibleVersion, goFlag, ld.GoVersion)
// TODO(#46141): Populate the linked wiki page.
- fmt.Fprintf(os.Stderr, "For other options, see:\n\thttps://golang.org/wiki/PruningModules\n")
+ fmt.Fprintf(os.Stderr, "For other options, see:\n\thttps://golang.org/doc/modules/pruning\n")
}
mg, err := rs.Graph(ctx)
--
cgit v1.2.3-54-g00ecf
From 2b00a54baf2b677b2aaddd93c25b11ea4642a86f Mon Sep 17 00:00:00 2001
From: WANG Xuerui
Date: Mon, 12 Jul 2021 04:40:28 +0000
Subject: go/build, runtime/internal/sys: reserve GOARCH=loong64
Per discussion at #46229 we are taking the "loong64" GOARCH value for
the upcoming LoongArch 64-bit port. It is not clear whether any 32-bit
non-bare-metal userland will exist for LoongArch, so only reserve
"loong64" for now.
Change-Id: I97d262b4ab68ff61c22ccf83e26baf70eefd568d
GitHub-Last-Rev: ecdd8c53bdee57fec093ddba18ec8878b8ae7c74
GitHub-Pull-Request: golang/go#47129
Reviewed-on: https://go-review.googlesource.com/c/go/+/333909
Run-TryBot: Ian Lance Taylor
TryBot-Result: Go Bot
Reviewed-by: Ian Lance Taylor
Trust: Alexander Rakoczy
---
src/go/build/syslist.go | 2 +-
src/runtime/internal/sys/zgoarch_386.go | 1 +
src/runtime/internal/sys/zgoarch_amd64.go | 1 +
src/runtime/internal/sys/zgoarch_arm.go | 1 +
src/runtime/internal/sys/zgoarch_arm64.go | 1 +
src/runtime/internal/sys/zgoarch_arm64be.go | 1 +
src/runtime/internal/sys/zgoarch_armbe.go | 1 +
src/runtime/internal/sys/zgoarch_loong64.go | 33 +++++++++++++++++++++++++
src/runtime/internal/sys/zgoarch_mips.go | 1 +
src/runtime/internal/sys/zgoarch_mips64.go | 1 +
src/runtime/internal/sys/zgoarch_mips64le.go | 1 +
src/runtime/internal/sys/zgoarch_mips64p32.go | 1 +
src/runtime/internal/sys/zgoarch_mips64p32le.go | 1 +
src/runtime/internal/sys/zgoarch_mipsle.go | 1 +
src/runtime/internal/sys/zgoarch_ppc.go | 1 +
src/runtime/internal/sys/zgoarch_ppc64.go | 1 +
src/runtime/internal/sys/zgoarch_ppc64le.go | 1 +
src/runtime/internal/sys/zgoarch_riscv.go | 1 +
src/runtime/internal/sys/zgoarch_riscv64.go | 1 +
src/runtime/internal/sys/zgoarch_s390.go | 1 +
src/runtime/internal/sys/zgoarch_s390x.go | 1 +
src/runtime/internal/sys/zgoarch_sparc.go | 1 +
src/runtime/internal/sys/zgoarch_sparc64.go | 1 +
src/runtime/internal/sys/zgoarch_wasm.go | 1 +
24 files changed, 56 insertions(+), 1 deletion(-)
create mode 100644 src/runtime/internal/sys/zgoarch_loong64.go
diff --git a/src/go/build/syslist.go b/src/go/build/syslist.go
index 1275f7c986..60ac5511bd 100644
--- a/src/go/build/syslist.go
+++ b/src/go/build/syslist.go
@@ -8,4 +8,4 @@ package build
// Do not remove from this list, as these are used for go/build filename matching.
const goosList = "aix android darwin dragonfly freebsd hurd illumos ios js linux nacl netbsd openbsd plan9 solaris windows zos "
-const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc riscv riscv64 s390 s390x sparc sparc64 wasm "
+const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le loong64 mips mipsle mips64 mips64le mips64p32 mips64p32le ppc riscv riscv64 s390 s390x sparc sparc64 wasm "
diff --git a/src/runtime/internal/sys/zgoarch_386.go b/src/runtime/internal/sys/zgoarch_386.go
index 98a2401bfe..5b189e7e73 100644
--- a/src/runtime/internal/sys/zgoarch_386.go
+++ b/src/runtime/internal/sys/zgoarch_386.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_amd64.go b/src/runtime/internal/sys/zgoarch_amd64.go
index d8faa5c786..312977d079 100644
--- a/src/runtime/internal/sys/zgoarch_amd64.go
+++ b/src/runtime/internal/sys/zgoarch_amd64.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_arm.go b/src/runtime/internal/sys/zgoarch_arm.go
index b64a69c9b4..5781870324 100644
--- a/src/runtime/internal/sys/zgoarch_arm.go
+++ b/src/runtime/internal/sys/zgoarch_arm.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_arm64.go b/src/runtime/internal/sys/zgoarch_arm64.go
index de6f85347b..f72a1f2161 100644
--- a/src/runtime/internal/sys/zgoarch_arm64.go
+++ b/src/runtime/internal/sys/zgoarch_arm64.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 1
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_arm64be.go b/src/runtime/internal/sys/zgoarch_arm64be.go
index b762bb069f..e805646058 100644
--- a/src/runtime/internal/sys/zgoarch_arm64be.go
+++ b/src/runtime/internal/sys/zgoarch_arm64be.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 1
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_armbe.go b/src/runtime/internal/sys/zgoarch_armbe.go
index e5297e4b16..d8d4e56d9a 100644
--- a/src/runtime/internal/sys/zgoarch_armbe.go
+++ b/src/runtime/internal/sys/zgoarch_armbe.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_loong64.go b/src/runtime/internal/sys/zgoarch_loong64.go
new file mode 100644
index 0000000000..6f35eb44a3
--- /dev/null
+++ b/src/runtime/internal/sys/zgoarch_loong64.go
@@ -0,0 +1,33 @@
+// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+
+//go:build loong64
+// +build loong64
+
+package sys
+
+const GOARCH = `loong64`
+
+const Goarch386 = 0
+const GoarchAmd64 = 0
+const GoarchAmd64p32 = 0
+const GoarchArm = 0
+const GoarchArmbe = 0
+const GoarchArm64 = 0
+const GoarchArm64be = 0
+const GoarchPpc64 = 0
+const GoarchPpc64le = 0
+const GoarchLoong64 = 1
+const GoarchMips = 0
+const GoarchMipsle = 0
+const GoarchMips64 = 0
+const GoarchMips64le = 0
+const GoarchMips64p32 = 0
+const GoarchMips64p32le = 0
+const GoarchPpc = 0
+const GoarchRiscv = 0
+const GoarchRiscv64 = 0
+const GoarchS390 = 0
+const GoarchS390x = 0
+const GoarchSparc = 0
+const GoarchSparc64 = 0
+const GoarchWasm = 0
diff --git a/src/runtime/internal/sys/zgoarch_mips.go b/src/runtime/internal/sys/zgoarch_mips.go
index b5f4ed390c..bd58a92a0e 100644
--- a/src/runtime/internal/sys/zgoarch_mips.go
+++ b/src/runtime/internal/sys/zgoarch_mips.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 1
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_mips64.go b/src/runtime/internal/sys/zgoarch_mips64.go
index 73777cceb2..8e4a3dcd52 100644
--- a/src/runtime/internal/sys/zgoarch_mips64.go
+++ b/src/runtime/internal/sys/zgoarch_mips64.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 1
diff --git a/src/runtime/internal/sys/zgoarch_mips64le.go b/src/runtime/internal/sys/zgoarch_mips64le.go
index 0c81c36c09..d8e00339ea 100644
--- a/src/runtime/internal/sys/zgoarch_mips64le.go
+++ b/src/runtime/internal/sys/zgoarch_mips64le.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_mips64p32.go b/src/runtime/internal/sys/zgoarch_mips64p32.go
index d63ce27d24..8549cc0ba3 100644
--- a/src/runtime/internal/sys/zgoarch_mips64p32.go
+++ b/src/runtime/internal/sys/zgoarch_mips64p32.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_mips64p32le.go b/src/runtime/internal/sys/zgoarch_mips64p32le.go
index 2d577890b2..667b6fe514 100644
--- a/src/runtime/internal/sys/zgoarch_mips64p32le.go
+++ b/src/runtime/internal/sys/zgoarch_mips64p32le.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_mipsle.go b/src/runtime/internal/sys/zgoarch_mipsle.go
index 8af919d03a..8bedb2bb90 100644
--- a/src/runtime/internal/sys/zgoarch_mipsle.go
+++ b/src/runtime/internal/sys/zgoarch_mipsle.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 1
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_ppc.go b/src/runtime/internal/sys/zgoarch_ppc.go
index f6f12a5ddc..fe2196a327 100644
--- a/src/runtime/internal/sys/zgoarch_ppc.go
+++ b/src/runtime/internal/sys/zgoarch_ppc.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_ppc64.go b/src/runtime/internal/sys/zgoarch_ppc64.go
index a8379601f4..bd7cc43de3 100644
--- a/src/runtime/internal/sys/zgoarch_ppc64.go
+++ b/src/runtime/internal/sys/zgoarch_ppc64.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 1
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_ppc64le.go b/src/runtime/internal/sys/zgoarch_ppc64le.go
index f2ec5dcba7..e101892401 100644
--- a/src/runtime/internal/sys/zgoarch_ppc64le.go
+++ b/src/runtime/internal/sys/zgoarch_ppc64le.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 1
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_riscv.go b/src/runtime/internal/sys/zgoarch_riscv.go
index 83a3312f5f..559f86071a 100644
--- a/src/runtime/internal/sys/zgoarch_riscv.go
+++ b/src/runtime/internal/sys/zgoarch_riscv.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_riscv64.go b/src/runtime/internal/sys/zgoarch_riscv64.go
index 1dfcc84997..8485a94b3d 100644
--- a/src/runtime/internal/sys/zgoarch_riscv64.go
+++ b/src/runtime/internal/sys/zgoarch_riscv64.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_s390.go b/src/runtime/internal/sys/zgoarch_s390.go
index 91aba5a0f6..4c4569e376 100644
--- a/src/runtime/internal/sys/zgoarch_s390.go
+++ b/src/runtime/internal/sys/zgoarch_s390.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_s390x.go b/src/runtime/internal/sys/zgoarch_s390x.go
index edce50234e..e50d2edbb5 100644
--- a/src/runtime/internal/sys/zgoarch_s390x.go
+++ b/src/runtime/internal/sys/zgoarch_s390x.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_sparc.go b/src/runtime/internal/sys/zgoarch_sparc.go
index 5ae9560ab0..0d08752c7b 100644
--- a/src/runtime/internal/sys/zgoarch_sparc.go
+++ b/src/runtime/internal/sys/zgoarch_sparc.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_sparc64.go b/src/runtime/internal/sys/zgoarch_sparc64.go
index e2a0134aff..ba405bbf35 100644
--- a/src/runtime/internal/sys/zgoarch_sparc64.go
+++ b/src/runtime/internal/sys/zgoarch_sparc64.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
diff --git a/src/runtime/internal/sys/zgoarch_wasm.go b/src/runtime/internal/sys/zgoarch_wasm.go
index 52e85dea37..7c3e5afd1e 100644
--- a/src/runtime/internal/sys/zgoarch_wasm.go
+++ b/src/runtime/internal/sys/zgoarch_wasm.go
@@ -16,6 +16,7 @@ const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
+const GoarchLoong64 = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
--
cgit v1.2.3-54-g00ecf
From 21a04e33353316635b5f3351e807916f3bb1e844 Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor
Date: Wed, 14 Jul 2021 16:04:49 -0700
Subject: doc/go1.17: mention GOARCH=loong64
For #46229
Change-Id: I54d01d90f2b0c892d76121f1350c0e8cf4b2772f
Reviewed-on: https://go-review.googlesource.com/c/go/+/334729
Trust: Ian Lance Taylor
Reviewed-by: Dmitri Shuralyov
---
doc/go1.17.html | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/doc/go1.17.html b/doc/go1.17.html
index fa8f14de99..b31006fe65 100644
--- a/doc/go1.17.html
+++ b/doc/go1.17.html
@@ -119,6 +119,17 @@ Do not send CLs removing the interior tags from such phrases.
stack frame pointers only on Linux, macOS, and iOS.
+loong64 GOARCH value reserved
+
+
+ The main Go compiler does not yet support the LoongArch
+ architecture, but we've reserved the GOARCH
value
+ "loong64
".
+ This means that Go files named *_loong64.go
will now
+ be ignored by Go
+ tools except when that GOARCH value is being used.
+
+
Go command
--
cgit v1.2.3-54-g00ecf
From c1cc9f9c3d5ed789a080ef9f8dd9c11eca7e2026 Mon Sep 17 00:00:00 2001
From: Cuong Manh Le
Date: Thu, 15 Jul 2021 00:56:44 +0700
Subject: cmd/compile: fix lookup package of redeclared dot import symbol
The compiler is relying on Sym.Def field to lookup symbol package in
DotImportRefs map. But the Sym.Def field is clear whenever the compiler
finish processing a file. If the dot import happen in file A, then the
redeclaration happen in file B, then the symbol lookup in file B will
see a nil Sym.Def, that cause the compiler crashes.
To fix this, we can interate over DotImportRefs and check for matching
symbol name and return the corresponding package. Though this operation
can be slow, but it only happens in invalid program, when printing error
message, so it's not worth to optimize it further.
Fixes #47201
Change-Id: I4ca1cb0a8e7432b19cf71434592a4cbb58d54adf
Reviewed-on: https://go-review.googlesource.com/c/go/+/334589
Trust: Cuong Manh Le
Run-TryBot: Cuong Manh Le
TryBot-Result: Go Bot
Reviewed-by: Matthew Dempsky
---
src/cmd/compile/internal/typecheck/dcl.go | 12 +++++++++++-
test/fixedbugs/issue47201.dir/a.go | 13 +++++++++++++
test/fixedbugs/issue47201.dir/b.go | 9 +++++++++
test/fixedbugs/issue47201.go | 7 +++++++
4 files changed, 40 insertions(+), 1 deletion(-)
create mode 100644 test/fixedbugs/issue47201.dir/a.go
create mode 100644 test/fixedbugs/issue47201.dir/b.go
create mode 100644 test/fixedbugs/issue47201.go
diff --git a/src/cmd/compile/internal/typecheck/dcl.go b/src/cmd/compile/internal/typecheck/dcl.go
index f3058d8811..5b771e3c0b 100644
--- a/src/cmd/compile/internal/typecheck/dcl.go
+++ b/src/cmd/compile/internal/typecheck/dcl.go
@@ -106,7 +106,17 @@ func Export(n *ir.Name) {
// Redeclared emits a diagnostic about symbol s being redeclared at pos.
func Redeclared(pos src.XPos, s *types.Sym, where string) {
if !s.Lastlineno.IsKnown() {
- pkgName := DotImportRefs[s.Def.(*ir.Ident)]
+ var pkgName *ir.PkgName
+ if s.Def == nil {
+ for id, pkg := range DotImportRefs {
+ if id.Sym().Name == s.Name {
+ pkgName = pkg
+ break
+ }
+ }
+ } else {
+ pkgName = DotImportRefs[s.Def.(*ir.Ident)]
+ }
base.ErrorfAt(pos, "%v redeclared %s\n"+
"\t%v: previous declaration during import %q", s, where, base.FmtPos(pkgName.Pos()), pkgName.Pkg.Path)
} else {
diff --git a/test/fixedbugs/issue47201.dir/a.go b/test/fixedbugs/issue47201.dir/a.go
new file mode 100644
index 0000000000..54b7079092
--- /dev/null
+++ b/test/fixedbugs/issue47201.dir/a.go
@@ -0,0 +1,13 @@
+// Copyright 2021 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 (
+ . "fmt"
+)
+
+func test() {
+ Println("foo")
+}
diff --git a/test/fixedbugs/issue47201.dir/b.go b/test/fixedbugs/issue47201.dir/b.go
new file mode 100644
index 0000000000..5fd0635af2
--- /dev/null
+++ b/test/fixedbugs/issue47201.dir/b.go
@@ -0,0 +1,9 @@
+// Copyright 2021 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
+
+func Println() {} // ERROR "Println redeclared in this block"
+
+func main() {}
diff --git a/test/fixedbugs/issue47201.go b/test/fixedbugs/issue47201.go
new file mode 100644
index 0000000000..e3a470b419
--- /dev/null
+++ b/test/fixedbugs/issue47201.go
@@ -0,0 +1,7 @@
+// errorcheckdir
+
+// Copyright 2021 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 ignored
--
cgit v1.2.3-54-g00ecf
From 69728ead871f15cc1fd7e70b67e6768dd1100bae Mon Sep 17 00:00:00 2001
From: "Bryan C. Mills"
Date: Thu, 15 Jul 2021 14:48:45 -0400
Subject: cmd/go: update error messages in tests to match CL 332573
I neglected to run the 'longtest' builder, and the tests
that cover the error message changed in CL 332573 apparently
do not run in short mode.
Updates #36460
Updates #42661
Change-Id: I53500ddaca8ac9f0dfaab538923b3c9a4f71665e
Reviewed-on: https://go-review.googlesource.com/c/go/+/334889
Trust: Bryan C. Mills
Run-TryBot: Bryan C. Mills
Reviewed-by: Jay Conrod
TryBot-Result: Go Bot
---
src/cmd/go/testdata/script/mod_tidy_compat_ambiguous.txt | 2 +-
src/cmd/go/testdata/script/mod_tidy_compat_deleted.txt | 2 +-
src/cmd/go/testdata/script/mod_tidy_compat_implicit.txt | 2 +-
src/cmd/go/testdata/script/mod_tidy_compat_incompatible.txt | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/cmd/go/testdata/script/mod_tidy_compat_ambiguous.txt b/src/cmd/go/testdata/script/mod_tidy_compat_ambiguous.txt
index ed1dd53eff..c544cb7413 100644
--- a/src/cmd/go/testdata/script/mod_tidy_compat_ambiguous.txt
+++ b/src/cmd/go/testdata/script/mod_tidy_compat_ambiguous.txt
@@ -23,7 +23,7 @@ cp go.mod go.mod.orig
stderr '^example\.com/m imports\n\texample\.net/indirect imports\n\texample\.net/ambiguous/nested/pkg loaded from example\.net/ambiguous/nested@v0\.1\.0,\n\tbut go 1.16 would fail to locate it:\n\tambiguous import: found package example\.net/ambiguous/nested/pkg in multiple modules:\n\texample\.net/ambiguous v0.1.0 \(.*\)\n\texample\.net/ambiguous/nested v0.1.0 \(.*\)\n\n'
-stderr '\n\nTo proceed despite packages unresolved in go 1\.16:\n\tgo mod tidy -e\nIf reproducibility with go 1.16 is not needed:\n\tgo mod tidy -compat=1\.17\nFor other options, see:\n\thttps://golang\.org/wiki/PruningModules\n'
+stderr '\n\nTo proceed despite packages unresolved in go 1\.16:\n\tgo mod tidy -e\nIf reproducibility with go 1.16 is not needed:\n\tgo mod tidy -compat=1\.17\nFor other options, see:\n\thttps://golang\.org/doc/modules/pruning\n'
cmp go.mod go.mod.orig
diff --git a/src/cmd/go/testdata/script/mod_tidy_compat_deleted.txt b/src/cmd/go/testdata/script/mod_tidy_compat_deleted.txt
index 3aacde2025..dcf13e2049 100644
--- a/src/cmd/go/testdata/script/mod_tidy_compat_deleted.txt
+++ b/src/cmd/go/testdata/script/mod_tidy_compat_deleted.txt
@@ -19,7 +19,7 @@ cp go.mod go.mod.orig
stderr '^example\.com/m imports\n\texample\.net/deleted loaded from example\.net/deleted@v0\.1\.0,\n\tbut go 1\.16 would fail to locate it in example\.net/deleted@v0\.2\.0\n\n'
-stderr '\n\nTo upgrade to the versions selected by go 1.16, leaving some packages unresolved:\n\tgo mod tidy -e -go=1\.16 && go mod tidy -e -go=1\.17\nIf reproducibility with go 1.16 is not needed:\n\tgo mod tidy -compat=1\.17\nFor other options, see:\n\thttps://golang\.org/wiki/PruningModules\n'
+stderr '\n\nTo upgrade to the versions selected by go 1.16, leaving some packages unresolved:\n\tgo mod tidy -e -go=1\.16 && go mod tidy -e -go=1\.17\nIf reproducibility with go 1.16 is not needed:\n\tgo mod tidy -compat=1\.17\nFor other options, see:\n\thttps://golang\.org/doc/modules/pruning\n'
# The suggested 'go mod tidy -e' command should proceed anyway.
diff --git a/src/cmd/go/testdata/script/mod_tidy_compat_implicit.txt b/src/cmd/go/testdata/script/mod_tidy_compat_implicit.txt
index e00aea930e..186a3f8e67 100644
--- a/src/cmd/go/testdata/script/mod_tidy_compat_implicit.txt
+++ b/src/cmd/go/testdata/script/mod_tidy_compat_implicit.txt
@@ -33,7 +33,7 @@ env MODFMT='{{with .Module}}{{.Path}} {{.Version}}{{end}}'
cp go.mod go.mod.orig
! go mod tidy
stderr '^example\.com/m imports\n\texample\.net/lazy tested by\n\texample\.net/lazy.test imports\n\texample\.com/retract/incompatible loaded from example\.com/retract/incompatible@v1\.0\.0,\n\tbut go 1\.16 would select v2\.0\.0\+incompatible\n\n'
-stderr '\n\nTo upgrade to the versions selected by go 1\.16:\n\tgo mod tidy -go=1\.16 && go mod tidy -go=1\.17\nIf reproducibility with go 1.16 is not needed:\n\tgo mod tidy -compat=1.17\nFor other options, see:\n\thttps://golang\.org/wiki/PruningModules\n'
+stderr '\n\nTo upgrade to the versions selected by go 1\.16:\n\tgo mod tidy -go=1\.16 && go mod tidy -go=1\.17\nIf reproducibility with go 1.16 is not needed:\n\tgo mod tidy -compat=1.17\nFor other options, see:\n\thttps://golang\.org/doc/modules/pruning\n'
cmp go.mod go.mod.orig
diff --git a/src/cmd/go/testdata/script/mod_tidy_compat_incompatible.txt b/src/cmd/go/testdata/script/mod_tidy_compat_incompatible.txt
index 2d8726544a..ea9e42e87e 100644
--- a/src/cmd/go/testdata/script/mod_tidy_compat_incompatible.txt
+++ b/src/cmd/go/testdata/script/mod_tidy_compat_incompatible.txt
@@ -33,7 +33,7 @@ env MODFMT='{{with .Module}}{{.Path}} {{.Version}}{{end}}'
cp go.mod go.mod.orig
! go mod tidy
stderr '^example\.com/m imports\n\texample\.net/lazy imports\n\texample\.com/retract/incompatible loaded from example\.com/retract/incompatible@v1\.0\.0,\n\tbut go 1\.16 would select v2\.0\.0\+incompatible\n\n'
-stderr '\n\nTo upgrade to the versions selected by go 1\.16:\n\tgo mod tidy -go=1\.16 && go mod tidy -go=1\.17\nIf reproducibility with go 1\.16 is not needed:\n\tgo mod tidy -compat=1.17\nFor other options, see:\n\thttps://golang\.org/wiki/PruningModules\n'
+stderr '\n\nTo upgrade to the versions selected by go 1\.16:\n\tgo mod tidy -go=1\.16 && go mod tidy -go=1\.17\nIf reproducibility with go 1\.16 is not needed:\n\tgo mod tidy -compat=1.17\nFor other options, see:\n\thttps://golang\.org/doc/modules/pruning\n'
cmp go.mod go.mod.orig
--
cgit v1.2.3-54-g00ecf
From 0941dbca6ae805dd7b5f7871d5811b7b7f14f77f Mon Sep 17 00:00:00 2001
From: "Matt T. Proud"
Date: Wed, 14 Jul 2021 22:42:31 +0200
Subject: testing: clarify in docs that TestMain is advanced
Beginner and intermediate Go users periodically use TestMain when
requirements do not necessitate TestMain (exceeding least-mechanism
design). This commit expands package testing's documentation to convey
that the TestMain feature itself is somewhat low-level and potentially
unsuitable for casual testing where ordinary test functions would
suffice.
Fixes #42161
Updates #44200
Change-Id: I91ba0b048c3d6f79110fe8f0fbb58d896edca366
Reviewed-on: https://go-review.googlesource.com/c/go/+/334649
Trust: Ian Lance Taylor
Run-TryBot: Ian Lance Taylor
TryBot-Result: Go Bot
Reviewed-by: Rob Pike
---
src/testing/testing.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/testing/testing.go b/src/testing/testing.go
index eeee0aac17..681f99ef93 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -233,6 +233,8 @@
// os.Exit(m.Run())
// }
//
+// TestMain is a low-level primitive and should not be necessary for casual
+// testing needs, where ordinary test functions suffice.
package testing
import (
--
cgit v1.2.3-54-g00ecf
From aa4e0f528e1e018e2847decb549cfc5ac07ecf20 Mon Sep 17 00:00:00 2001
From: shota3506
Date: Tue, 13 Jul 2021 21:27:05 +0000
Subject: net/http: correct capitalization in cancelTimeBody comment
Change-Id: I7acda22c01c5350ebf5ddabb1c12af96d368de5d
GitHub-Last-Rev: 3e5c022f8764d4abf91c964ceb4fc0e01ebd1352
GitHub-Pull-Request: golang/go#47160
Reviewed-on: https://go-review.googlesource.com/c/go/+/334229
Reviewed-by: Ian Lance Taylor
Trust: Cherry Mui
Run-TryBot: Ian Lance Taylor
---
src/net/http/client.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/net/http/client.go b/src/net/http/client.go
index e0cabc9d4c..4d380c65db 100644
--- a/src/net/http/client.go
+++ b/src/net/http/client.go
@@ -951,7 +951,7 @@ func (c *Client) CloseIdleConnections() {
}
// cancelTimerBody is an io.ReadCloser that wraps rc with two features:
-// 1) on Read error or close, the stop func is called.
+// 1) On Read error or close, the stop func is called.
// 2) On Read failure, if reqDidTimeout is true, the error is wrapped and
// marked as net.Error that hit its timeout.
type cancelTimerBody struct {
--
cgit v1.2.3-54-g00ecf
From 650fc2117aaffbc4d596dc35cc88400ba11b2f25 Mon Sep 17 00:00:00 2001
From: mehradsadeghi <2012.linkinpark@gmail.com>
Date: Fri, 16 Jul 2021 21:25:28 +0000
Subject: text/scanner: use Go convention in Position doc comment
Change-Id: Ib872f139af7bfb0a75cc21dace5358fe8fcf2cf0
GitHub-Last-Rev: 8fd5ab01fab3bc1d7701092f31071d07ab79acc5
GitHub-Pull-Request: golang/go#47250
Reviewed-on: https://go-review.googlesource.com/c/go/+/335149
Reviewed-by: Robert Griesemer
Reviewed-by: Ian Lance Taylor
Trust: Robert Griesemer
---
src/text/scanner/scanner.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/text/scanner/scanner.go b/src/text/scanner/scanner.go
index e0847a7239..c5fc4ff93b 100644
--- a/src/text/scanner/scanner.go
+++ b/src/text/scanner/scanner.go
@@ -23,7 +23,7 @@ import (
"unicode/utf8"
)
-// A source position is represented by a Position value.
+// Position is a value that represents a source position.
// A position is valid if Line > 0.
type Position struct {
Filename string // filename, if any
--
cgit v1.2.3-54-g00ecf
From a66190eceeea63aab0b5410ae3222454e5e0cd96 Mon Sep 17 00:00:00 2001
From: nimelehin
Date: Fri, 16 Jul 2021 20:41:21 +0000
Subject: test/bench/go1: fix size for RegexpMatchMedium_32
Change-Id: Idc67abb95248bc010820a89dd6096a2da334e723
GitHub-Last-Rev: ae9014b011efb2692f853888c1860920d1acc3cb
GitHub-Pull-Request: golang/go#47254
Reviewed-on: https://go-review.googlesource.com/c/go/+/335189
Reviewed-by: Rob Pike
Run-TryBot: Rob Pike
TryBot-Result: Go Bot
Trust: Alberto Donizetti
---
test/bench/go1/regexp_test.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/bench/go1/regexp_test.go b/test/bench/go1/regexp_test.go
index 3ce9f3a2c6..dd1034fde5 100644
--- a/test/bench/go1/regexp_test.go
+++ b/test/bench/go1/regexp_test.go
@@ -53,7 +53,7 @@ func BenchmarkRegexpMatchEasy0_32(b *testing.B) { benchmark(b, easy0, 32<<0) }
func BenchmarkRegexpMatchEasy0_1K(b *testing.B) { benchmark(b, easy0, 1<<10) }
func BenchmarkRegexpMatchEasy1_32(b *testing.B) { benchmark(b, easy1, 32<<0) }
func BenchmarkRegexpMatchEasy1_1K(b *testing.B) { benchmark(b, easy1, 1<<10) }
-func BenchmarkRegexpMatchMedium_32(b *testing.B) { benchmark(b, medium, 1<<0) }
+func BenchmarkRegexpMatchMedium_32(b *testing.B) { benchmark(b, medium, 32<<0) }
func BenchmarkRegexpMatchMedium_1K(b *testing.B) { benchmark(b, medium, 1<<10) }
func BenchmarkRegexpMatchHard_32(b *testing.B) { benchmark(b, hard, 32<<0) }
func BenchmarkRegexpMatchHard_1K(b *testing.B) { benchmark(b, hard, 1<<10) }
--
cgit v1.2.3-54-g00ecf
From 49402bee36fd3d5cee9f4b2d2e1e8560ead0203b Mon Sep 17 00:00:00 2001
From: Than McIntosh
Date: Thu, 15 Jul 2021 16:29:36 -0400
Subject: cmd/{compile,link}: fix bug in map.zero handling
In CL 326211 a change was made to switch "go.map.zero" symbols from
non-pkg DUPOK symbols to hashed symbols. The intent of this change was
ensure that in cases where there are multiple competing go.map.zero
symbols feeding into a link, the largest map.zero symbol is selected.
The change was buggy, however, and resulted in duplicate symbols in
the final binary (see bug cited below for details). This duplication
was relatively benign for linux/ELF, but causes duplicate definition
errors on Windows.
This patch switches "go.map.zero" symbols back from hashed symbols to
non-pkg DUPOK symbols, and updates the relevant code in the loader to
ensure that we do the right thing when there are multiple competing
DUPOK symbols with different sizes.
Fixes #47185.
Change-Id: I8aeb910c65827f5380144d07646006ba553c9251
Reviewed-on: https://go-review.googlesource.com/c/go/+/334930
Trust: Than McIntosh
Run-TryBot: Than McIntosh
TryBot-Result: Go Bot
Reviewed-by: Cherry Mui
---
src/cmd/compile/internal/gc/obj.go | 2 +-
src/cmd/link/internal/loader/loader.go | 9 ++++
test/fixedbugs/issue47185.dir/bad/bad.go | 72 ++++++++++++++++++++++++++++++++
test/fixedbugs/issue47185.dir/main.go | 28 +++++++++++++
test/fixedbugs/issue47185.go | 11 +++++
5 files changed, 121 insertions(+), 1 deletion(-)
create mode 100644 test/fixedbugs/issue47185.dir/bad/bad.go
create mode 100644 test/fixedbugs/issue47185.dir/main.go
create mode 100644 test/fixedbugs/issue47185.go
diff --git a/src/cmd/compile/internal/gc/obj.go b/src/cmd/compile/internal/gc/obj.go
index 55a0ab7da7..474d718525 100644
--- a/src/cmd/compile/internal/gc/obj.go
+++ b/src/cmd/compile/internal/gc/obj.go
@@ -148,7 +148,7 @@ func dumpdata() {
if reflectdata.ZeroSize > 0 {
zero := base.PkgLinksym("go.map", "zero", obj.ABI0)
objw.Global(zero, int32(reflectdata.ZeroSize), obj.DUPOK|obj.RODATA)
- zero.Set(obj.AttrContentAddressable, true)
+ zero.Set(obj.AttrStatic, true)
}
staticdata.WriteFuncSyms()
diff --git a/src/cmd/link/internal/loader/loader.go b/src/cmd/link/internal/loader/loader.go
index efca824d98..9d5319c312 100644
--- a/src/cmd/link/internal/loader/loader.go
+++ b/src/cmd/link/internal/loader/loader.go
@@ -459,6 +459,15 @@ func (st *loadState) addSym(name string, ver int, r *oReader, li uint32, kind in
if l.flags&FlagStrictDups != 0 {
l.checkdup(name, r, li, oldi)
}
+ // Fix for issue #47185 -- given two dupok symbols with
+ // different sizes, favor symbol with larger size. See
+ // also issue #46653.
+ szdup := l.SymSize(oldi)
+ sz := int64(r.Sym(li).Siz())
+ if szdup < sz {
+ // new symbol overwrites old symbol.
+ l.objSyms[oldi] = objSym{r.objidx, li}
+ }
return oldi
}
oldr, oldli := l.toLocal(oldi)
diff --git a/test/fixedbugs/issue47185.dir/bad/bad.go b/test/fixedbugs/issue47185.dir/bad/bad.go
new file mode 100644
index 0000000000..1aa4fbb909
--- /dev/null
+++ b/test/fixedbugs/issue47185.dir/bad/bad.go
@@ -0,0 +1,72 @@
+// Copyright 2021 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 a
+
+// Note that the use of CGO here is solely to trigger external
+// linking, since that is required to trigger that bad behavior
+// in this bug.
+
+// #include
+import "C"
+
+func Bad() {
+ m := make(map[int64]A)
+ a := m[0]
+ if len(a.B.C1.D2.E2.F1) != 0 ||
+ len(a.B.C1.D2.E2.F2) != 0 ||
+ len(a.B.C1.D2.E2.F3) != 0 ||
+ len(a.B.C1.D2.E2.F4) != 0 ||
+ len(a.B.C1.D2.E2.F5) != 0 ||
+ len(a.B.C1.D2.E2.F6) != 0 ||
+ len(a.B.C1.D2.E2.F7) != 0 ||
+ len(a.B.C1.D2.E2.F8) != 0 ||
+ len(a.B.C1.D2.E2.F9) != 0 ||
+ len(a.B.C1.D2.E2.F10) != 0 ||
+ len(a.B.C1.D2.E2.F11) != 0 ||
+ len(a.B.C1.D2.E2.F16) != 0 {
+ panic("bad")
+ }
+ C.malloc(100)
+}
+
+type A struct {
+ B
+}
+
+type B struct {
+ C1 C
+ C2 C
+}
+
+type C struct {
+ D1 D
+ D2 D
+}
+
+type D struct {
+ E1 E
+ E2 E
+ E3 E
+ E4 E
+}
+
+type E struct {
+ F1 string
+ F2 string
+ F3 string
+ F4 string
+ F5 string
+ F6 string
+ F7 string
+ F8 string
+ F9 string
+ F10 string
+ F11 string
+ F12 string
+ F13 string
+ F14 string
+ F15 string
+ F16 string
+}
diff --git a/test/fixedbugs/issue47185.dir/main.go b/test/fixedbugs/issue47185.dir/main.go
new file mode 100644
index 0000000000..7b46e55d8b
--- /dev/null
+++ b/test/fixedbugs/issue47185.dir/main.go
@@ -0,0 +1,28 @@
+// Copyright 2021 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 (
+ bad "issue47185.dir/bad"
+)
+
+func main() {
+ another()
+ bad.Bad()
+}
+
+func another() L {
+ m := make(map[string]L)
+ return m[""]
+}
+
+type L struct {
+ A Data
+ B Data
+}
+
+type Data struct {
+ F1 [22][]string
+}
diff --git a/test/fixedbugs/issue47185.go b/test/fixedbugs/issue47185.go
new file mode 100644
index 0000000000..9c921b8698
--- /dev/null
+++ b/test/fixedbugs/issue47185.go
@@ -0,0 +1,11 @@
+// +build cgo
+// runindir
+
+// Copyright 2021 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.
+
+// Another test to verify compiler and linker handling of multiple
+// competing map.zero symbol definitions.
+
+package ignored
--
cgit v1.2.3-54-g00ecf
From 6298cfe6724e3ca24dedd3f62b2b358aafe17276 Mon Sep 17 00:00:00 2001
From: Leonard Wang
Date: Sun, 11 Jul 2021 11:46:26 +0800
Subject: cmd/compile: fix typo in fatal message of builtinCall
Change-Id: I523d5fd810b82154a204670d46fc250a0fc66791
Reviewed-on: https://go-review.googlesource.com/c/go/+/333849
Reviewed-by: Ian Lance Taylor
Reviewed-by: Matthew Dempsky
Run-TryBot: Ian Lance Taylor
TryBot-Result: Go Bot
---
src/cmd/compile/internal/typecheck/iimport.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cmd/compile/internal/typecheck/iimport.go b/src/cmd/compile/internal/typecheck/iimport.go
index a5ddbb5a74..37f5a7bba0 100644
--- a/src/cmd/compile/internal/typecheck/iimport.go
+++ b/src/cmd/compile/internal/typecheck/iimport.go
@@ -1540,7 +1540,7 @@ func (r *importReader) exprsOrNil() (a, b ir.Node) {
func builtinCall(pos src.XPos, op ir.Op) *ir.CallExpr {
if go117ExportTypes {
// These should all be encoded as direct ops, not OCALL.
- base.Fatalf("builtinCall should not be invoked when types are included in inport/export")
+ base.Fatalf("builtinCall should not be invoked when types are included in import/export")
}
return ir.NewCallExpr(pos, ir.OCALL, ir.NewIdent(base.Pos, types.BuiltinPkg.Lookup(ir.OpNames[op])), nil)
}
--
cgit v1.2.3-54-g00ecf
From 404127c30f3f66eb234da2dc1a78e6eea0ef4ee0 Mon Sep 17 00:00:00 2001
From: Cherry Mui
Date: Wed, 14 Jul 2021 18:52:44 -0400
Subject: cmd/compile: fix off-by-one error in traceback argument counting
For traceback argument printing, we want to print at most 10
words, then print "..." if there are still more args and/or
fields. The current code has off-by-one error that for 11
non-aggregate typed args, it prints the first 10 but without the
"...". Also, for aggregate-typed args, in some cases it may print
an extra "..." when there is actually no more fields.
The problem for this is that visitType return false (meaning not
to continue visiting) if it reaches the limit anywhere during the
recursive visit. It doesn't distinguish whether it has printed
anything for the current arg. If it reaches the limit before it
prints anything, it means that we're visiting the extra arg/field,
so the caller should print "..." and stop. If it prints
something then reaches the limit, however, the caller should keep
going, and only print "..." at the next iteration when there is
actually an extra arg/field. This CL does so.
Fixes #47159.
Change-Id: I93fc25b73ada2b5a98df780c45e5b0c9565dc2fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/334710
Trust: Cherry Mui
Run-TryBot: Cherry Mui
TryBot-Result: Go Bot
Reviewed-by: Michael Knyszek
---
src/cmd/compile/internal/ssagen/ssa.go | 43 +++-----
src/runtime/traceback_test.go | 179 ++++++++++++++++++++++++++++++++-
2 files changed, 190 insertions(+), 32 deletions(-)
diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go
index f1dc56e729..a5cb0857b3 100644
--- a/src/cmd/compile/internal/ssagen/ssa.go
+++ b/src/cmd/compile/internal/ssagen/ssa.go
@@ -6598,6 +6598,7 @@ func EmitArgInfo(f *ir.Func, abiInfo *abi.ABIParamResultInfo) *obj.LSym {
x := base.Ctxt.Lookup(fmt.Sprintf("%s.arginfo%d", f.LSym.Name, f.ABI))
PtrSize := int64(types.PtrSize)
+ uintptrTyp := types.Types[types.TUINTPTR]
isAggregate := func(t *types.Type) bool {
return t.IsStruct() || t.IsArray() || t.IsComplex() || t.IsInterface() || t.IsString() || t.IsSlice()
@@ -6641,12 +6642,8 @@ func EmitArgInfo(f *ir.Func, abiInfo *abi.ABIParamResultInfo) *obj.LSym {
n := 0
writebyte := func(o uint8) { wOff = objw.Uint8(x, wOff, o) }
- // Write one non-aggrgate arg/field/element if there is room.
- // Returns whether to continue.
- write1 := func(sz, offset int64) bool {
- if n >= limit {
- return false
- }
+ // Write one non-aggrgate arg/field/element.
+ write1 := func(sz, offset int64) {
if offset >= _special {
writebyte(_offsetTooLarge)
} else {
@@ -6654,7 +6651,6 @@ func EmitArgInfo(f *ir.Func, abiInfo *abi.ABIParamResultInfo) *obj.LSym {
writebyte(uint8(sz))
}
n++
- return true
}
// Visit t recursively and write it out.
@@ -6662,10 +6658,12 @@ func EmitArgInfo(f *ir.Func, abiInfo *abi.ABIParamResultInfo) *obj.LSym {
var visitType func(baseOffset int64, t *types.Type, depth int) bool
visitType = func(baseOffset int64, t *types.Type, depth int) bool {
if n >= limit {
+ writebyte(_dotdotdot)
return false
}
if !isAggregate(t) {
- return write1(t.Size(), baseOffset)
+ write1(t.Size(), baseOffset)
+ return true
}
writebyte(_startAgg)
depth++
@@ -6675,58 +6673,47 @@ func EmitArgInfo(f *ir.Func, abiInfo *abi.ABIParamResultInfo) *obj.LSym {
n++
return true
}
- var r bool
switch {
case t.IsInterface(), t.IsString():
- r = write1(PtrSize, baseOffset) &&
- write1(PtrSize, baseOffset+PtrSize)
+ _ = visitType(baseOffset, uintptrTyp, depth) &&
+ visitType(baseOffset+PtrSize, uintptrTyp, depth)
case t.IsSlice():
- r = write1(PtrSize, baseOffset) &&
- write1(PtrSize, baseOffset+PtrSize) &&
- write1(PtrSize, baseOffset+PtrSize*2)
+ _ = visitType(baseOffset, uintptrTyp, depth) &&
+ visitType(baseOffset+PtrSize, uintptrTyp, depth) &&
+ visitType(baseOffset+PtrSize*2, uintptrTyp, depth)
case t.IsComplex():
- r = write1(t.Size()/2, baseOffset) &&
- write1(t.Size()/2, baseOffset+t.Size()/2)
+ _ = visitType(baseOffset, types.FloatForComplex(t), depth) &&
+ visitType(baseOffset+t.Size()/2, types.FloatForComplex(t), depth)
case t.IsArray():
- r = true
if t.NumElem() == 0 {
n++ // {} counts as a component
break
}
for i := int64(0); i < t.NumElem(); i++ {
if !visitType(baseOffset, t.Elem(), depth) {
- r = false
break
}
baseOffset += t.Elem().Size()
}
case t.IsStruct():
- r = true
if t.NumFields() == 0 {
n++ // {} counts as a component
break
}
for _, field := range t.Fields().Slice() {
if !visitType(baseOffset+field.Offset, field.Type, depth) {
- r = false
break
}
}
}
- if !r {
- writebyte(_dotdotdot)
- }
writebyte(_endAgg)
- return r
+ return true
}
- c := true
for _, a := range abiInfo.InParams() {
- if !c {
- writebyte(_dotdotdot)
+ if !visitType(a.FrameOffset(abiInfo), a.Type, 0) {
break
}
- c = visitType(a.FrameOffset(abiInfo), a.Type, 0)
}
writebyte(_endSeq)
if wOff > maxLen {
diff --git a/src/runtime/traceback_test.go b/src/runtime/traceback_test.go
index 2a0497e9a9..83b86a7e90 100644
--- a/src/runtime/traceback_test.go
+++ b/src/runtime/traceback_test.go
@@ -19,8 +19,8 @@ func TestTracebackArgs(t *testing.T) {
}{
// simple ints
{
- func() int { return testTracebackArgs1(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) },
- "testTracebackArgs1(0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, ...)",
+ func() int { return testTracebackArgs1(1, 2, 3, 4, 5) },
+ "testTracebackArgs1(0x1, 0x2, 0x3, 0x4, 0x5)",
},
// some aggregates
{
@@ -53,6 +53,58 @@ func TestTracebackArgs(t *testing.T) {
},
"testTracebackArgs5(0x0, {0x1, {}, {{}, {}}}, {}, {}, {}, {}, {}, ...)",
},
+
+ // edge cases for ...
+ // no ... for 10 args
+ {
+ func() int { return testTracebackArgs6a(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) },
+ "testTracebackArgs6a(0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa)",
+ },
+ // has ... for 11 args
+ {
+ func() int { return testTracebackArgs6b(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) },
+ "testTracebackArgs6b(0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, ...)",
+ },
+ // no ... for aggregates with 10 words
+ {
+ func() int { return testTracebackArgs7a([10]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}) },
+ "testTracebackArgs7a({0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa})",
+ },
+ // has ... for aggregates with 11 words
+ {
+ func() int { return testTracebackArgs7b([11]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}) },
+ "testTracebackArgs7b({0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, ...})",
+ },
+ // no ... for aggregates, but with more args
+ {
+ func() int { return testTracebackArgs7c([10]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, 11) },
+ "testTracebackArgs7c({0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa}, ...)",
+ },
+ // has ... for aggregates and also for more args
+ {
+ func() int { return testTracebackArgs7d([11]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 12) },
+ "testTracebackArgs7d({0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, ...}, ...)",
+ },
+ // nested aggregates, no ...
+ {
+ func() int { return testTracebackArgs8a(testArgsType8a{1, 2, 3, 4, 5, 6, 7, 8, [2]int{9, 10}}) },
+ "testTracebackArgs8a({0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, {0x9, 0xa}})",
+ },
+ // nested aggregates, ... in inner but not outer
+ {
+ func() int { return testTracebackArgs8b(testArgsType8b{1, 2, 3, 4, 5, 6, 7, 8, [3]int{9, 10, 11}}) },
+ "testTracebackArgs8b({0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, {0x9, 0xa, ...}})",
+ },
+ // nested aggregates, ... in outer but not inner
+ {
+ func() int { return testTracebackArgs8c(testArgsType8c{1, 2, 3, 4, 5, 6, 7, 8, [2]int{9, 10}, 11}) },
+ "testTracebackArgs8c({0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, {0x9, 0xa}, ...})",
+ },
+ // nested aggregates, ... in both inner and outer
+ {
+ func() int { return testTracebackArgs8d(testArgsType8d{1, 2, 3, 4, 5, 6, 7, 8, [3]int{9, 10, 11}, 12}) },
+ "testTracebackArgs8d({0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, {0x9, 0xa, ...}, ...})",
+ },
}
for _, test := range tests {
n := test.fn()
@@ -64,11 +116,11 @@ func TestTracebackArgs(t *testing.T) {
}
//go:noinline
-func testTracebackArgs1(a, b, c, d, e, f, g, h, i, j, k, l int) int {
+func testTracebackArgs1(a, b, c, d, e int) int {
n := runtime.Stack(testTracebackArgsBuf[:], false)
if a < 0 {
// use in-reg args to keep them alive
- return a + b + c + d + e + f + g + h + i + j + k + l
+ return a + b + c + d + e
}
return n
}
@@ -119,3 +171,122 @@ func testTracebackArgs5(a bool, x struct {
}
return n
}
+
+//go:noinline
+func testTracebackArgs6a(a, b, c, d, e, f, g, h, i, j int) int {
+ n := runtime.Stack(testTracebackArgsBuf[:], false)
+ if a < 0 {
+ // use in-reg args to keep them alive
+ return a + b + c + d + e + f + g + h + i + j
+ }
+ return n
+}
+
+//go:noinline
+func testTracebackArgs6b(a, b, c, d, e, f, g, h, i, j, k int) int {
+ n := runtime.Stack(testTracebackArgsBuf[:], false)
+ if a < 0 {
+ // use in-reg args to keep them alive
+ return a + b + c + d + e + f + g + h + i + j + k
+ }
+ return n
+}
+
+//go:noinline
+func testTracebackArgs7a(a [10]int) int {
+ n := runtime.Stack(testTracebackArgsBuf[:], false)
+ if a[0] < 0 {
+ // use in-reg args to keep them alive
+ return a[1] + a[2] + a[3] + a[4] + a[5] + a[6] + a[7] + a[8] + a[9]
+ }
+ return n
+}
+
+//go:noinline
+func testTracebackArgs7b(a [11]int) int {
+ n := runtime.Stack(testTracebackArgsBuf[:], false)
+ if a[0] < 0 {
+ // use in-reg args to keep them alive
+ return a[1] + a[2] + a[3] + a[4] + a[5] + a[6] + a[7] + a[8] + a[9] + a[10]
+ }
+ return n
+}
+
+//go:noinline
+func testTracebackArgs7c(a [10]int, b int) int {
+ n := runtime.Stack(testTracebackArgsBuf[:], false)
+ if a[0] < 0 {
+ // use in-reg args to keep them alive
+ return a[1] + a[2] + a[3] + a[4] + a[5] + a[6] + a[7] + a[8] + a[9] + b
+ }
+ return n
+}
+
+//go:noinline
+func testTracebackArgs7d(a [11]int, b int) int {
+ n := runtime.Stack(testTracebackArgsBuf[:], false)
+ if a[0] < 0 {
+ // use in-reg args to keep them alive
+ return a[1] + a[2] + a[3] + a[4] + a[5] + a[6] + a[7] + a[8] + a[9] + a[10] + b
+ }
+ return n
+}
+
+type testArgsType8a struct {
+ a, b, c, d, e, f, g, h int
+ i [2]int
+}
+type testArgsType8b struct {
+ a, b, c, d, e, f, g, h int
+ i [3]int
+}
+type testArgsType8c struct {
+ a, b, c, d, e, f, g, h int
+ i [2]int
+ j int
+}
+type testArgsType8d struct {
+ a, b, c, d, e, f, g, h int
+ i [3]int
+ j int
+}
+
+//go:noinline
+func testTracebackArgs8a(a testArgsType8a) int {
+ n := runtime.Stack(testTracebackArgsBuf[:], false)
+ if a.a < 0 {
+ // use in-reg args to keep them alive
+ return a.b + a.c + a.d + a.e + a.f + a.g + a.h + a.i[0] + a.i[1]
+ }
+ return n
+}
+
+//go:noinline
+func testTracebackArgs8b(a testArgsType8b) int {
+ n := runtime.Stack(testTracebackArgsBuf[:], false)
+ if a.a < 0 {
+ // use in-reg args to keep them alive
+ return a.b + a.c + a.d + a.e + a.f + a.g + a.h + a.i[0] + a.i[1] + a.i[2]
+ }
+ return n
+}
+
+//go:noinline
+func testTracebackArgs8c(a testArgsType8c) int {
+ n := runtime.Stack(testTracebackArgsBuf[:], false)
+ if a.a < 0 {
+ // use in-reg args to keep them alive
+ return a.b + a.c + a.d + a.e + a.f + a.g + a.h + a.i[0] + a.i[1] + a.j
+ }
+ return n
+}
+
+//go:noinline
+func testTracebackArgs8d(a testArgsType8d) int {
+ n := runtime.Stack(testTracebackArgsBuf[:], false)
+ if a.a < 0 {
+ // use in-reg args to keep them alive
+ return a.b + a.c + a.d + a.e + a.f + a.g + a.h + a.i[0] + a.i[1] + a.i[2] + a.j
+ }
+ return n
+}
--
cgit v1.2.3-54-g00ecf
From 1d91551b7326383343c7c143a8ac299d0a685289 Mon Sep 17 00:00:00 2001
From: helloPiers
Date: Mon, 19 Jul 2021 20:08:50 +0000
Subject: time: correct typo in documentation for UnixMicro
Fixes #47283.
Change-Id: Ibdc35433d22be3caa70197b6a95c66999812a16a
GitHub-Last-Rev: 75962b029467a5e26e1ee78a38bf01c954445ea1
GitHub-Pull-Request: golang/go#47284
Reviewed-on: https://go-review.googlesource.com/c/go/+/335549
Reviewed-by: Ian Lance Taylor
Trust: Than McIntosh
---
src/time/time.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/time/time.go b/src/time/time.go
index 1cf1e2bbf6..4ecc3d82dc 100644
--- a/src/time/time.go
+++ b/src/time/time.go
@@ -1334,7 +1334,7 @@ func UnixMilli(msec int64) Time {
}
// UnixMicro returns the local Time corresponding to the given Unix time,
-// usec milliseconds since January 1, 1970 UTC.
+// usec microseconds since January 1, 1970 UTC.
func UnixMicro(usec int64) Time {
return Unix(usec/1e6, (usec%1e6)*1e3)
}
--
cgit v1.2.3-54-g00ecf
From c8f4e6152d5f0b767a8177b7d09884cf2279d8e6 Mon Sep 17 00:00:00 2001
From: Piers
Date: Mon, 19 Jul 2021 20:11:29 +0000
Subject: spec: correct example comment in Conversions from slice to array
Fixes #47280
Change-Id: I78a8d235949b4878c7f075ac4ca37700e7e6c31c
GitHub-Last-Rev: 067f96eeb2c918eb4f775c428edc945c75af44d8
GitHub-Pull-Request: golang/go#47282
Reviewed-on: https://go-review.googlesource.com/c/go/+/335470
Reviewed-by: Robert Griesemer
Trust: Robert Griesemer
Trust: Than McIntosh
---
doc/go_spec.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/go_spec.html b/doc/go_spec.html
index ad21ffb1b8..df256f0f0e 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -4334,7 +4334,7 @@ s4 := (*[4]byte)(s) // panics: len([4]byte) > len(s)
var t []string
t0 := (*[0]string)(t) // t0 == nil
-t1 := (*[1]string)(t) // panics: len([1]string) > len(s)
+t1 := (*[1]string)(t) // panics: len([1]string) > len(t)
Constant expressions
--
cgit v1.2.3-54-g00ecf