1
0
mirror of https://github.com/golang/go synced 2024-09-30 04:24:29 -06:00
Commit Graph

45849 Commits

Author SHA1 Message Date
Russ Cox
e65c543f3c go/build/constraint: add parser for build tag constraint expressions
This package implements a parser for the new //go:build constraint lines.
The parser also handles // +build lines, to be able to process legacy files.

This will not be used in the standard library until Go 1.17,
but it seems worth publishing in Go 1.16 so that code that
needs to process both kinds of lines once Go 1.17 comes out
will be able to build using Go 1.16 as well.

For #41184. Design in https://golang.org/design/draft-gobuild.

Change-Id: I756c0de4081c5039e8b7397200e5274f223ab111
Reviewed-on: https://go-review.googlesource.com/c/go/+/240604
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Russ Cox <rsc@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-01-08 17:08:44 +00:00
Austin Clements
0c5afc4fb7 testing/fstest,os: clarify racy behavior of TestFS
The testing.TestFS function assumes that the file system it's testing
doesn't change under it. Clarify this in the documentation and fix the
use of os.TestDirFS that's currently susceptible to this race.

Fixes #42637.

Change-Id: Ia7792380726177f8953d150ee87381b66cb01cb3
Reviewed-on: https://go-review.googlesource.com/c/go/+/282452
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-01-08 16:34:00 +00:00
Michael Anthony Knyszek
32afcc9436 runtime/metrics: change unit on *-by-size metrics to match bucket unit
This change modifies the *-by-size metrics' units to be based off the
bucket's unit (bytes) as opposed to the unit of the counts (objects).
This convention is more in-line with distributions in other metrics
systems.

Change-Id: Id3b68a09f52f0e1ff9f4346f613ae1cbd9f52f73
Reviewed-on: https://go-review.googlesource.com/c/go/+/282352
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
2021-01-08 16:28:15 +00:00
Ian Lance Taylor
c6513bca5a io/fs: minor corrections to Glob doc
The documentation for Glob was copied from filepath.Glob, and needs a bit
of tweaking: paths are not rooted at slash; the separator is always '/'.

Fixes #43537

Change-Id: Id64daa137e2762b66a82a5b9e60bbe603f4e2f5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/282173
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-01-08 15:41:36 +00:00
Keith Randall
304f769ffc cmd/compile: don't short-circuit copies whose source is volatile
Current optimization: When we copy a->b and then b->c, we might as well
copy a->c instead of b->c (then b might be dead and go away).

*Except* if a is a volatile location (might be clobbered by a call).
In that case, we really do want to copy a immediately, because there
might be a call before we can do the a->c copy.

User calls can't happen in between, because the rule matches up the
memory states. But calls inserted for memory barriers, particularly
runtime.typedmemmove, can.

(I guess we could introduce a register-calling-convention version
of runtime.typedmemmove, but that seems a bigger change than this one.)

Fixes #43570

Change-Id: Ifa518bb1a6f3a8dd46c352d4fd54ea9713b3eb1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/282492
Trust: Keith Randall <khr@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2021-01-08 05:00:06 +00:00
Michael Anthony Knyszek
ae97717133 runtime,runtime/metrics: use explicit histogram boundaries
This change modifies the semantics of
runtime/metrics.Float64Histogram.Buckets to remove implicit buckets to
that extend to positive and negative infinity and instead defines all
bucket boundaries as explicitly listed.

Bucket boundaries remain the same as before except
/gc/heap/allocs-by-size:objects and /gc/heap/frees-by-size:objects no
longer have a bucket that extends to negative infinity.

This change simplifies the Float64Histogram API, making it both easier
to understand and easier to use.

Also, add a test for allocs-by-size and frees-by-size that checks them
against MemStats.

Fixes #43443.

Change-Id: I5620f15bd084562dadf288f733c4a8cace21910c
Reviewed-on: https://go-review.googlesource.com/c/go/+/281238
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Trust: Michael Knyszek <mknyszek@google.com>
2021-01-08 03:43:44 +00:00
Meng Zhuo
a9ccd2d795 go/build: skip string literal while findEmbed
The findEmbed function looking for comment by readbyte,
however it might have constant or variables that contains
comment.
Maybe we should use ast parser in the future.

Fixes #43373

