1
0
mirror of https://github.com/golang/go synced 2024-11-14 08:40:27 -07:00
Commit Graph

34930 Commits

Author SHA1 Message Date
Lynn Boger
12e2933bbe cmd/dist: return dropped tests from misc/cgo/test
In a previous change to cmd/dist/test.go to fix some pie
testcases, a few other tests were incorrectly dropped.
This returns the testcases that shouldn't have been removed.

Fixes #22708

Change-Id: I2f735f4fd3a378f0f45d12a99768638aeb4787c7
Reviewed-on: https://go-review.googlesource.com/77650
Run-TryBot: Russ Cox <rsc@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-18 00:33:04 +00:00
Keith Randall
b868616b63 cmd/cgo: special case C ptr types to use uintptr
Some C types are declared as pointers, but C code
stores non-pointers in them.  When the Go garbage
collector sees such a pointer, it gets unhappy.

Instead, for these types represent them on the Go
side with uintptr.

We need this change to handle Apple's CoreFoundation
CF*Ref types. Users of these types might need to
update their code like we do in root_cgo_darwin.go.
The only change that is required under normal
circumstances is converting some nils to 0.
A go fix module is provided to help.

Fixes #21897

RELNOTE=yes

Change-Id: I9716cfb255dc918792625f42952aa171cd31ec1b
Reviewed-on: https://go-review.googlesource.com/66332
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-17 22:11:03 +00:00
Michael Munday
644787c337 cmd/compile: delete temporary files when test finishes
I noticed some files prefixed with ssa_fg_tmp in the /tmp folder of
the s390x builder. runGenTest (a helper for TestGenFlowGraph) wasn't
deleting its temporary files. The distinct prefix made this easy to
figure out.

Change-Id: If0d608aaad04a414e74e29f027ec9443c626e4eb
Reviewed-on: https://go-review.googlesource.com/78475
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-17 21:35:43 +00:00
isharipo
4e19cfcdf2 cmd/internal/obj/x86: add AVX2 gather and VSIB
Enables AVX2 gather instructions and VSIB support,
which makes vm32{x,y} vm64{x,y} operands encodable.

AXXX constants placed with respect to sorting order.
New VEX optabs inserted near non-VEX entries to simplify
potential transition to auto-generated VSIB optabs.

Tests go into new AMD64 encoder test file (amd64enc_extra.s)
to avoid unnecessary interactions with auto-generated "amd64enc.s".

Side note: x86avxgen did not produced these instructions
because x86.v0.2.csv misses them.
This also explains why x86 test suite have no AVX2 gather
instructions tests.

List of new instructions:
  VGATHERPDP
  VGATHERDPS
  VGATHERQPD
  VGATHERQPS
  VPGATHERDD
  VPGATHERDQ
  VPGATHERQD
  VPGATHERQQ

Change-Id: Iac852f3c5016523670bd99de6bec6a48f66fb4f6
Reviewed-on: https://go-review.googlesource.com/77970
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
2017-11-17 21:17:58 +00:00
Adam Langley
3a395e2283 crypto/x509: always emit a critical SAN extension if the Subject is empty.
The RFC is a little ambiguous here: “the subject field contains an empty
sequence” could mean that it's a non-empty sequence where one of the
sets contains an empty sequence. But, in context, I think it means “the
subject field is an empty sequence”.

Fixes #22249

Change-Id: Idfe1592411573f6e871b5fb997e7d545597a0937
Reviewed-on: https://go-review.googlesource.com/70852
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-17 19:00:41 +00:00
Adam Langley
2f1de1593e crypto/x509: relax EKU checking in some cases.
CL 71030 enforced EKU nesting at verification time, to go along with the
change in name constraints behaviour. From scanning the Certificate
Transparency logs, it's clear that some CAs are not getting EKU nesting
correct.

This change relaxes the EKU rules in a few ways:
  ∙ EKUs in roots are no longer checked.
  ∙ Any CA certificate may issue OCSP responder certificates.
  ∙ The ServerAuth and SGC EKUs are treated as a single EKU when
    checking nesting.
  ∙ ServerAuth in a CA can now authorise ClientAuth.
  ∙ The generic CodeSigning EKU can now authorise two, Microsoft-specific
    code-signing EKUs.

