1
0
mirror of https://github.com/golang/go synced 2024-11-26 12:37:57 -07:00
Commit Graph

42167 Commits

Author SHA1 Message Date
Robert Griesemer
a52c0a1992 math/big: make Rat.Denom side-effect free
A Rat is represented via a quotient a/b where a and b are Int values.
To make it possible to use an uninitialized Rat value (with a and b
uninitialized and thus == 0), the implementation treats a 0 denominator
as 1.

Rat.Num and Rat.Denom return pointers to these values a and b. Because
b may be 0, Rat.Denom used to first initialize it to 1 and thus produce
an undesirable side-effect (by changing the Rat's denominator).

This CL changes Denom to return a new (not shared) *Int with value 1
in the rare case where the Rat was not initialized. This eliminates
the side effect and returns the correct denominator value.

While this is changing behavior of the API, the impact should now be
minor because together with (prior) CL https://golang.org/cl/202997,
which initializes Rats ASAP, Denom is unlikely used to access the
denominator of an uninitialized (and thus 0) Rat. Any operation that
will somehow set a Rat value will ensure that the denominator is not 0.

Fixes #33792.
Updates #3521.

Change-Id: I0bf15ac60513cf52162bfb62440817ba36f0c3fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/203059
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-24 03:34:24 +00:00
Robert Griesemer
4412181e7c math/big: normalize unitialized denominators ASAP
A Rat is represented via a quotient a/b where a and b are Int values.
To make it possible to use an uninitialized Rat value (with a and b
uninitialized and thus == 0), the implementation treats a 0 denominator
as 1.

For each operation we check if the denominator is 0, and then treat
it as 1 (if necessary). Operations that create a new Rat result,
normalize that value such that a result denominator 1 is represened
as 0 again.

This CL changes this behavior slightly: 0 denominators are still
interpreted as 1, but whenever we (safely) can, we set an uninitialized
0 denominator to 1. This simplifies the code overall.

Also: Improved some doc strings.

Preparation for addressing issue #33792.

Updates #33792.

Change-Id: I3040587c8d0dad2e840022f96ca027d8470878a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/202997
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-24 03:34:11 +00:00
Than McIntosh
4adf822fc9 [dev.link] cmd/link: add in change missed from code review
Incorporate a change suggested by Cherry for CL 201721 that I missed
accidentally.

Change-Id: I65e6532e78888505573169e56bc4ace9a0f8c510
Reviewed-on: https://go-review.googlesource.com/c/go/+/202760
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-10-24 00:53:39 +00:00
Cherry Zhang
758eb020f7 runtime: save/fetch g register during VDSO on ARM and ARM64
On ARM and ARM64, during a VDSO call, the g register may be
temporarily clobbered by the VDSO code. If a signal is received
during the execution of VDSO code, we may not find a valid g
reading the g register. In CL 192937, we conservatively assume
g is nil. But this approach has a problem: we cannot handle
the signal in this case. Further, if the signal is not a
profiling signal, we'll call badsignal, which calls needm, which
wants to get an extra m, but we don't have one in a non-cgo
binary, which cuases the program to hang.

This is even more of a problem with async preemption, where we
will receive more signals than before. I ran into this problem
while working on async preemption support on ARM64.

In this CL, before making a VDSO call, we save the g on the
gsignal stack. When we receive a signal, we will be running on
the gsignal stack, so we can fetch the g from there and move on.

We probably want to do the same for PPC64. Currently we rely on
that the VDSO code doesn't actually clobber the g register, but
this is not guaranteed and we don't have control with.

Idea from discussion with Dan Cross and Austin.

Should fix #34391.

Change-Id: Idbefc5e4c2f4373192c2be797be0140ae08b26e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/202759
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
2019-10-23 22:59:54 +00:00
Rohan Verma
20bba866d3 doc/play: match the hello world snippet in x/website
Fixes #35099

Change-Id: Ieaf3174540087bd20443b38703ef88d9f9638052
GitHub-Last-Rev: 12973bc66f
GitHub-Pull-Request: golang/go#35123
Reviewed-on: https://go-review.googlesource.com/c/go/+/202998
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-23 22:43:37 +00:00
Dmitri Shuralyov
e9e4f6c433 misc: delete benchcmp forwarding script
benchcmp was moved out of misc into x/tools in CL 60100043 in 2014,
and then replaced by a forwarding script in CL 82710043.
Five years have since passed, and the forwarding script has outlived
its usefulness. It's now more confusing than helpful. Delete it.

Change-Id: I8c7d65b97e0b3fe367df69a86ae10c7960c05be3
Reviewed-on: https://go-review.googlesource.com/c/go/+/202762
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-23 21:41:15 +00:00
Jason A. Donenfeld
033e066cb3 internal/syscall/windows/registry: blacklist certain registry keys in TestWalkFullRegistry
It turns out that Windows has "legitimate" keys that have bogus type
values or bogus lengths that don't correspond with their type. On up to
date Windows 10 systems, this test always fails for this reason. These
keys exist because of bugs in Microsoft's code. This commit works around
the problem by simply blacklisting known instances. It also expands the
error message a bit so that we can make adjustments should the problem
ever happen again, and reformats the messages so that it makes copy and
pasting into the blacklist easier.

Updates #35084

Change-Id: I50322828c0eb0ccecbb62d6bf4f9c726fa0b3c27
Reviewed-on: https://go-review.googlesource.com/c/go/+/202897
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-23 21:20:18 +00:00
Fazlul Shahriar
b284dac232 syscall: fix Clearenv on Plan 9
Update #25234
Fixes #35083

Change-Id: Ida39516ab1c14a34a62c2232476a75e83f4e3f75
Reviewed-on: https://go-review.googlesource.com/c/go/+/202657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-23 20:13:18 +00:00
Jay Conrod
7833302a62 cmd/go: ignore '@' when cleaning local and absolute file path args
Since CL 194600, search.CleanPaths preserves characters after '@' in
each argument. This was done so that paths could be cleaned while
version queries were preserved. However, local and absolute file paths
may contain '@' characters.

With this change, '@' is treated as a normal character by
search.CleanPaths in local and absolute paths.

Fixes #35115

Change-Id: Ia7d37e0a2737442d4f1796cc2fc3a59237a8ddfe
Reviewed-on: https://go-review.googlesource.com/c/go/+/202761
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-23 18:41:38 +00:00
Ghazni Nattarshah
67fb5530f0 crypto/x509: gofmt verify.go
Fixes #35052

Change-Id: Ie7c52f39203cf16d8b53a333b591cffccdf7446a
Reviewed-on: https://go-review.googlesource.com/c/go/+/202877
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-23 18:07:56 +00:00
Brad Fitzpatrick
787906493b doc: clarify that contributing isn't just for code
Updates #33323

Change-Id: I4b3076469f3db8ab0fe888edcf0471f17dc199e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/202823
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-10-23 17:57:23 +00:00
Jason A. Donenfeld
f91e895de3 syscall: reenable sysctl on iOS
This was disabled due to a report that the App Store rejects the symbol
__sysctl. However, we use the sysctl symbol, which is fine. The __sysctl
symbol is used by x/sys/unix, which needs fixing instead. So, this
commit reenables sysctl on iOS, so that things like net.InterfaceByName
can work again.

This reverts CL 193843, CL 193844, CL 193845, and CL 193846.

Fixes #35101
Updates #34133
Updates #35103

Change-Id: Ib8eb9f87b81db24965b0de29d99eb52887c7c60a
Reviewed-on: https://go-review.googlesource.com/c/go/+/202778
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-23 15:12:15 +00:00
Tobias Klauser
9fc41cd697 runtime: report correct error if kevent failed in netpollinit
Report the value returned by kevent, not the previously set errno which
is 0.

Found while debugging CL 198544

Change-Id: I854f5418f8ed8e083d909d328501355496c67a53
Reviewed-on: https://go-review.googlesource.com/c/go/+/202777
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-23 08:08:58 +00:00
Ian Lance Taylor
ab3f1a23b6 runtime: add race detector support for new timers
Since the new timers run on g0, which does not have a race context,
we add a race context field to the P, and use that for timer functions.
This works since all timer functions are in the standard library.

Updates #27707

Change-Id: I8a5b727b4ddc8ca6fc60eb6d6f5e9819245e395b
Reviewed-on: https://go-review.googlesource.com/c/go/+/171882
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-23 07:43:18 +00:00
Ian Lance Taylor
c824420d47 runtime: implement timeSleepUntil for new timers
Updates #27707

Change-Id: Id4b37594511895f404ee3c09a85263b2b35f835d
Reviewed-on: https://go-review.googlesource.com/c/go/+/171881
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-10-23 07:02:10 +00:00
Ian Lance Taylor
5f92939c90 runtime: update timejump function for new timers
Since timers are now on a P, rather than having a G running timerproc,
timejump changes to return a P rather than a G.

Updates #27707

Change-Id: I3d05af2d664409a0fd906e709fdecbbcbe00b9a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/171880
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-23 05:20:12 +00:00
Jason A. Donenfeld
0195a29399 internal/syscall/windows/registry: fix strict assumptions in TestWalkFullRegistry
It turns out that Windows has "legitimate" keys that have bogus type
values or bogus lengths that don't correspond with their type. On up to
date Windows 10 systems, this test always fails for this reason.

So, this commit alters the test to simply log the discrepancy and move
on.

Fixes #35084

Change-Id: I56e12cc62aff49cfcc38ff01a19dfe53153976a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/202678
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-23 03:08:00 +00:00
Matthew Dempsky
dded58760d cmd/compile: enable -d=checkptr when -race or -msan is specified
It can still be manually disabled again using -d=checkptr=0.

It's also still disabled by default for GOOS=windows, because the
Windows standard library code has a lot of unsafe pointer conversions
that need updating.

Updates #34964.

Change-Id: Ie0b8b4fdf9761565e0dcb00d69997ad896ac233d
Reviewed-on: https://go-review.googlesource.com/c/go/+/201783
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-22 23:28:20 +00:00
Matthew Dempsky
5a5854c2d1 runtime: fix -d=checkptr failure for testing/quick
This CL extends checkptrBase to recognize pointers into the stack and
data/bss sections. I was meaning to do this eventually anyway, but
it's also an easy way to workaround #35068.

Updates #35068.

Change-Id: Ib47f0aa800473a4fbc249da52ff03bec32c3ebe2
Reviewed-on: https://go-review.googlesource.com/c/go/+/202639
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2019-10-22 23:14:03 +00:00
Ian Lance Taylor
7d84245a9c runtime: implement time.Sleep for new timers
Updates #27707

Change-Id: I51da8a04ec12ba1efa435e86e3a15d4d13c96c45
Reviewed-on: https://go-review.googlesource.com/c/go/+/171879
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-22 22:35:20 +00:00
Ian Lance Taylor
432ca0ea83 runtime: add new runtimer function
Updates #27707

Change-Id: I1e65effb708911c727d126c51e0f50fe219f42ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/171878
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-22 22:15:25 +00:00
Ian Lance Taylor
220150ff3c runtime: add new adjusttimers function
The adjusttimers function is where we check the adjustTimers field in
the P struct to see if we need to resort the heap. We walk forward in
the heap and find and resort timers that have been modified, until we
find all the timers that were modified to run earlier. Along the way
we remove deleted timers.

Updates #27707

Change-Id: I1cba7fe77b8112b7e9a9dba80b5dfb08fcc7c568
Reviewed-on: https://go-review.googlesource.com/c/go/+/171877
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-22 21:40:27 +00:00
Jay Conrod
b2ea4e6d34 cmd/go: make 'go mod verify' report an error outside a module
Also, test that 'go mod download' without arguments reports an error.

Fixes #32027

Change-Id: I873fc59fba4c78ee2b4f49f0d846ee2ac0eee4db
Reviewed-on: https://go-review.googlesource.com/c/go/+/202697
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 21:34:48 +00:00
Ian Lance Taylor
7d891d5e4d runtime: implement new movetimers function
Updates #27707

Change-Id: Idda31d0065064a81c570e291ef588d020871997d
Reviewed-on: https://go-review.googlesource.com/c/go/+/171836
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-22 21:23:03 +00:00
Ian Lance Taylor
4665470147 runtime: add new cleantimers function
Also add a skeleton of the runOneTimer function.

Updates #27707

Change-Id: Ic6a0279354a57295f823093704b7e152ce5d769d
Reviewed-on: https://go-review.googlesource.com/c/go/+/171835
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-22 21:04:09 +00:00
Matthew Dempsky
daeb5efb20 runtime: somewhat better checkptr error messages
They're still lacking in details, but at least better than being
printed as raw interface values.

Updates #22218.

Change-Id: I4fd813253afdd6455c0c9b5a05c61659805abad1
Reviewed-on: https://go-review.googlesource.com/c/go/+/202677
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-22 20:50:04 +00:00
Ian Lance Taylor
9093b1def0 runtime: add new dodeltimer and dodeltimer0 functions
The dodeltimer function removes a timer from a heap. The dodeltimer0
function removes the first timer from a heap; in the old timer code
this common special case was inlined in the timerproc function.

Updates #27707

Change-Id: I1b7c0af46866abb4bffa8aa4d8e7143f9ae8f402
Reviewed-on: https://go-review.googlesource.com/c/go/+/171834
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2019-10-22 20:45:48 +00:00
Ben Shi
b12703e052 cmd/compile: remove amd64p32 related SSA rules
Updates golang/go#30439

Change-Id: Iadc737e4c6bb05bb576fe4bb344ad92403697352
Reviewed-on: https://go-review.googlesource.com/c/go/+/201380
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-22 20:41:47 +00:00
Ian Lance Taylor
eff3c1e426 runtime: add new resettimer function
Updates #27707

Change-Id: I02f97ec7869ec8a3fb2dfc94cff246badc7ea0fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/171833
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-22 20:22:27 +00:00
Jay Conrod
4be6b4a73d cmd/go/internal/modfile: prepare to move to x/mod
- Deleted dead code in gopkgin.go.
- Minor documentation changes.

Updates #34924

Change-Id: Ie2c744bbf6662cae20f09163200f20d7589fd237
Reviewed-on: https://go-review.googlesource.com/c/go/+/202565
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 20:00:32 +00:00
Jay Conrod
8ba43eaad8 cmd/go: support -modcacherw in 'go mod' subcommands
The -modcacherw flag is now registered in work.AddModCommonFlags,
which is called from work.AddBuildFlags, where it was registered
before. 'go mod' subcommands register the flag by calling
work.AddModCommonFlags directly.

Also, build commands now exit with an error if -modcacherw is set
explicitly (not in GOFLAGS) in GOPATH mode.

Updates #31481

Change-Id: I461e59a51ed31b006fff4d5c57c2a866be0bbf38
Reviewed-on: https://go-review.googlesource.com/c/go/+/202563
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-22 20:00:03 +00:00
Brad Fitzpatrick
88186e5e23 net/http: don't cache http2.erringRoundTripper connections
Fixes #34978

Change-Id: I3baf1392ba7366ae6628889c47c343ef702ec438
Reviewed-on: https://go-review.googlesource.com/c/go/+/202078
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 19:46:38 +00:00
smasher164
03fb1f607b cmd/compile: don't use FMA on plan9
CL 137156 introduces an intrinsic on AMD64 that executes vfmadd231sd
when feature detection is successful. However, because floating-point
isn't allowed in note handler, the builder disables SSE instructions,
and fails when attempting to execute this instruction. This change
disables FMA on plan9 to immediately use the software fallback.

Fixes #35063.

Change-Id: I87d8f0995bd2f15013d203e618938f5079c9eed2
Reviewed-on: https://go-review.googlesource.com/c/go/+/202617
Reviewed-by: Keith Randall <khr@golang.org>
2019-10-22 19:36:42 +00:00
Ian Lance Taylor
48eb79ec21 runtime: add new modtimer function
This adds a new field to P, adjustTimers, that tells the P that one of
its existing timers was modified to be earlier, and that it therefore
needs to resort them.

Updates #27707

Change-Id: I4c5f5b51ed116f1d898d3f87cdddfa1b552337f8
Reviewed-on: https://go-review.googlesource.com/c/go/+/171832
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-22 19:35:04 +00:00
Jean de Klerk
a813d3c788 testing: stream log output in verbose mode
Fixes #24929

Change-Id: Icc426068cd73b75b78001f55e1e5d81ccebbe854
Reviewed-on: https://go-review.googlesource.com/c/go/+/127120
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-22 19:21:02 +00:00
Ian Lance Taylor
7416315e33 runtime: add new deltimer function
Updates #27707

Change-Id: I720e8af9e183c75abcb63ccc30466734c8dba74f
Reviewed-on: https://go-review.googlesource.com/c/go/+/171831
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-22 19:05:29 +00:00
Ian Lance Taylor
2e0aa581b4 runtime: add new addtimer function
When we add a timer, make sure that the network poller is initialized,
since we will use it if we have to wait for the timer to be ready.

Updates #27707

Change-Id: I0637fe646bade2cc5ce50b745712292aa9c445b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/171830
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-10-22 18:41:00 +00:00
LE Manh Cuong
3db6d46a4e cmd/compile: add marker for skipping dowidth when tracing typecheck
The root cause of #33658 is that fmt.Printf does have side effects when
printing Type.

typefmt for TINTER will call Type.Fields to get all embedded fields and
methods. The thing is that type.Fields itself will call dowidth, which will
expand the embedded interface, make it non-embedded anymore.

To fix it, we add a marker while we are tracing, so dowidth can know and
return immediately without doing anything.

Fixes #33658

Change-Id: Id4b70ff68a3b802675deae96793fdb8f7ef1a4a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/190537
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-10-22 18:26:35 +00:00
Matthew Dempsky
5eec0a91ea reflect: fix unsafe conversions reported by -d=checkptr
The code for generating gcdata was (technically) unsafe. It was also
rather repetitive. This CL refactors it a bit and abstracts use of
gcdata into a helper gcSlice method.

Updates #34972.

Change-Id: Ie86d7822eafe263f1d3d150eedf0ec66be1ec85d
Reviewed-on: https://go-review.googlesource.com/c/go/+/202582
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 18:09:15 +00:00
Matthew Dempsky
a97ccc8940 sync/atomic: suppress checkptr errors for hammerStoreLoadPointer
This test could be updated to use unsafe.Pointer arithmetic properly
(e.g., see discussion at #34972), but it doesn't seem worthwhile. The
test is just checking that LoadPointer and StorePointer are atomic.

Updates #34972.

Change-Id: I85a8d610c1766cd63136cae686aa8a240a362a18
Reviewed-on: https://go-review.googlesource.com/c/go/+/202597
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 18:09:03 +00:00
Bryan C. Mills
22278ca0d4 net: convert TestTCPServer to use subtests
My fix in CL 202618 inadvertently violated an invariant in the inner
loop of TestTCPServer (namely, that len(trchs) == i). That causes a
panic when one or more of the channels is omitted due to a flake.

Instead of trying to fix up the test, let's just factor out a subtest
and skip the whole thing if the transceiver's Dial flakes out.

Updates #32919

Change-Id: Ib6f274a44194311c8c5a2faf19f586cc9eccfd4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/202561
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 17:34:15 +00:00
Robert Griesemer
51504f0a2d go/types: don't update package-external types when checking validity
The recently added type-validity check uses a new field of Named
types for marking (to detect cycles). That field was modified even
if the type was not part of the current package or belonged to the
Universe scope (error type). This led to race conditions if the
package's type was imported by multiple, concurrently type-checked
packages.

A test would be nice but it's a bit cumbersome to set one up.
Verified manually that package-external types are left alone.

Fixes #35049.

Change-Id: I51686bef47fcca48b99b91ecb1b2e9d58e135ea6
Reviewed-on: https://go-review.googlesource.com/c/go/+/202483
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-22 16:13:55 +00:00
David du Colombier
19d2a1cc2c cmd/go: fix TestScript/list_ambiguous_path on Plan 9
CL 198459 added TestScript/list_ambiguous_path. This
test is failing on Plan 9, because the expected error
doesn't match the error message returned on Plan 9.

This change fixes the test by matching the correct
error message on Plan 9.

Fixes #35072.

Change-Id: If8cdb641e0e9544ae4ac24f8d0c54859a3b23a69
Reviewed-on: https://go-review.googlesource.com/c/go/+/202447
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-22 15:28:05 +00:00
Bryan C. Mills
95544cc2c2 net: ignore or skip known-flaky localhost Dial operations on macOS 10.12 builder
Fixes #22019
Fixes #32919

Change-Id: I60bf6c69b18c3e2d78b494e54adc958fe40134da
Reviewed-on: https://go-review.googlesource.com/c/go/+/202618
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-22 15:15:06 +00:00
Brave Cow
07ccdeb192 net/http: update sanitizeCookieValue description
Commit 8f6d68eb (CL 37328) changed the code of sanitizeCookieValue without updating its description.

Change-Id: Ib4a1a1f316548258b828458a31b09706bbd59b53
GitHub-Last-Rev: 9731494e17
GitHub-Pull-Request: golang/go#34790
Reviewed-on: https://go-review.googlesource.com/c/go/+/200041
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-22 15:03:09 +00:00
Baokun Lee
ea726d8dc6 cmd/go/internal/modcmd: error out if one module with two different paths
If a single module is imported via two different paths, go mod tidy
should have reported this error instead of deferring it until go build.

Fixes #34650.

Change-Id: I9d09df1551b3e2083ed9f0bc77f2989073057717
Reviewed-on: https://go-review.googlesource.com/c/go/+/199598
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-22 14:26:04 +00:00
Ian Lance Taylor
d29c14f3d2 runtime: factor signal stack code out of sigtrampgo
This reduces the required nosplit stack size, which permits building
on Solaris with -gcflags=all=-N -l.

Fixes #35046

Change-Id: Icb3a421bb791c73e2f670ecfadbe32daea79789f
Reviewed-on: https://go-review.googlesource.com/c/go/+/202446
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-22 13:57:02 +00:00
Ian Lance Taylor
4f364be08d runtime: correctly negate errno value for *BSD ARM
Fixes #35037

Change-Id: I0b9bcd001556cd409994d83dabcdd6e32b001d28
Reviewed-on: https://go-review.googlesource.com/c/go/+/202441
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-10-22 11:49:50 +00:00
Jason A. Donenfeld
16f0f9c8e1 syscall: respect permission bits on file opening on Windows
On Windows, os.Chmod and syscall.Chmod toggle the FILE_ATTRIBUTES_
READONLY flag depending on the permission bits. That's a bit odd but I
guess some compromises were made at some point and this is what was
chosen to map to a Unix concept that Windows doesn't really have in the
same way. That's fine. However, the logic used in Chmod was forgotten
from os.Open and syscall.Open, which then manifested itself in various
places, most recently, go modules' read-only behavior.

This makes syscall.Open consistent with syscall.Chmod and adds a test
for the permission _behavior_ using ioutil. By testing the behavior
instead of explicitly testing for the attribute bits we care about, we
make sure this doesn't regress in unforeseen ways in the future, as well
as ensuring the test works on platforms other than Windows.

In the process, we fix some tests that never worked and relied on broken
behavior, as well as tests that were disabled on Windows due to the
broken behavior and had TODO notes.

Fixes #35033

Change-Id: I6f7cf54517cbe5f6b1678d1c24f2ab337edcc7f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/202439
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-22 10:09:39 +00:00
Ian Lance Taylor
7f98c0eb03 os/exec: skip possible netpoll pipe in known FDs in test
Fixes #35045

Change-Id: I90ac29882c7d03936c98c4116a8bccdd2ecbf76b
Reviewed-on: https://go-review.googlesource.com/c/go/+/202445
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-10-22 08:54:50 +00:00