Change-Id: I92544384fc4c11363d8b2f6b9898c8dea1602767
Reviewed-on: https://go-review.googlesource.com/c/go/+/280332
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-01-08 02:18:40 +00:00
yangwenmai
d92f8add32 archive/tar: fix typo in comment
Change-Id: Ifcc565b34b3c3bb7ee62bb0525648a5d2895bf0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/282013
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
2021-01-08 02:03:24 +00:00
Ian Lance Taylor
cab1202183 cmd/link: accept extra blocks in TestFallocate
For #41127

Change-Id: I794a082299c6dce4202223197ece1864bed36810
Reviewed-on: https://go-review.googlesource.com/c/go/+/282555
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2021-01-08 01:58:34 +00:00
Meng Zhuo
ee4d32249b io/fs: minor corrections to Glob release date
io/fs is introduced in 2020, not 2009 nor 2010

Change-Id: I7d63aae17b1f8c3af1ded2f639e3fb76ff2aea81
Reviewed-on: https://go-review.googlesource.com/c/go/+/282232
Trust: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-01-08 01:48:01 +00:00
Ian Lance Taylor
54bd1ccce2 cmd: update to latest golang.org/x/tools
In particular bring in CL 201973, which reverts support for multiple
keys in a struct tag.

For #40281
For #43083
For #43226

Change-Id: I66e76639cbbca55bdbff6956acdb0a97650fdd31
Reviewed-on: https://go-review.googlesource.com/c/go/+/282412
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-01-08 01:33:44 +00:00
Ian Lance Taylor
9ec21a8f34 Revert "reflect: support multiple keys in struct tags"
Proposal #40281 was initially accepted, but has now been declined.
This CL removes most of the work done to implement it.

Specifically this reverts CLs 248341, 274448, 274474, and 278392.

For #40281
For #43226

Change-Id: I5a9ebb4d9cb5fb0962434b64c59beb8343030be5
Reviewed-on: https://go-review.googlesource.com/c/go/+/281515
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-01-07 23:43:25 +00:00
Ian Lance Taylor
091414b5b7 io/fs: correct WalkDirFunc documentation
The documentation was copied from filepath.WalkFunc, and the copy was
not fully adjusted to the new circumstances.

Fixes #43536

Change-Id: I09687c7656e6938ebd9fc1e1643d34be88cf141d
Reviewed-on: https://go-review.googlesource.com/c/go/+/282172
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Marco Gazerro <gazerro@open2b.com>
2021-01-07 23:38:51 +00:00
Michael Matloob
9b55088d6b doc/go1.16: add release note for disallowing non-ASCII import paths
golang.org/cl/251878 disallowed non-ASCII characters in import paths,
in module mode. They were already disallowed in module paths, so this
change just extended the restriction to the package subdirectory of
the module. Update the release notes to alert users of this change.

Fixes #43052

Change-Id: I1caf9ef978dd3ac599a3f82c5c376ad62e6fc436
Reviewed-on: https://go-review.googlesource.com/c/go/+/282194
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-01-07 22:28:57 +00:00
Cuong Manh Le
fa90aaca7d cmd/compile: fix late expand_calls leaf type for OpStructSelect/OpArraySelect
For the example in #43551, before late call expansion, the OpArg type is
decomposed to int64. But the late call expansion is currently decompose
it to "x.Key" instead.

This CL make expand_calls decompose further for struct { 1-field type }
and array [1]elem.

This matches the previous rules for early decompose args:

(StructSelect (StructMake1 x)) => x
(ArraySelect (ArrayMake1 x)) => x

Fixes #43551

Change-Id: I2f1ebe18cb81cb967f494331c3d237535d2859e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/282332
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2021-01-07 19:31:03 +00:00
Michael Matloob
7cee66d4cb cmd/go: add documentation for Embed fields in go list output
This change the struct fields for EmbedPatterns and EmbedFiles
to the Package struct listed in the go list documentation that
specifies the fields available to the go list template.

Fixes #43081

Change-Id: I89c325a9d6292a6ce484ee588b172d2f84e2333a
Reviewed-on: https://go-review.googlesource.com/c/go/+/282195
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-01-07 18:56:09 +00:00
Ian Lance Taylor
e60cffa4ca html/template: attach functions to namespace
The text/template functions are stored in a data structure shared by
all related templates, so do the same with the original, unwrapped,
functions on the html/template side.

For #39807
Fixes #43295