Change-Id: I7b7ac787709af0dcd177fe419ec2e485b8d85540
Reviewed-on: https://go-review.googlesource.com/77330
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-17 18:52:45 +00:00
Adam Langley
5a22637cf7 crypto/x509: don't fail to parse addition elements in GeneralSubtree.
The GeneralSubtree structure can have additional elements after the name
(minimum and maximum, which are unused). Previously these fields, if
present, would cause a parse error. This change allows trailing data in
the GeneralSubtrees structure.

Change-Id: I6bfb11ec355fa6812810a090c092a5ee0fdeddc3
Reviewed-on: https://go-review.googlesource.com/77333
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-17 18:52:31 +00:00
Brad Fitzpatrick
ac8a70d209 Revert "net: Forget lookups for canceled contexts"
This reverts commit 6a3d4be3b8.

Reason for revert: breaks various builds. See comments on CL 77670

Change-Id: Iaf3260319b560f49ace06af705a2114630f32063
Reviewed-on: https://go-review.googlesource.com/78515
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-17 17:14:02 +00:00
David Chase
d2414cefba cmd/compile: leave Pos unset for racewalk enter/exit
The locations chosen for racewalking inserted code can
be wrong and thus cause unwanted next/step behavior in
debuggers.  Forcing the positions to be unset results in
better behavior.

Test added, and test harness corrected to deal with
changes to gdb's output caused by -racewalk.

Incidental changes in Delve (not part of the usual testing,
but provided because we care about Delve) also reflected
in this CL.

Fixes #22600.

Change-Id: Idd0218afed52ab8c68efd9eabbdff3c92ea2b996
Reviewed-on: https://go-review.googlesource.com/78336
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2017-11-17 16:56:42 +00:00
Bill O'Farrell
c2efb2fde5 cmd/link: enable c-shared and c-archive mode on s390x
Adding s390x to the list of architectures that support c-shared and c-archive.
Required adding load-time initialization (via _rt0_s390x_linux_lib) and adding s390x
to the c-shared and c-archive tests.

Change-Id: I75883b2891c310fe8ce7f08c27b06895c074e123
Reviewed-on: https://go-review.googlesource.com/74910
Reviewed-by: Michael Munday <mike.munday@ibm.com>
2017-11-17 15:54:54 +00:00
Austin Clements
bf9ad7080d runtime: remove another TODO
I experimented with having the compiler spill the two registers that
are clobbered by the write barrier fast path, but it slightly slows
down compilebench, which is a good write barrier benchmark:

name       old time/op     new time/op     delta
Template       175ms ± 0%      176ms ± 1%    ~           (p=0.393 n=10+10)
Unicode       83.6ms ± 1%     85.1ms ± 2%  +1.79%         (p=0.000 n=9+10)
GoTypes        585ms ± 0%      588ms ± 1%    ~            (p=0.173 n=8+10)
Compiler       2.78s ± 1%      2.81s ± 2%  +0.81%        (p=0.023 n=10+10)
SSA            7.11s ± 1%      7.15s ± 1%  +0.59%        (p=0.029 n=10+10)
Flate          115ms ± 1%      116ms ± 2%    ~           (p=0.853 n=10+10)
GoParser       144ms ± 2%      145ms ± 2%    ~           (p=1.000 n=10+10)
Reflect        389ms ± 1%      390ms ± 1%    ~           (p=0.481 n=10+10)
Tar            185ms ± 2%      185ms ± 2%    ~           (p=0.529 n=10+10)
XML            205ms ± 0%      207ms ± 2%    ~            (p=0.065 n=9+10)

Since this didn't pan out, remove the TODO.

Change-Id: I2186942c6d1ba10585a5da03cd7c1d26ce906273
Reviewed-on: https://go-review.googlesource.com/78034
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2017-11-17 01:00:05 +00:00
Austin Clements
366f46fe00 runtime: remove TODO
I experimented with changing the write barrier to take the value in SI
rather than AX to improve register allocation. It had no effect on
performance and only made the "hello world" text 0.07% smaller, so
let's just remove the comment.

