1
0
mirror of https://github.com/golang/go synced 2024-11-23 00:10:07 -07:00
Commit Graph

38861 Commits

Author SHA1 Message Date
Martin Möhrmann
38e7177c94 cmd/compile: fix length overflow when appending elements to a slice
Instead of testing len(slice)+numNewElements > cap(slice) use
uint(len(slice)+numNewElements) > uint(cap(slice)) to test
if a slice needs to be grown in an append operation.

This prevents a possible overflow when len(slice) is near the maximum
int value and the addition of a constant number of new elements
makes it overflow and wrap around to a negative number which is
smaller than the capacity of the slice.

Appending a slice to a slice with append(s1, s2...) already used
a uint comparison to test slice capacity and therefore was not
vulnerable to the same overflow issue.

Fixes: #29190

Change-Id: I41733895838b4f80a44f827bf900ce931d8be5ca
Reviewed-on: https://go-review.googlesource.com/c/154037
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-14 05:48:18 +00:00
Bryan C. Mills
84b408cd36 cmd/go: set user and email in test-local git repos
Some of the builders cannot infer user and email from the builder hostname.

Change-Id: I27e5d011fa1471f27763b6b7fa1bf59e418b925c
Reviewed-on: https://team-review.git.corp.google.com/c/376739
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-on: https://go-review.googlesource.com/c/154107
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-14 01:19:40 +00:00
Dmitri Shuralyov
c802904127 doc: document Go 1.11.3 and Go 1.10.6
Change-Id: I3fe44887a84586d73be01df78a9cbb002c1fc9c5
Reviewed-on: https://team-review.git.corp.google.com/c/376465
Reviewed-by: Filippo Valsorda <valsorda@google.com>
Reviewed-on: https://go-review.googlesource.com/c/154106
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-14 01:07:50 +00:00
Filippo Valsorda
770130659b crypto/x509: limit number of signature checks for each verification
That number grows quadratically with the number of intermediate
certificates in certain pathological cases (for example if they all have
the same Subject) leading to a CPU DoS. Set a fixed budget that should
fit all real world chains, given we only look at intermediates provided
by the peer.

The algorithm can be improved, but that's left for follow-up CLs:

    * the cache logic should be reviewed for correctness, as it seems to
      override the entire chain with the cached one
    * the equality check should compare Subject and public key, not the
      whole certificate
    * certificates with the right SKID but the wrong Subject should not
      be considered, and in particular should not take priority over
      certificates with the right Subject

Fixes #29233

Change-Id: Ib257c12cd5563df7723f9c81231d82b882854213
Reviewed-on: https://team-review.git.corp.google.com/c/370475
Reviewed-by: Andrew Bonventre <andybons@google.com>
Reviewed-on: https://go-review.googlesource.com/c/154105
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
2018-12-14 01:04:07 +00:00
Bryan C. Mills
9c075b7c71 cmd/go/internal/get: relax pathOK check to allow any letter
This fixes a regression of #18660 with the new path checks.

Updates #29230

Change-Id: I2dd9adab999e7f810e0e746ad8b75ea9622f56e7
Reviewed-on: https://team-review.git.corp.google.com/c/370578
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-on: https://go-review.googlesource.com/c/154104
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-14 01:03:08 +00:00
Bryan C. Mills
73e862eced cmd/go/internal/get: use a strings.Replacer in expand
This should be a no-op, but produces deterministic (and more correct)
behavior if we have accidentally failed to sanitize one of the inputs.

Updates #29231

Change-Id: I1271d0ffd01a691ec8c84906c4e02d9e2be19c72
Reviewed-on: https://team-review.git.corp.google.com/c/370575
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-on: https://go-review.googlesource.com/c/154103
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-14 01:02:16 +00:00
Bryan C. Mills
4ab6fb1945 cmd/go/internal/get: reject Windows shortnames as path components
Updates #29230

Change-Id: Ia32d8ec1fc0c4e242f50d8871c0ef3ce315f3c65
Reviewed-on: https://team-review.git.corp.google.com/c/370571
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-on: https://go-review.googlesource.com/c/154102
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-14 01:01:05 +00:00
Bryan C. Mills
bc82d7c7db cmd/go: reject 'get' of paths containing leading dots or unsupported characters
On some platforms, directories beginning with dot are treated as
hidden files, and filenames containing unusual characters can be
confusing for users to manipulate (and delete).