Change-Id: I9f64a0a601f1151c863a2833b5be2baf649b6cef
Reviewed-on: https://go-review.googlesource.com/c/go/+/279492
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-01-07 17:51:29 +00:00
Ikko Ashimine
6da2d3b7d7 cmd/link: fix typo in asm.go
targetting -> targeting

Change-Id: Ie1752b1293426fe908799731acb352408db98d85
GitHub-Last-Rev: 4cf2a211b9
GitHub-Pull-Request: golang/go#43564
Reviewed-on: https://go-review.googlesource.com/c/go/+/282272
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-01-07 17:49:47 +00:00
Meng Zhuo
df81a15819 runtime: check mips64 VDSO clock_gettime return code
We introduced VDSO feature for mips64x in Go1.14, however Linux kernel
didn't ship VDSO safe fallback until 4.13.

This CL checks vdso return code it may fix this issue.

name         old time/op  new time/op  delta
Now           174ns ± 0%   176ns ± 0%  +1.20%  (p=0.000 n=8+9)
NowUnixNano   175ns ± 0%   177ns ± 0%  +1.13%  (p=0.000 n=9+7)
FormatNow    1.01µs ± 1%  1.02µs ± 3%    ~     (p=0.181 n=10+10)

Fixes #39046

Change-Id: Ibcefe4c8334f634c7ef18fa70f3c7dbe8306f224
Reviewed-on: https://go-review.googlesource.com/c/go/+/270717
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Michael Pratt <mpratt@google.com>
Trust: Meng Zhuo <mzh@golangcn.org>
2021-01-07 01:55:27 +00:00
Filippo Valsorda
4787e906cf crypto/x509: rollback new CertificateRequest fields
In general, we don't want to encourage reading them from CSRs, and
applications that really want to can parse the Extensions field.

Note that this also fixes a bug where the error of
parseKeyUsageExtension was not handled in parseCertificateRequest.

Fixes #43477
Updates #37172

Change-Id: Ia5707b0e23cecc0aed57e419a1ca25e26eea6bbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/281235
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2021-01-06 21:24:47 +00:00
Baokun Lee
c9658bee93 cmd/go: make module suggestion more friendly
We are trying to avoid by not automatically updating go.mod. The
suggestion should be that users actually add the dependencies they
need, and the command in an easily copy-pastable form now.

Fixes: #43430

Change-Id: I2227dab498fcd8d66184c94ebe9e776629ccadfd
Reviewed-on: https://go-review.googlesource.com/c/go/+/280713
Run-TryBot: Baokun Lee <bk@golangcn.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
2021-01-06 18:54:25 +00:00
Michael Anthony Knyszek
4c668b25c6 runtime/metrics: fix panic message for Float64Histogram
The panic message erroneously refers to float64 values.

Change-Id: I83380f41d6c28a72bc69a94b9bcdf9d42b1503c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/281236
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2021-01-06 18:41:54 +00:00
Steven Hartland
d2131704a6 net/http/httputil: fix deadlock in DumpRequestOut
Fix a deadlock in DumpRequestOut which can occur if the request is
cancelled between response being sent and it being processed.

Also:
* Ensure we don't get a reader leak when an error is reported by the
  transport before the body is consumed.
* Add leaked goroutine retries to avoid false test failures.

Fixes #38352

Change-Id: I83710791b2985b997f61fe5b49eadee0bb51bdee
Reviewed-on: https://go-review.googlesource.com/c/go/+/232798
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Damien Neil <dneil@google.com>
2021-01-06 15:02:50 +00:00
Jay Conrod
3e1e13ce6d cmd/go: set cfg.BuildMod to "readonly" by default with no module root
modload.Init now sets the default value for -mod if it wasn't set
explicitly. This happens before go.mod is loaded, so
modload.LoadModFile sets the default value again in order to enable
automatic vendoring.

Previously, cfg.BuildMod wasn't set at all if LoadModFile wasn't
called, as is the case for commands that run outside of a module
root. This problem only affected 'go install pkg@version' since other
commands are either forbidden in module mode or run with -mod=mod
(like 'go get' and 'go mod' subcommands).

This change also suppresses "missing sum" errors when -mod=readonly is
enabled and there is no module root.

Fixes #43278
Related #40278