Change-Id: I6a261d14139b7a02a8467b31e74951dfb927ffb4
Reviewed-on: https://go-review.googlesource.com/78033
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2017-11-17 00:59:52 +00:00
Daniel Theophanes
b44b2feb91 database/sql: allow OpenConnector in a driver.Driver interface
While driver.Connector was previously added to allow non-string
connection arguments and access to the context, most users of
the sql package will continue to rely on a string DSN.

Allow drivers to implement a string DSN to Connector interface
that both allows a single parsing of the string DSN and uses
the Connector interface which passes available context to
the driver dialer.

Fixes #22713

Change-Id: Ia0b862262f4c4670effe2538d0d6d43733fea18d
Reviewed-on: https://go-review.googlesource.com/77550
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2017-11-16 22:36:07 +00:00
Russ Cox
096b195df5 cmd/go: add import config debugging flag
Change-Id: I11d83c8841f3de4ed4d9d014dec65d6f20464b11
Reviewed-on: https://go-review.googlesource.com/78396
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-11-16 21:10:47 +00:00
Russ Cox
71b0264a38 cmd/go: simplify compiler import config preparation
I realized this simplification was possible when writing the vet loop
(just above the code being modified here) but never circled back
to make the compiler loop match.

Change-Id: Ic2277d2a4b6d94ea4897cc3615fc1a29f2fb243c
Reviewed-on: https://go-review.googlesource.com/78395
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-11-16 21:10:25 +00:00
Brad Fitzpatrick
7edb721fbc os/user: handle large 32-bit uid/gid values when stringifying User.Uid/Gid
Fixes #22739

Change-Id: I374c29d237c498c9e5ac848b01f6d49d7c41b31f
Reviewed-on: https://go-review.googlesource.com/77930
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 18:42:02 +00:00
Russ Cox
92c3582471 cmd/go/internal/work: do not write trivial.c when testing gcc flags
CL 61111 disabled the writing of trivial.c in -n mode, which
made -n mode at least inconsistent with regular mode in
how it was testing for flags. We think that both were getting
the same answer, so avoid creating the file in both modes
to make sure.

If this CL turns out to be wrong, then when we revert it we
should make sure that the empty file is written even in -n mode,
because this check affects the command-line flags printed
by other commands in that mode.

Change-Id: I0a050bfc148fe5a9d430a153d7816b2821277f0d
Reviewed-on: https://go-review.googlesource.com/78115
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 17:34:32 +00:00
Russ Cox
62dc3c3f0d cmd/go: fix swig support and run swig tests during run.bash
(The tests only run when swig is already installed on the local system.)