Fixes #29230
Fixes #29231

Change-Id: Ic6f97f577d8fafa83ef62438095a5c7ae022881a
Reviewed-on: https://team-review.git.corp.google.com/c/368507
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-on: https://go-review.googlesource.com/c/154101
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-14 00:59:35 +00:00
Joe Tsai
190a5f8fd2 go/doc: simplify and robustify link detection logic
To fix #5043, we added logic to allow balanced pairs of parenthesis
so that we could match URLs like:
	http://example.com/some_resource(foo)

Howewer, such logic breaks when parsing something like the following:
	art by [https://example.com/person][Person Name]].
such that the following is considered the link:
	https://example.com/person][Person

Since the logic added in #5043 was just a heuristic, we adjust
the heuristic that in addition to requiring balanced pairs,
the first parenthesis must be an opening one.

For further robustness, we apply this heuristic to
parenthesis, braces, and brackets.

Fixes #22285

Change-Id: I23b728a644e35ce3995b05a79129cad2c1e3b1ce
Reviewed-on: https://go-review.googlesource.com/c/94876
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-12-14 00:41:25 +00:00
Ian Lance Taylor
a6293995c5 mime/multipart: quote boundary in Content-Type if necessary
Fixes #26532

Change-Id: Ic086c90503c7b24982f947c828c7ccf016ddbf69
Reviewed-on: https://go-review.googlesource.com/c/154120
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-13 23:58:06 +00:00
Evan Klitzke
784d810976 text/html: escape MIME type "application/ld+json" as JavaScript
Fixes #26053

Change-Id: Ic2052b1d0d4e0826a217a520c83d7bb0995ea72a
GitHub-Last-Rev: 5a3eea3dd2
GitHub-Pull-Request: golang/go#26054
Reviewed-on: https://go-review.googlesource.com/c/120835
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2018-12-13 22:45:02 +00:00
Ian Lance Taylor
c3b9a723bb fmt: include failing method name in panic message
Fixes #25707

Change-Id: Idfa379db8cc0e105ea68455ec0b4a0dbc1b3f485
Reviewed-on: https://go-review.googlesource.com/c/153827
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-13 22:41:52 +00:00
Robert Griesemer
9ce38f570f math: don't run huge argument tests on s390x
The s390x implementations for Sin/Cos/SinCos/Tan use assembly
routines which don't reduce arguments accurately enough for
huge inputs.

Fixes #29221.

Change-Id: I340f576899d67bb52a553c3ab22e6464172c936d
Reviewed-on: https://go-review.googlesource.com/c/154119
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-13 22:13:57 +00:00
Bryan C. Mills
35edc960c4 cmd/go/internal/work: skip TestRespectSetgidDir on js.
chown is not implemented on js: see https://build.golang.org/log/43d7b12602660b786a6e080e685165193df0de00.

Change-Id: I3f461338825bb670d682c3f47b17ee1638343fc8
Reviewed-on: https://go-review.googlesource.com/c/154097
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-13 21:13:12 +00:00
Than McIntosh
3331608c1c go/internal/gccgoimporter: test fix for older gccgo versions
Avoid running the test for issue 29198 if the available copy of gccgo
is too old (needs to support context package). Fixes a failure on the
solaris builder.

Updates #29198.

Change-Id: I2b1b3438f4ac105432f30078fbef78e24f2077cd
Reviewed-on: https://go-review.googlesource.com/c/153831
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-13 21:01:04 +00:00
Brian Kessler
02ad841dd8 math: correct mPi4 comment
The previous comment mis-stated the number of bits in mPi4.
The correct value is 19*64 + 1 == 1217 bits.

Change-Id: Ife971ff6936ce2d5b81ce663ce48044749d592a0
Reviewed-on: https://go-review.googlesource.com/c/154017
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-13 20:35:45 +00:00
Brad Fitzpatrick
d177e10d22 cmd/vendor: update vendored golang.org/x/sys/unix
To x/sys git rev 4d1cda033e0619309c606fc686de3adcf599539e

Fixes #29224

Change-Id: I696c815b4c2d26e8340c77cb77d1a37245c40ed2
Reviewed-on: https://go-review.googlesource.com/c/154117
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-13 20:23:50 +00:00
Brad Fitzpatrick
8fd53db4cf doc/go1.12: add note about CL 153559's syscall/js.Callback rename
Updates #28711

Change-Id: I03139a394fdf0540db07d6d1e38b3fa223b06d58
Reviewed-on: https://go-review.googlesource.com/c/154059
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-13 19:44:46 +00:00
dupoxy
57de1af78c bytes: add ReplaceAll example
Change-Id: I36cc0b68a5a47ac78982b05118c58723c9c6648c
GitHub-Last-Rev: 0704d95694
GitHub-Pull-Request: golang/go#29203
Reviewed-on: https://go-review.googlesource.com/c/153842
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-13 19:40:13 +00:00
Katie Hockman
01eb1d0459 doc: 1.12 release notes for regexp, runtime, and runtime/debug packages
Change-Id: I30686cbeda34f42d5b1848b884588a76a9fb28b9
Reviewed-on: https://go-review.googlesource.com/c/152741
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-12-13 19:30:29 +00:00
Bryan C. Mills
9c623f72c4 cmd/go: test 'go get' and 'go install' with an (invalid) module ending in /v1
We expect major version v1 to not have a /v1 suffix.
(Such a suffix on the package path is fine, but not on the module path.)

Fixes #26375

Change-Id: I4206ded82ede36440cedfaf39875c38b9c95dc27
Reviewed-on: https://go-review.googlesource.com/c/153823
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2018-12-13 18:48:02 +00:00
Richard Musiol
7d9649bf0d syscall/js: rename js.Callback to js.Func
The name "Callback" does not fit to all use cases of js.Callback.
This commit changes its name to Func. Accordingly NewCallback
gets renamed to FuncOf, which matches ValueOf and TypedArrayOf.

The package syscall/js is currently exempt from Go's compatibility
promise and js.Callback is already affected by a breaking change in
this release cycle. See #28711 for details.

Fixes #28711

Change-Id: I2c380970c3822bed6a3893909672c15d0cbe9da3
Reviewed-on: https://go-review.googlesource.com/c/153559
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-13 18:34:01 +00:00
Joel Sing
f95578cd5f runtime: correct signal structs/offsets for openbsd/arm
Update sigcontext and siginfo structs to match those currently in use by OpenBSD armv7.

Also correct the offset of the fault address field in the siginfo struct, which moved
due to the switch to EABI.

Change-Id: Icdd95222346239fcc04b95ae0fcefae09b7aa044
Reviewed-on: https://go-review.googlesource.com/c/154077
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-13 18:13:30 +00:00
Andrew Bonventre
b6e6870cdb doc/go1.12: add release notes for bufio and syscall packages
Change-Id: I5112be3b0f80ef1d9dad234b1f233e598465a409
Reviewed-on: https://go-review.googlesource.com/c/153824
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-13 17:19:49 +00:00
Elias Naur
9eb383e8f0 runtime,os,syscall,internal/poll: replace getdirentries on iOS
The getdirentries syscall is considered private API on iOS and is
rejected by the App Store submission checks. Replace it with the
fdopendir/readdir_r/closedir syscalls.

Fixes #28984

Change-Id: I73341b124310e9cb34834a95f946769f337ec5b7
Reviewed-on: https://go-review.googlesource.com/c/153338
Reviewed-by: Keith Randall <khr@golang.org>
2018-12-13 17:10:32 +00:00
Mark Pulford
571d93e977 cmd/go/internal/work: ensure correct group for TestRespectSetgidDir
mkdir(2) inherits the parent directory group on *BSD (including Darwin),
and it may inherit on other platforms if the parent directory is SetGID.

This can cause TestRespectSetgidDir SetGID to fail when the process does
not have have permission for the inherited group on the new temporary
directory.

Fixes #29160

Change-Id: Iac05511e501dfe307a753f801223b1049cc0947d
Reviewed-on: https://go-review.googlesource.com/c/153357
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-13 15:08:48 +00:00
Lynn Boger
5dc144c607 os/signal: increase wait time for signal delivery time in testcase
This increases the time to wait from 1 to 2 seconds in the
TestAtomicStop testcase. When running with gccgo on ppc64
& ppc64le on a loaded systems these testcases can
intermittently fail with the current value.

Updates #29046

Change-Id: If420274dd65926d933a3024903b5c757c300bd60
Reviewed-on: https://go-review.googlesource.com/c/153826
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-13 12:14:18 +00:00
Robert Griesemer
944a9c7a4f math: use constant rather than variable for exported test threshold
This is a minor follow-up on https://golang.org/cl/153059.

TBR=iant

Updates #6794.

Change-Id: I03657dafc572959d46a03f86bbeb280825bc969d
Reviewed-on: https://go-review.googlesource.com/c/153845
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-12-13 06:33:18 +00:00
Brian Kessler
98521a5a8f math: implement trignometric range reduction for huge arguments
This change implements Payne-Hanek range reduction by Pi/4
to properly calculate trigonometric functions of huge arguments.

The implementation is based on:

"ARGUMENT REDUCTION FOR HUGE ARGUMENTS: Good to the Last Bit"
K. C. Ng et al, March 24, 1992

The major difference with the reference is that the simulated
multi-precision calculation of x*B is implemented using 64-bit
integer arithmetic rather than floating point to ease extraction
of the relevant bits of 4/Pi.

The assembly implementations for 386 were removed since the trigonometric
instructions only use a 66-bit representation of Pi internally for
reduction.  It is not possible to use these instructions and maintain
accuracy without a prior accurate reduction in software as recommended
by Intel.

Fixes #6794

Change-Id: I31bf1369e0578891d738c5473447fe9b10560196
Reviewed-on: https://go-review.googlesource.com/c/153059
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-13 06:01:42 +00:00
Jordan Rhee
a728b0ba7c cmd/link: skip TestRuntimeTypeAttrInternal on windows/arm
Updates #26148

Change-Id: Ide1fe821cc061a08488df9d40878131f37f894c9
Reviewed-on: https://go-review.googlesource.com/c/153844
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-13 05:49:36 +00:00
Joel Sing
cc5fb5d93d cmd/vendor: update golang.org/x/sys/unix
Update golang.org/x/sys/unix to revision b05ddf57801d2239d6ab0ee35f9d981e0420f4ac.

Changes exist in upstream golang.org/x/sys/unix, which allow for code to work and
tests to pass on openbsd/arm.

Change-Id: Iecc8598681a23cb0466f94c914f0e605a6fc64d7
Reviewed-on: https://go-review.googlesource.com/c/153838
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-13 03:42:20 +00:00
Joel Sing
bbae8d5508 syscall: use correct cmsg alignment for openbsd/arm
The OpenBSD armv7 port requires 64-bit alignment for cmsgs.

Rework the cmsg alignment code to facilitate this.

Change-Id: I52cf55a8a4cda46c6ef35b0f694862b842028b42
Reviewed-on: https://go-review.googlesource.com/c/153837
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-13 00:47:37 +00:00
dupoxy
09da280157 strings: add ReplaceAll example
Change-Id: I6b0d470bdedb92844943c8e5823e214d6a7471cf
GitHub-Last-Rev: 4a135000ba
GitHub-Pull-Request: golang/go#29199
Reviewed-on: https://go-review.googlesource.com/c/153840
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-13 00:35:06 +00:00
Brad Fitzpatrick
e123ccbfe0 strings: revert accidental example change from CL 153840
Change-Id: I2ff29aa9909be3062fcd5f65af261f5d8c46fbc1
Reviewed-on: https://go-review.googlesource.com/c/153843
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-13 00:22:51 +00:00
Muhammad Falak R Wani
ab02028b5a go/build: document when Context.BuildTags is used.
Context.BuildTags is not set when you read go/build.Default.BuildTags.
It's only used by (*BuildTags).Import, etc.

Fixes: #27320

Change-Id: I97e5f1923c410b48f70be8c15938a7e04a178e3f
Reviewed-on: https://go-review.googlesource.com/c/131975
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-12 23:48:35 +00:00
Jordan Rhee
1ca84deeb0 runtime: pass LR to sigprof on windows/arm
TestCPUProfileLabel was failing on windows/arm because the link register
was not being passed to sigprof(). The link register is required to
generate a correct traceback. With this change, all tests in runtime.pprof
are now passing.

Updates #26148

Change-Id: Ia693b34278dc08a98023751ff1a922d9eee8fdd6
Reviewed-on: https://go-review.googlesource.com/c/153839
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-12 23:17:48 +00:00
Bryan C. Mills
862ba63823 cmd/go: reject GOCACHE=off when the default cache is initialized
Allow GOCACHE=off only for operations that never actually write
anything to the cache (in which case the GOCACHE setting should not
matter at all).

Fixes #29127

Change-Id: I733d02cd2fbcf3671f5adcfb73522865d131e360
Reviewed-on: https://go-review.googlesource.com/c/153462
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2018-12-12 23:10:30 +00:00
Than McIntosh
3ae2c6c52e go/internal/gccgoimporter: permit fixups for V2 export data
The changes added in https://golang.org/cl/151997 to fix problems when
reading older export data introduced the ability to add "fixups" to
handle references to a type whose definition has not yet been
finalized. It turns out we need to allow for fixups even for more
recent export data (V2 and V3); this patch removes a version guard for
the fixup generation logic.

Fixes #29198.

Change-Id: I82136ac45b53e4a59c05ff0879ac6bb545d0ff31
Reviewed-on: https://go-review.googlesource.com/c/153821
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-12 23:01:16 +00:00
Hana Kim
bf141a18c6 cmd/go/internal/web2: log http requests with -v
It's similar to what cmd/go/internal/web package does
when cfg.BuildV is set. The web2 package is what
cmd/go/internal/modfetch uses, so this change allows us
to trace web requests go get command in module mode
sends for modfetch.

Change-Id: If387efd8a8698c816bf267d1e6c6766fd357c298
Reviewed-on: https://go-review.googlesource.com/c/153640
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-12 22:33:24 +00:00
Andrew Bonventre
a35ddcc222 syscall: update doc comment to match behavior for Proc.Call
golang.org/cl/147117 increased the number of arguments permitted
by Proc.Call on Windows, but the doc comment was never updated.

Change-Id: Iea5eb9e0aafbc1025d5fcb8665d028b2254c183a
Reviewed-on: https://go-review.googlesource.com/c/153825
Reviewed-by: Channing Kimble-Brown <ckimblebrown@google.com>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-12-12 22:21:52 +00:00
Bryan C. Mills
561923fa7a cmd/go/internal/modfetch: skip symlinks in (*coderepo).Zip
Tested manually.

Before:

	$ go mod init golang.org/issue/scratch
	go: creating new go.mod: module golang.org/issue/scratch
	$ go1.11.2 mod download github.com/rogpeppe/test2@latest
	go: finding github.com/rogpeppe/test2 v0.0.11
	$ find $GOPATH -name goodbye
	/tmp/tmp.Y8a8UzX3zD/_gopath/pkg/mod/github.com/rogpeppe/test2@v0.0.11/tests/goodbye
	$ cat $(find $GOPATH -name goodbye)
	hello

After:

	$ go mod init golang.org/issue/scratch
	go: creating new go.mod: module golang.org/issue/scratch
	$ go mod download github.com/rogpeppe/test2@latest
	go: finding github.com/rogpeppe/test2 v0.0.11
	$ find $GOPATH -name goodbye
	$ find $GOPATH -name hello
	/tmp/tmp.Zo0jhfLaRs/_gopath/pkg/mod/github.com/rogpeppe/test2@v0.0.11/tests/hello

A proper regression test would require one of:
• a new entry in the vcs-test server (feasible but tedious, and not easily updated by open-source contributors), or
• a way to set up an HTTPS proxy in a script_test, or
• a way to explicitly populate the module cache from the contents of a local repository (#28835).

Fixes #27093
Updates #28835

Change-Id: I72702a7e791f8815965f0f87c82a30df4d6f0151
Reviewed-on: https://go-review.googlesource.com/c/153819
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2018-12-12 21:22:05 +00:00
Bryan C. Mills
c4a8a684da cmd/go: reproduce #28680
This change encodes the current behavior in mod_clean_cache.txt.
A fix for that behavior will probably have to wait for 1.13.

Updates #28680

Change-Id: I216b5a783971309cc75187502bddccc58c3a9c35
Reviewed-on: https://go-review.googlesource.com/c/153818
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2018-12-12 21:20:14 +00:00
Bryan C. Mills
cc8ae42a12 cmd/go: retain sums for replacement modules in 'go mod tidy'
Fixes #27868

Change-Id: I6c2d221c4325a2f44625e797a82735d812ee0ec1
Reviewed-on: https://go-review.googlesource.com/c/153817
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2018-12-12 21:19:54 +00:00
Keith Randall
05bbec7357 cmd/compile: don't combine load+op if the op has SymAddr arguments
By combining the load+op, we may force the op to happen earlier in
the store chain. That might force the SymAddr operation earlier, and
in particular earlier than its corresponding VarDef. That leads to
an invalid schedule, so avoid that.

This is kind of a hack to work around the issue presented. I think
the underlying problem, that LEAQ is not directly ordered with respect
to its vardef, is the real problem. The benefit of this CL is that
it fixes the immediate issue, is small, and obviously won't break
anything. A real fix for this issue is much more invasive.

The go binary is unchanged in size.
This situation just doesn't occur very often.

Fixes #28445

Change-Id: I13a765e13f075d5b6808a355ef3c43cdd7cd47b6
Reviewed-on: https://go-review.googlesource.com/c/153641
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-12-12 21:13:15 +00:00
Julie Qiu
d1882c9866 doc/go1.12: release notes for testing
Change-Id: I81ffe7ee88354efeabb24f091db66c7c4892876c
Reviewed-on: https://go-review.googlesource.com/c/152919
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-12-12 19:33:05 +00:00
Julie Qiu
9a11b73635 cmd/go: link to the FAQ for errors that indicate private VCS repos.
Updates #25982

Change-Id: I5a284e3844e944f9bfae31fa65b242060d4139c7
Reviewed-on: https://go-review.googlesource.com/c/150777
Run-TryBot: Julie Qiu <julie@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-12 15:00:01 +00:00
Leigh McCulloch
d70b0ece2f encoding/xml, encoding/json: docs and examples using custom marshalers
Both the encoding/xml and encoding/json packages support custom
marshalers for JSON and XML, as well as the basic encoding.TextMarshaler
and encoding.TextUnmarshaler interfaces, but the docs and examples for
these are missing.

There are docs for how to use encoding.TextMarshaler and
encoding.TextUnmarshaler in encoding/json, but not encoding/xml. There
are no examples for how to use them with either json or xml. This commit
includes docs for encoding/xml and examples for both encoding/json and
encoding/xml.

There is an example using custom marshalers MarshalJSON and
UnmarshalJSON in encoding/json, but not MarshalXML and UnmarshalXML in
encoding/json. These docs are more so necessary for encoding/xml because
the complexities of XML documents is significantly greater than JSON
documents which more often leads to the need for custom marshaling. The
encoding/json package includes an example of how to write a custom
marshaler, and this commit includes the same example for the xml
package.

All examples are mirrored off the existing custom marshaler example in
encoding/json.

Fixes #6859

Change-Id: Ic93abc27c0b4d5e48dea6ede4e20b1bedca4ab39
Reviewed-on: https://go-review.googlesource.com/c/76350
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-12 14:18:06 +00:00
David Chase
321a3d6e85 cmd/compile: Avoid and filter out zero-length location-lists.
This change avoids creating zero length location lists by
repairing an overly aggressive change in CL146718
and by explicitly checking for and filtering out any
zero-length lists that are detected (building
compiler+runtime creates a single one).

Updates #28486.

Change-Id: I01c571fee2376474c7f3038e801bd58fd9e0b820
Reviewed-on: https://go-review.googlesource.com/c/150097
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2018-12-12 12:36:08 +00:00
Robert Griesemer
41d0dc49d2 go/format: add simple benchmark framework and basic benchmark
For now, this CL adds as a first benchmark the formatting of
a 10,000 element array literal. It is easy to add additional
test cases as we see fit.

	name                   time/op
	Format/array1-10000-4    26.7ms ± 7%

	name                   speed
	Format/array1-10000-4  2.43MB/s ± 6%

	name                   alloc/op
	Format/array1-10000-4    5.52MB ± 0%

	name                   allocs/op
	Format/array1-10000-4      119k ± 0%

Updates #26528.

Change-Id: Ic8ec8f70160d122b877740412d4d4406f5f4b345
Reviewed-on: https://go-review.googlesource.com/c/153642
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-12 03:52:58 +00:00
Joel Sing
ef780fbf10 runtime/pprof: ignore cpu profile test failures on openbsd/arm
This test is currently too flakey on openbsd/arm - ignore failures for the time
being.

Change-Id: Ia334d188f505167e691177ebe2c7a2df54bf556a
Reviewed-on: https://go-review.googlesource.com/c/153579
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2018-12-12 02:36:44 +00:00