Change-Id: I6071cc42bc5e24d0d7e84556e5bfd8e368e0019d
Reviewed-on: https://go-review.googlesource.com/c/go/+/279490
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-01-05 23:31:36 +00:00
Ian Lance Taylor
0b0d004983 cmd/go: pass embedcfg to gccgo if supported
For #41191

Change-Id: I75d327759c3d9ef061c19a80b9b2619038dedf68
Reviewed-on: https://go-review.googlesource.com/c/go/+/281492
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-01-05 23:13:49 +00:00
Ian Lance Taylor
1b85e7c057 cmd/go: don't scan gccgo standard library packages for imports
In a gccgo installation the standard library sources are not available.

Change-Id: I929f3645e3ac95a1fa7047d6a3d243159a86ba66
Reviewed-on: https://go-review.googlesource.com/c/go/+/281493
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-01-05 20:54:17 +00:00
Michael Pratt
6b37b15d95 runtime: don't take allglock in tracebackothers
tracebackothers is called from fatal throw/panic.

A fatal throw may be taken with allglock held (notably in the allocator
when allglock is held), which would cause a deadlock in tracebackothers
when we try to take allglock again. Locking allglock here is also often
a lock order violation w.r.t. the locks held when throw was called.

Avoid the deadlock and ordering issues by skipping locking altogether.
It is OK to miss concurrently created Gs (which are generally avoided by
freezetheworld(), and which were possible previously anyways if created
after the loop).

Fatal throw/panic freezetheworld(), which should freeze other threads
that may be racing to modify allgs. However, freezetheworld() does _not_
guarantee that it stops all other threads, so we can't simply drop the
lock.

Fixes #42669
Updates #43175

Change-Id: I657aec46ed35fd5d1b3f1ba25b500128ab26b088
Reviewed-on: https://go-review.googlesource.com/c/go/+/270861
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Trust: Michael Pratt <mpratt@google.com>
2021-01-05 20:00:43 +00:00
Toasa
9eef49cfa6 math/rand: fix typo in comment
Change-Id: I57fbabf272bdfd61918db155ee6f7091f18e5979
GitHub-Last-Rev: e138804b1a
GitHub-Pull-Request: golang/go#43495
Reviewed-on: https://go-review.googlesource.com/c/go/+/281373
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
2021-01-04 17:59:30 +00:00
DrGo
b01fb2af9e testing/fstest: fix typo in error message
Change-Id: Iac59f5271c79c46b39733fdf0eb4bf9b0fc0bdca
GitHub-Last-Rev: 03f96e32a8
GitHub-Pull-Request: golang/go#43450
Reviewed-on: https://go-review.googlesource.com/c/go/+/280953
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-01-04 12:06:08 +00:00
Dmitri Shuralyov
3dd5867605 doc: 2021 is the Year of the Gopher
What a year it has been. If there's one thing we can count on
at a time like this, it's that 2021 is the Year of the Gopher.

Change-Id: I4f6fbbe3d9b4b70df8fadd0d18237f05cd572265
Reviewed-on: https://go-review.googlesource.com/c/go/+/280163
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-01-01 20:05:20 +00:00
Cherry Zhang
95ce805d14 io/fs: remove darwin/arm64 special condition
It isn't necessary on darwin/arm64 (macOS).

It was probably leftover from the old code when darwin/arm64
meant iOS. The test passes on iOS builder. Apparently this is
not needed either. Remove.

Change-Id: I6fa0c55d6086325d4b722862c4fe6c30bcd6e6e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/280158
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-31 02:24:55 +00:00
Alberto Donizetti
20d0991b86 lib/time, time/tzdata: update tzdata to 2020f
Changelog

 'make rearguard_tarballs' no longer generates a bad rearguard.zi,
 fixing a 2020e bug.

No actual changes to timezones data. See

  http://mm.icann.org/pipermail/tz-announce/2020-December/000064.html

Updates #22487

Change-Id: I78f7adba1c3c1d3489b0da870601117b9b8cb0d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/280455
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-12-30 22:51:30 +00:00
Cherry Zhang
ed301733bb misc/cgo/testcarchive: remove special flags for Darwin/ARM
The original Darwin/ARM port is gone. For ARM64, it works fine
without the flags on macOS/ARM64. Remove the flags.

Change-Id: I9cc00c49dd71376dd9c52abb78c2d8cec656b3db
Reviewed-on: https://go-review.googlesource.com/c/go/+/280157
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-30 22:39:59 +00:00
Cherry Zhang
0ae2e032f2 misc/cgo/test: enable TestCrossPackageTests on darwin/arm64
Somehow I missed that one. It works fine.