Change-Id: I172d106a68cfc746a1058f5a4bcf6761bab88912
Reviewed-on: https://go-review.googlesource.com/78175
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 17:19:19 +00:00
Russ Cox
7cddd39f96 cmd/go: drop flaky part of TestGoTestJSON
Still failing on builders. I give up.
(For example https://build.golang.org/log/4fa5ba031c2fab5df397ac894f8b81392a93728e.)

Change-Id: Ifa87813e27e1adfe9920c7e657b0ff129eb5bf2f
Reviewed-on: https://go-review.googlesource.com/78315
Reviewed-by: Russ Cox <rsc@golang.org>
2017-11-16 16:59:15 +00:00
Russ Cox
8e28a8d2a0 cmd/go: fix cgo-disabled test failure from CL 77151
Change-Id: I8ed4c6dd32a74d94565d77771bb773f006ff90ac
Reviewed-on: https://go-review.googlesource.com/78317
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-11-16 16:58:13 +00:00
Joe Tsai
ba2835db6c archive/tar: partially revert sparse file support
This CL removes the following APIs:
	type SparseEntry struct{ ... }
	type Header struct{ SparseHoles []SparseEntry; ... }
	func (*Header) DetectSparseHoles(f *os.File) error
	func (*Header) PunchSparseHoles(f *os.File) error
	func (*Reader) WriteTo(io.Writer) (int, error)
	func (*Writer) ReadFrom(io.Reader) (int, error)

This API was added during the Go1.10 dev cycle, and are safe to remove.

The rationale for reverting is because Header.DetectSparseHoles and
Header.PunchSparseHoles are functionality that probably better belongs in
the os package itself.

The other API like Header.SparseHoles, Reader.WriteTo, and Writer.ReadFrom
perform no OS specific logic and only perform the actual business logic of
reading and writing sparse archives. Since we do know know what the API added to
package os may look like, we preemptively revert these non-OS specific changes
as well by simply commenting them out.

Updates #13548
Updates #22735

Change-Id: I77842acd39a43de63e5c754bfa1c26cc24687b70
Reviewed-on: https://go-review.googlesource.com/78030
Reviewed-by: Russ Cox <rsc@golang.org>
2017-11-16 16:54:08 +00:00
Russ Cox
ca886e0673 cmd/go/internal/cache: fix build failure introduced in CL 78176
Maybe a bad git merge - not sure.
In any event, I do miss the trybots.

Noticed while fixing: change print-to-stderr+panic
to pure panic, just so that the test (which catches the panic)
does not print any errors before passing.

Change-Id: If25153ea64e81066455401110ae7a79c36f2f712
Reviewed-on: https://go-review.googlesource.com/78316
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-11-16 16:54:03 +00:00
Russ Cox
d06335e28f cmd/go: implement go clean -testcache
Ian suggested that since test caching is not expected to be perfect
in all cases, we should allow users to clear the test cache separately
from clearing the entire build cache.

This CL adds 'go clean -testcache' to do that. The implementation
does not actually delete files (for that, use 'go clean -cache').
Instead, it writes down the current time, and future go tests will
ignore any cached test results written before that time.

Change-Id: I4f84065d7dfc2499fa3f203e9ab62e68d7f367c5
Reviewed-on: https://go-review.googlesource.com/78176
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 16:37:16 +00:00
Russ Cox
5a7fd40399 cmd/go: run cover before cgo
If we're running coverage on a package using cgo, we need to
apply both cmd/cover and cmd/cgo as source transformers.
To date we've applied cgo, then cover.

Cover is very sensitive to the exact character position of
expressions in its input, though, and cgo is not, so swap
them, applying first cover and then cgo.

The only drawback here is that coverage formerly applied
to SWIG-generated cgo files, and now it does not.
I am not convinced anyone depended critically on that,
and probably the later analysis with go tool cover would
have tried to parse the original .swig file as a Go file and
gotten very confused.

Fixes #8726.
Fixes #9212.
Fixes #9479.

Change-Id: I777c8b64f7726cb117d59e03073954abc6dfa34d
Reviewed-on: https://go-review.googlesource.com/77155
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 16:34:35 +00:00
Russ Cox
8c47aa155f cmd/go: make file:line for cgo files look like non-cgo files
Passing the absolute path to cgo puts the absolute path in the
generated file's //line directives, which then shows that path
in the compiler output, which the go command can then
make relative to the current directory, same as it does for
other compiler output.

Change-Id: Ia2064fea40078c46fd97e3a3b8c9fa1488f913e3
Reviewed-on: https://go-review.googlesource.com/77154
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 16:33:15 +00:00
Russ Cox
85c3ebf4dd cmd/cgo: modify source as text, not as AST
Cgo has always operated by rewriting the AST and invoking go/printer.
This CL converts it to use the AST to make decisions but then apply
its edits directly to the underlying source text. This approach worked
better in rsc.io/grind (used during the C to Go conversion) and also
more recently in cmd/cover. It guarantees that all comments and
line numbers are preserved exactly.

This eliminates a lot of special concern about comments and
problems with cgo not preserving meaningful comments.
Combined with the CL changing cmd/cover to use the same
approach, it means that the combination of applying cgo and
applying cover still guarantees all comments and line numbers
are preserved exactly.

This sets us up to fix some cgo vs cover bugs by swapping
the order in which they run during the go command.

This also sets up #16623 a bit: the edit list being
accumulated here is nearly exactly what you'd want
to pass to the compiler for that issue.

Change-Id: I7611815be22e7c5c0d4fc3fa11832c42b32c4eb3
Reviewed-on: https://go-review.googlesource.com/77153
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 16:33:06 +00:00
Russ Cox
1d47a14591 encoding/csv: restore Go 1.9 quoted \r\n handling in Reader
CL 52810 changed Reader to interpret a quoted \r\n as a raw \r\n
when reading fields. This seems likely to break existing users, and
discussion on both #21201 (the original issue that triggered the change)
and #22746 (discussing whether to revert the change) failed to identify
a single motivating example for this change. To avoid breaking existing
users for no clear reason, revert the change.

The Reader has been rewritten in the interim so this is not a git revert
but instead and adjustment (and slight simplification) of the new Reader.

Fixes #22746.

Change-Id: Ie857b2f4b1359a207d085b6d3c3a6d440a997d12
Reviewed-on: https://go-review.googlesource.com/78295
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2017-11-16 16:29:37 +00:00
Russ Cox
918b98ca70 cmd/internal/obj, cmd/trace: restore bounds checks dropped in CL 56950
CL 56950 correctly identified code with checks that were impossible.
But instead of correcting the checks it deleted them.
This CL corrects the code to check what was meant.

Change-Id: Ic89222184ee4fa5cacccae12d750601a9438ac8d
Reviewed-on: https://go-review.googlesource.com/78113
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 16:29:08 +00:00
Ian Lance Taylor
da21113b0c cmd/go: add dependencies for implicit SWIG imports
This fixes the misc/swig tests.

Change-Id: I60c87bbd361fe8b4f69e4507b25dc99a226da3d7
Reviewed-on: https://go-review.googlesource.com/76610
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-11-16 16:27:13 +00:00
Russ Cox
d9a198c7d0 Revert "math/rand: make Perm match Shuffle"
This reverts CL 55972.

Reason for revert: this changes Perm's behavior unnecessarily.
I asked for this change originally but I now regret it.
Reverting so that I don't have to justify it in Go 1.10 release notes.

Edited to keep the change to rand_test.go, which seems to have
been mostly unrelated.

Fixes #22744.

Change-Id: If8bb1bcde3ced0db2fdcd0aa65ab128613686c66
Reviewed-on: https://go-review.googlesource.com/78195
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 16:24:30 +00:00
Russ Cox
02298ae11a Revert "time: enable ZONEINFO tzdata file support and error reporting"
This reverts commit 630d176e7d.

Reason for revert: the CL moves a parser for what appears to be an
Android-specific file format into the main code and makes it available
on all platforms. Android-specific file formats should be limited to
Android.

Change-Id: I3f19fe03673d65ed1446a0dcf95e5986053e10c0
Reviewed-on: https://go-review.googlesource.com/77950
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-16 14:58:12 +00:00
Than McIntosh
c09ee9d1ce cmd/compile: fix buglet/typo in DWARF x86 setup
Fix typo in DWARF register config for GOOARCH=x86; was
picking up the AMD64 set, should have been selecting
x86 set.

Change-Id: I9a4c6f1378baf3cb2f0ad8d60f3ee2f24cd5dc91
Reviewed-on: https://go-review.googlesource.com/77990
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2017-11-16 13:32:24 +00:00
Russ Cox
7781fed24e io: eliminate full copy of copy loop in CopyN
CL 60630 claimed to and did “improve performance of CopyN”
but in doing so introduced a second copy of the I/O copying loop.
This code is subtle and easy to get wrong and the last thing we
need is of two copies that can drift out of sync. Even the newly
introduced copy contains various subtle changes that are not
obviously semantically equivalent to the original. (They probably
are, but it's not obvious.)

Although the CL description does not explain further what the
important optimization was, it appears that the most critical
one was not allocating a 32kB buffer for CopyN(w, r, 512).

This CL deletes the forked copy of copy and instead applies
the buffer size restriction optimization directly to copy itself.

CL 60630 reported:

name          old time/op    new time/op    delta
CopyNSmall-4    5.09µs ± 1%    2.25µs ±86%  -55.91%  (p=0.000 n=11+14)
CopyNLarge-4     114µs ±73%     121µs ±72%     ~     (p=0.701 n=14+14)

Starting with that CL as the baseline, this CL does not change a ton:

name          old time/op  new time/op  delta
CopyNSmall-8   370ns ± 1%   411ns ± 1%  +11.18%  (p=0.000 n=16+14)
CopyNLarge-8  18.2µs ± 1%  18.3µs ± 1%   +0.63%  (p=0.000 n=19+20)

It does give up a small amount of the win of 60630 but preserves
the bulk of it, with the benefit that we will not need to debug these
two copies drifting out of sync in the future.

Change-Id: I05b1a5a7115390c5867847cba606b75d513eb2e2
Reviewed-on: https://go-review.googlesource.com/78122
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2017-11-16 02:24:37 +00:00
Russ Cox
08270c3e18 cmd/cover: do not report coverage for assembly functions
cover -func mode was reporting a coverage for function
declarations without bodies - assembly functions.
Since we are not annotating their code, we have no data
for those functions and should not report them at all.

Fixes #6880.

Change-Id: I4b8cd90805accf61f54e3ee167f54f4dc10c7c59
Reviewed-on: https://go-review.googlesource.com/77152
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 01:41:51 +00:00
Russ Cox
2a39d1e96a cmd/cover: add //line comment pointing to original file
Now that cover does not modify the formatting of the original file
or add any newline characters, we can make it print a //line comment
pointing back at the original, and compiler errors and panics will
report accurate line numbers.

Fixes #6329.
Fixes #15757.

Change-Id: I7b0e386112c69beafe69e0d47c5f9e9abc87c0f5
Reviewed-on: https://go-review.googlesource.com/77151
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-16 01:41:30 +00:00
Joe Kyo
a8474c799f archive/zip: add documentation about compression methods
Change-Id: I491c5ddd1a5d8e55f8e6bb9377bc3811e42773f8
Reviewed-on: https://go-review.googlesource.com/77870
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-16 01:31:52 +00:00
Russ Cox
c2eb9454a9 cmd/go: deflake TestGoTestJSON further
Even after disabling on 1-CPU systems, builders are still flaking too often.
Unless there are at least 4 CPUs, don't require test interlacing at all.

Fixes #22665 (again).

Change-Id: Ief792c496c1ee70939532e6ca8bef012fe78178e
Reviewed-on: https://go-review.googlesource.com/77310
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2017-11-16 01:26:20 +00:00
Russ Cox
b9ebc675b3 database/sql/driver: document that Execer, Queryer need not be implemented
CL 21663 allowed drivers to implement ExecerContext without
also implementing Execer, and similarly QueryerContext without
Queryer, but it did not make that clear in the documentation.

This CL updates the documentation.

Change-Id: I9a4accaac32edfe255fe7c0b0907d4c1014322b4
Reviewed-on: https://go-review.googlesource.com/78129
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2017-11-16 01:17:13 +00:00
Russ Cox
d0ce197c58 encoding/hex: make Decode, Decoder, DecodeString agree about partial results and errors
CL 70210 added Decoder for #21590, and in doing so it changed
the existing func Decode to return partial results for decoding errors.
That seems like a good change to make to Decode, but it was
untested (except as used by Decoder), inconsistent with DecodeString
in all error cases, and inconsistent with Decoder in not returning
partial results for odd-length input strings.

This CL makes Decode, DecodeString, and Decoder all agree about
the handling of partial results (they are returned) and error
precedence (the error earliest in the input is reported),
and it documents and tests this.

Change-Id: Ifb7d1e100ecb66fe2ed5ba34a621084d480f16db
Reviewed-on: https://go-review.googlesource.com/78120
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-16 01:08:20 +00:00
Russ Cox
734487c929 cmd/vet: shorten diagnostic about suspicious struct tag spaces
Change-Id: I112d0164df6abd9ca1df287376cf3605268385df
Reviewed-on: https://go-review.googlesource.com/78116
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-16 01:07:39 +00:00
Kevin Burke
c8691f3ac1 crypto/cipher: use raw bytes for keys in docs
Using ASCII values for keys is a bad idea since it makes them vastly
easier to guess. Instead, use the same method as the examples in the
golang.org/x/crypto/nacl package to load keys from a hex value.

Changing the key required updating the ciphertext in many of the
examples.

I am still worried about the fact the examples ask the user to
authenticate messages; authentication isn't trivial, and to be honest
it may be better to steer people to a higher level primitive like
secretbox, unless people really need AES.

Fixes #21012.

Change-Id: I8d918cf194694cd380b06c2d561178167ca61adb
Reviewed-on: https://go-review.googlesource.com/48596
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-16 00:40:00 +00:00
Hiroshi Ioka
c32626a4ce encoding/asn1: add MarshalWithParams
Fixes #18873

Change-Id: Idb9750f739f91ebca34efcbc177254d412b4d90d
Reviewed-on: https://go-review.googlesource.com/44111
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-11-16 00:37:47 +00:00
Troels Thomsen
6a3d4be3b8 net: Forget lookups for canceled contexts
A sequential lookup using any non-canceled context has a risk of
returning the result of the previous lookup for a canceled context (i.e.
an error).

This is already prevented for timed out context by forgetting the host
immediately and extending this to also compare the error to
`context.Canceled` resolves this issue.

Fixes #22724

Change-Id: I7aafa1459a0de4dc5c4332988fbea23cbf4dba07
Reviewed-on: https://go-review.googlesource.com/77670
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-15 22:34:55 +00:00
Russ Cox
3a181dc7bc archive/zip: fix handling of replacement rune in UTF8 check
The replacement rune is a valid rune and can appear as itself in valid UTF8
(it encodes as three bytes). To check for invalid UTF8 it is necessary to
look for utf8.DecodeRune returning the replacement rune and size==1.

Change-Id: I169be8d1fe61605c921ac13cc2fde94f80f3463c
Reviewed-on: https://go-review.googlesource.com/78126
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2017-11-15 21:30:30 +00:00
Russ Cox
7de9e5e199 api: update next.txt
Change-Id: I540bdabe8ffda4697315fa6f09ad710c05b4a94d
Reviewed-on: https://go-review.googlesource.com/78134
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-15 21:29:55 +00:00
Russ Cox
b9dca1b165 database/sql: fix ctx.Done() == nil check
ctx.Done() == ctx.Background().Done() is just
a long way to write ctx.Done() == nil.
Use the short way.

Change-Id: I7b3198b5dc46b8b40086243aa61882bc8c268eac
Reviewed-on: https://go-review.googlesource.com/78128
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-15 21:28:27 +00:00
Russ Cox
442d15abc3 database/sql/driver: rename ResetSessioner to SessionResetter
Originally we tried the strict -er suffix as the rule in this case
but eventually we decided it was too awkward: io.WriteByter
became io.ByteWriter. By analogy, here the interface should be
named SessionResetter instead of the awkward ResetSessioner.

This change should not affect any drivers that have already
implemented the interface, because the method name is not changing.

(This was added during the Go 1.10 cycle and has not been
released yet, so we can change it.)

Change-Id: Ie50e4e090d3811f85965da9da37d966e9f45e79d
Reviewed-on: https://go-review.googlesource.com/78127
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2017-11-15 21:28:18 +00:00
Russ Cox
cac334cc5f net/mail: clarify doc comment
Rewrite the text added in CL 50911, which I did not understand.

Change-Id: Id6271ffe2f7c8833dd7733fe0254fa4927fac150
Reviewed-on: https://go-review.googlesource.com/78124
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-15 21:27:54 +00:00
Russ Cox
e671a552fe io: document and test MultiWriter error behavior
MultiWriter(w1, w2) only writes to w2 if w1.Write succeeds.
I did not know this, and it was not documented.
Document and test.

Change-Id: Idec2e8444d5a7aca0b95d07814a28daa454eb1d3
Reviewed-on: https://go-review.googlesource.com/78123
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-15 21:27:42 +00:00
Russ Cox
894869e150 encoding/xml: move unexported const out of exported const block
CL 58210 introduced this constant for reasons I don't understand.
It should not be in the exported const block, which will pollute
godoc output with a "... unexported" notice.

Also since we already have a constant named xmlnsPrefix for "xmlns",
it is very confusing to also have xmlNamespacePrefix for "xml".
If we must have the constant at all, rename it to xmlPrefix.

Change-Id: I15f937454d730005816fcd32b1acca703acf1e51
Reviewed-on: https://go-review.googlesource.com/78121
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-15 21:27:07 +00:00