Change-Id: I0b1286bf1e6a8f40b9f3f114f49b3034079e0b85
Reviewed-on: https://go-review.googlesource.com/c/go/+/280156
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-30 22:39:48 +00:00
Daniel Martí
780b4de16b misc/ios: fix wording for command line instructions
A typo was made, which I noticed while looking through the recent master
commits.

Change-Id: Ieed5d6664a1f3ff5892d59abf194963b44ef0e55
Reviewed-on: https://go-review.googlesource.com/c/go/+/280454
Trust: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-12-29 21:49:26 +00:00
Cherry Zhang
b4a71c95d2 doc/go1.16: reference misc/ios/README for how to build iOS programs
Updates #43371, #43343.

Change-Id: Ib89b809a5220717507272453ea86224d1928dd36
Reviewed-on: https://go-review.googlesource.com/c/go/+/280154
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-29 20:35:10 +00:00
Cherry Zhang
f83e0f6616 misc/ios: add to README how to build ios executables
Updates #43371, #43343.

Change-Id: I19386269245f2c20345c6cac7560089b8223e9f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/280153
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-29 20:34:36 +00:00
xinlingchao
4fd9455882 io/fs: fix typo in comment
Change-Id: Idf8e5d808c0996e0ca00979e7b8d7627f29cd10f
Reviewed-on: https://go-review.googlesource.com/c/go/+/280552
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
2020-12-28 17:15:36 +00:00
Elias Naur
1d78139128 runtime/cgo: fix Android build with NDK 22
Fixes #42655

Change-Id: I7d2b70098a4ba4dcb325fb0be076043789b86135
Reviewed-on: https://go-review.googlesource.com/c/go/+/280312
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Elias Naur <mail@eliasnaur.com>
2020-12-26 19:08:56 +00:00
Ian Lance Taylor
2018b68a65 net/mail: don't use MDT in test
When time.Parse sees a timezone name that matches the local timezone,
it uses the local timezone. The tests weren't expecting that,
so using MDT broke with TZ=America/Boise (where MDT means Mountain
Daylight Time). Just use GMT instead.

Fixes #43354

Change-Id: Ida70c8c867e2568b1535d1dfbf1fb0ed9e0e5c1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/280072
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2020-12-25 23:54:24 +00:00
Michael Anthony Knyszek
b116404444 runtime: shift timeHistogram buckets and allow negative durations
Today, timeHistogram, when copied, has the wrong set of counts for the
bucket that should represent (-inf, 0), when in fact it contains [0, 1).
In essence, the buckets are all shifted over by one from where they're
supposed to be.

But this also means that the existence of the overflow bucket is wrong:
the top bucket is supposed to extend to infinity, and what we're really
missing is an underflow bucket to represent the range (-inf, 0).

We could just always zero this bucket and continue ignoring negative
durations, but that likely isn't prudent.

timeHistogram is intended to be used with differences in nanotime, but
depending on how a platform is implemented (or due to a bug in that
platform) it's possible to get a negative duration without having done
anything wrong. We should just be resilient to that and be able to
detect it.

So this change removes the overflow bucket and replaces it with an
underflow bucket, and timeHistogram no longer panics when faced with a
negative duration.

Fixes #43328.
Fixes #43329.

Change-Id: If336425d7d080fd37bf071e18746800e22d38108
Reviewed-on: https://go-review.googlesource.com/c/go/+/279468
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2020-12-23 17:31:18 +00:00
Michael Anthony Knyszek
8db7e2fecd runtime: fix allocs-by-size and frees-by-size buckets
Currently these two metrics are reported incorrectly, going by the
documentation in the runtime/metrics package. We just copy in the
size-class-based values from the runtime wholesale, but those implicitly
have an inclusive upper-bound and exclusive lower-bound (e.g. 48-byte
size class contains objects in the size range (32, 48]) but the API
declares inclusive lower-bounds and exclusive upper-bounds.

Also, the bottom bucket representing (-inf, 1) should always be empty.
Extend the consistency check to verify this.

Updates #43329.

Change-Id: I11b5b062a34e13405ab662d15334bda91f779775
Reviewed-on: https://go-review.googlesource.com/c/go/+/279467
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2020-12-23 17:31:08 +00:00
Michael Anthony Knyszek
fb96f07e1a runtime: fix nStackRoots comment about stack roots
A comment in mgcmark.go indicates that we scan stacks a second time but
we don't, at least not since changing to the hybrid write barrier.

Change-Id: I9376adbb6d8b6dd9dc3cee62e077b5dfb8a3fdde
Reviewed-on: https://go-review.googlesource.com/c/go/+/279797
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
2020-12-23 17:30:35 +00:00
Alberto Donizetti
d1502b3c72 lib/time, time/tzdata: update tzdata to 2020e
Changelog:

  Volgograd switches to Moscow time on 2020-12-27 at 02:00.
  Small changes to past timestamps and abbreviations.

See

  http://mm.icann.org/pipermail/tz-announce/2020-December/000063.html

Updates #22487

Change-Id: I709abe899ca498698463e945ccbcf4bc5fe60b92
Reviewed-on: https://go-review.googlesource.com/c/go/+/279794
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-23 17:29:16 +00:00
markruler
30c99cbb7a cmd/go: add the Retract field to 'go help mod edit' definition of the GoMod struct
Fixes #43281

Change-Id: Ife26ca174a8818b56aaea9547976d97978478a5f
GitHub-Last-Rev: 85a3d30001
GitHub-Pull-Request: golang/go#43315
Reviewed-on: https://go-review.googlesource.com/c/go/+/279592
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Jay Conrod <jayconrod@google.com>
2020-12-23 17:26:56 +00:00
Andrey Bokhanko
49d0b239cb doc: fix a typo in contribute.html
A fix for a trivial (yet still confusing for neophytes like me!) typo in
contribute.html.

Change-Id: Ic68673fb2a3855c2b9e8042047087450e8793e6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/279452
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2020-12-23 17:01:35 +00:00
Jay Conrod
98a73030b0 cmd/go: in 'go get', promote named implicit dependencies to explicit
'go get pkg@vers' will now add an explicit requirement for the module
providing pkg if that version was already indirectly required.

'go get mod@vers' will do the same if mod is a module path but not a
package.

Requirements promoted this way will be marked "// indirect" because
'go get' doesn't know whether they're needed to build packages in the
main module. So users should prefer to run 'go get ./pkg' (where ./pkg
is a package in the main module) to promote requirements.

Fixes #43131

Change-Id: Ifbb65b71274b3cc752a7a593d6ddd875f7de23b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/278812
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-12-23 14:16:32 +00:00
Andrew G. Morgan
fd6ba1c8a2 os/signal: fix a deadlock with syscall.AllThreadsSyscall() use
The syscall.AllThreadsSyscall() fixup mechanism needs to cooperate
with signal handling to ensure a notetsleepg() thread can wake up
to run the mDoFixup() function.

Fixes #43149

Change-Id: I6651b25bc44a4de47d3fb71d0293d51aef8b79c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/277434
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-12-23 05:27:04 +00:00
Andrew G. Morgan
b0b0d98283 runtime: linux iscgo support for not blocking nptl signals
Under linux+cgo, OS threads are launched via pthread_create().
This abstraction, under linux, requires we avoid blocking
signals 32,33 and 34 indefinitely because they are needed to
reliably execute POSIX-semantics threading in glibc and/or musl.

When blocking signals the go runtime generally re-enables them
quickly. However, when a thread exits (under cgo, this is
via a return from mstart()), we avoid a deadlock in C-code by
not blocking these three signals.

Fixes #42494

Change-Id: I02dfb2480a1f97d11679e0c4b132b51bddbe4c14
Reviewed-on: https://go-review.googlesource.com/c/go/+/269799
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
2020-12-23 02:10:51 +00:00
Jay Conrod
223331fc0c cmd/go/internal/modload: add hint for missing implicit dependency
By default (and with -mod=readonly), the go command imports an error
if a package provided by an implicitly required module is
imported by a package in the main module. This import requires an
update to go.mod: the module must be required explicitly.

The package loader now provides a hint that 'go get' should be run on
the importing package. This is preferred to 'go get' on the imported
package, since that would add an "// indirect" requirement.

For #43131

Change-Id: I0b353ce8ac8c4ddf1a9863544dfaf6c1964daf42
Reviewed-on: https://go-review.googlesource.com/c/go/+/279528
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-12-22 23:39:46 +00:00