]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
5 years agonet: skip flaky TestNotTemporaryRead on FreeBSD go1.11beta3
Brad Fitzpatrick [Fri, 3 Aug 2018 16:58:07 +0000 (16:58 +0000)]
net: skip flaky TestNotTemporaryRead on FreeBSD

Updates #25289

Change-Id: I662760b921be625aca988cd0b43c648ac5dfd814
Reviewed-on: https://go-review.googlesource.com/127837
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/internal/obj/arm64: fix incorrect rejection of legal instructions
Ben Shi [Wed, 1 Aug 2018 06:38:54 +0000 (06:38 +0000)]
cmd/internal/obj/arm64: fix incorrect rejection of legal instructions

"BFI $0, R1, $7, R2" is expected to copy bit 0~6 from R1 to R2, and
left R2's other bits unchanged.

But the assembler rejects it with error "illegal bit number", and
BFIW/SBFIZ/SBFIZW/UBFIZ/UBFIZW have the same problem.

This CL fixes that issue and adds corresponding test cases.

fixes #26736

Change-Id: Ie0090a0faa38a49dd9b096a0f435987849800b76
Reviewed-on: https://go-review.googlesource.com/127159
Run-TryBot: Ben Shi <powerman1st@163.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/go/internal/load: trim the " (test)" suffix from ImportStack paths
Bryan C. Mills [Fri, 3 Aug 2018 14:38:22 +0000 (10:38 -0400)]
cmd/go/internal/load: trim the " (test)" suffix from ImportStack paths

We were passing untrimmed paths to ModPackageModuleInfo, which was then failing
the build because it was asked to resolve an invalid path.

Fixes #26722

Change-Id: I043cc9c26f2188c5e005c0353620d9c55b339df9
Reviewed-on: https://go-review.googlesource.com/127795
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: disable ccache when setting HOME to non-existent dir
Mark Pulford [Fri, 3 Aug 2018 14:19:21 +0000 (00:19 +1000)]
cmd/go: disable ccache when setting HOME to non-existent dir

This fixes tests on systems where ccache is the default compiler.

Also simplify a prior workaround for this fault.

Fixed #26789

Change-Id: I031ff0b65ace7fc5e284393298e004aa2ad3b6f5
Reviewed-on: https://go-review.googlesource.com/127775
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agonet: update docs for unimplemented methods and functions
Mikio Hara [Fri, 3 Aug 2018 08:44:00 +0000 (17:44 +0900)]
net: update docs for unimplemented methods and functions

Change-Id: I54e651a952afa8928cc0204ba37092d3b2347266
Reviewed-on: https://go-review.googlesource.com/127737
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agodatabase/sql: fix driverStmt.Close() comment typo
Frédéric Guillot [Wed, 25 Jul 2018 23:36:11 +0000 (16:36 -0700)]
database/sql: fix driverStmt.Close() comment typo

Change-Id: I2256c850e071882b00c362da03abc8b021c1ec2a
Reviewed-on: https://go-review.googlesource.com/126015
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agomath: add tests for erf and erfc
Keith Randall [Tue, 24 Jul 2018 16:59:57 +0000 (09:59 -0700)]
math: add tests for erf and erfc

Test large but not infinite arguments.

This CL adds a test which breaks s390x.  Don't submit until
a fix for that is figured out.

Update #26477

Change-Id: Ic86739fe3554e87d7f8e15482875c198fcf1d59c
Reviewed-on: https://go-review.googlesource.com/125641
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: revert "cmd/go: no longer eval symlinks in inDir"
Ian Lance Taylor [Fri, 3 Aug 2018 01:16:39 +0000 (18:16 -0700)]
cmd/go: revert "cmd/go: no longer eval symlinks in inDir"

It breaks on the Darwin builders, with

--- FAIL: TestTestCacheInputs (21.65s)
    go_test.go:5371: file.txt: old=2018-08-02 15:12:21.136438 -0700 PDT m=+219.458659208, info.ModTime=2018-08-02 15:12:21 -0700 PDT
    go_test.go:5377: running testgo [test testcache]
    go_test.go:5377: standard output:
    go_test.go:5377: ok   testcache 0.013s

    go_test.go:5378: running testgo [test testcache]
    go_test.go:5378: standard output:
    go_test.go:5378: ok   testcache (cached)

    go_test.go:5382: running testgo [test testcache]
    go_test.go:5382: standard output:
    go_test.go:5382: ok   testcache 0.172s

    go_test.go:5384: running testgo [test testcache]
    go_test.go:5384: standard output:
    go_test.go:5384: ok   testcache (cached)

    go_test.go:5387: running testgo [test testcache -run=FileSize]
    go_test.go:5387: standard output:
    go_test.go:5387: ok   testcache 0.012s

    go_test.go:5388: running testgo [test testcache -run=FileSize]
    go_test.go:5388: standard output:
    go_test.go:5388: ok   testcache (cached)

    go_test.go:5391: running testgo [test testcache -run=FileSize]
    go_test.go:5391: standard output:
    go_test.go:5391: ok   testcache 0.008s

    go_test.go:5393: running testgo [test testcache -run=FileSize]
    go_test.go:5393: standard output:
    go_test.go:5393: ok   testcache (cached)

    go_test.go:5396: running testgo [test testcache -run=Chdir]
    go_test.go:5396: standard output:
    go_test.go:5396: ok   testcache 0.417s

    go_test.go:5397: running testgo [test testcache -run=Chdir]
    go_test.go:5397: standard output:
    go_test.go:5397: ok   testcache (cached)

    go_test.go:5400: running testgo [test testcache -run=Chdir]
    go_test.go:5400: standard output:
    go_test.go:5400: ok   testcache (cached)

    go_test.go:5401: did not notice file size change
    go_test.go:5401: pattern \(cached\) found unexpectedly in standard output
FAIL

Original CL description:

    Evaluating the symlinks was slowing down test cache checks.

    Fixes #26562
    Fixes #26726

            ijt:~/gopath/src/issue26562$ cat foo_test.go
            package foo_test

            import (
                    "fmt"
                    "os"
                    "path/filepath"
                    "testing"
            )

            // package and imports snipped
            func TestCache(t *testing.T) {
                    tmp := os.TempDir()
                    for i := 0; i < 1000000; i++ {
                            os.Stat(filepath.Join(tmp, fmt.Sprintf("%d", i)))
                    }
            }
            ijt:~/gopath/src/issue26562$ time ~/github/go/bin/go test -count=1
            PASS
            ok      issue26562      9.444s

            real    0m10.021s
            user    0m2.344s
            sys     0m7.835s
            ijt:~/gopath/src/issue26562$ time ~/github/go/bin/go test .
            ok      issue26562      (cached)

            real    0m0.802s
            user    0m0.551s
            sys     0m0.306s

Updates #26562
Updates #26726

Change-Id: I7914ee57dc75bcbd7f0ea01c70bed97d67c810ea
Reviewed-on: https://go-review.googlesource.com/127715
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agomath: ensure Erfc is not called with out-of-expected-range arguments on s390x
bill_ofarrell [Tue, 31 Jul 2018 23:48:52 +0000 (19:48 -0400)]
math: ensure Erfc is not called with out-of-expected-range arguments on s390x

The existing implementation produces correct results with a wide range of inputs,
but invalid results asymptotically. With this change we ensure correct asymptotic results
on s390x

Fixes #26477

Change-Id: I760c1f8177f7cab2d7622ab9a926dfb1f8113b49
Reviewed-on: https://go-review.googlesource.com/127119
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocrypto/ecdsa: add a package level example
Phil Pearl [Wed, 20 Jun 2018 19:40:33 +0000 (20:40 +0100)]
crypto/ecdsa: add a package level example

Change-Id: I4063d5ec4ac45561b94472b528583be564981912
Reviewed-on: https://go-review.googlesource.com/120144
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years agocmd/go: no longer eval symlinks in inDir
Issac Trotts [Thu, 2 Aug 2018 04:05:03 +0000 (21:05 -0700)]
cmd/go: no longer eval symlinks in inDir

Evaluating the symlinks was slowing down test cache checks.

Fixes #26562
Fixes #26726

ijt:~/gopath/src/issue26562$ cat foo_test.go
package foo_test

import (
"fmt"
"os"
"path/filepath"
"testing"
)

// package and imports snipped
func TestCache(t *testing.T) {
tmp := os.TempDir()
for i := 0; i < 1000000; i++ {
os.Stat(filepath.Join(tmp, fmt.Sprintf("%d", i)))
}
}
ijt:~/gopath/src/issue26562$ time ~/github/go/bin/go test -count=1
PASS
ok      issue26562      9.444s

real    0m10.021s
user    0m2.344s
sys     0m7.835s
ijt:~/gopath/src/issue26562$ time ~/github/go/bin/go test .
ok      issue26562      (cached)

real    0m0.802s
user    0m0.551s
sys     0m0.306s

Change-Id: I3ce7f7b68bb5b9e802069f277e79e1ed3c162622
Reviewed-on: https://go-review.googlesource.com/127635
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/go: move mod_tidy.txt from testdata/mod to testdata/src
Bryan C. Mills [Thu, 2 Aug 2018 16:11:46 +0000 (12:11 -0400)]
cmd/go: move mod_tidy.txt from testdata/mod to testdata/src

This file is clearly a script test, not a module definition, but it's in the
wrong directory to be run as one.

Fortunately, it passes with only minor modifications (changing “..” to “.”).

Change-Id: I66a544dfde82b8348108d2596c74e174157ae297
Reviewed-on: https://go-review.googlesource.com/127615
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc/go1.11: remove go/scanner note
Ian Lance Taylor [Thu, 2 Aug 2018 19:41:48 +0000 (12:41 -0700)]
doc/go1.11: remove go/scanner note

The relevant change was reverted in CL 127658.

Updates #26671

Change-Id: I0c555c8e18f4c7e289de56d3ef840d79cf0adac2
Reviewed-on: https://go-review.googlesource.com/127659
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agogo/scanner: continue adding directory to file name
Ian Lance Taylor [Thu, 2 Aug 2018 19:35:32 +0000 (12:35 -0700)]
go/scanner: continue adding directory to file name

Before CL 97795, when go/scanner saw a //line comment, it would clean
the path and, if the path was relative, prepend the directory from the
file name. This was not the best API because it meant that the
behavior changed based on whether the code was running on Windows or
not, and it meant that information from the //line directive was lost.
So in CL 97795, among other changes, go/scanner was changed to simply
return the filename given in the //line comment.

Unfortunately existing tools such as unparam and unconvert expected
the old behavior. In order to avoid breaking those tools, revert that
part of the change.

Fixes #26671

Change-Id: Ifa06542bd19cda9d682ac33766ab9080444ba050
Reviewed-on: https://go-review.googlesource.com/127658
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/link/internal/wasm: add Go version as a custom wasm section
Richard Musiol [Thu, 2 Aug 2018 20:39:00 +0000 (22:39 +0200)]
cmd/link/internal/wasm: add Go version as a custom wasm section

The interface between the wasm binary and wasm_exec.js is experimental
and likely to change in the future. Still, there are some early adopters
who experiment with non-web wasm runtimes. They can't use wasm_exec.js
and have to provide their own equivalent. Adding the Go version as a
custom wasm sections allows for them to support a stable Go version and
the latest devel at the same time.

Change-Id: I6d377bb0a0c33cb80e86dd15a34ddc9a70680227
Reviewed-on: https://go-review.googlesource.com/127597
Run-TryBot: Richard Musiol <neelance@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoencoding/xml: document HTMLAutoClose and HTMLEntity more
Brad Fitzpatrick [Thu, 2 Aug 2018 20:42:00 +0000 (20:42 +0000)]
encoding/xml: document HTMLAutoClose and HTMLEntity more

They didn't even have public types, which made them pretty mysterious.

Give them types and reference the Decoder, which uses them.

Also, refer them qualified by their package name in the examples, as
we usually do in example*.go files, which usually use package foo_test
specifically so we can show the package names along with the symbols.

Change-Id: I50ebbbf43778c1627bfa526f8824f52c7953454f
Reviewed-on: https://go-review.googlesource.com/127663
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agoencoding/xml: remove some primordial semicolons
Brad Fitzpatrick [Thu, 2 Aug 2018 20:17:21 +0000 (20:17 +0000)]
encoding/xml: remove some primordial semicolons

Change-Id: I23e5d87648a4091fb4f6616bf80aa6c800974900
Reviewed-on: https://go-review.googlesource.com/127662
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agosyscall: use deprecation convention in package comment, simplify
Brad Fitzpatrick [Thu, 2 Aug 2018 19:34:38 +0000 (19:34 +0000)]
syscall: use deprecation convention in package comment, simplify

Change-Id: I612041d31c01d49135947796fe2a09db3e6894d4
Reviewed-on: https://go-review.googlesource.com/127657
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoos: add check for empty executable path on darwin
Roberto Clapis [Thu, 2 Aug 2018 13:27:14 +0000 (15:27 +0200)]
os: add check for empty executable path on darwin

os used to panic (access out of bounds) if executablePath was left empty

Fixes #22529

Change-Id: Iead5e60a3b000dbde421a8e8612c3690340879ce
Reviewed-on: https://go-review.googlesource.com/127546
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: skip cgo test when cgo isn't available
Brad Fitzpatrick [Thu, 2 Aug 2018 05:08:51 +0000 (05:08 +0000)]
cmd/go: skip cgo test when cgo isn't available

Fixes #26758

Change-Id: If08bafc85c353dfbb546107b75c8c884ab9c88e4
Reviewed-on: https://go-review.googlesource.com/127475
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agotest/codegen: add more combined store tests for arm64
Ben Shi [Tue, 10 Jul 2018 10:32:04 +0000 (10:32 +0000)]
test/codegen: add more combined store tests for arm64

Some combined store optimization was already implemented
in go-1.11, but there is no corresponding test cases.

Change-Id: Iebdad186e92047942e53a74f2c20b390922e1e9c
Reviewed-on: https://go-review.googlesource.com/122915
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agomisc/cgo/testcshared: force descriptor 30 to be closed when execing test
Ian Lance Taylor [Wed, 1 Aug 2018 21:50:11 +0000 (14:50 -0700)]
misc/cgo/testcshared: force descriptor 30 to be closed when execing test

Fixes #26730

Change-Id: I3396598282c814e75c0c4ef16f692dbe83d2935e
Reviewed-on: https://go-review.googlesource.com/127395
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agosyscall/js: move callback helper code to misc/wasm to avoid using eval()
Xudong Zheng [Wed, 1 Aug 2018 21:33:09 +0000 (21:33 +0000)]
syscall/js: move callback helper code to misc/wasm to avoid using eval()

When using the compiled .wasm with misc/wasm/wasm_exec.js, we get an error message if the site prohibits eval() via the Content-Security-Policy header. This can be resolved by moving the callback helper code from src/syscall/js/callback.go to misc/wasm/wasm_exec.js.

Fixes #26748

Change-Id: I28f271b8a00631f4c66a1ac31305e85f20f9d420
GitHub-Last-Rev: a6a0268f38d36c198ca6b4ceb2e75cc8afec74eb
GitHub-Pull-Request: golang/go#26750
Reviewed-on: https://go-review.googlesource.com/127296
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/cgo: don't give inconsistent typedef error for cgo-defined types
Ian Lance Taylor [Wed, 1 Aug 2018 19:51:19 +0000 (12:51 -0700)]
cmd/cgo: don't give inconsistent typedef error for cgo-defined types

The cgo tool predefines some C types such as C.uint. Don't give an
error if the type that cgo defines does not match the type in a header file.

Fixes #26743

Change-Id: I9ed3b4c482b558d8ffa8bf61eb3209415b7a9e3c
Reviewed-on: https://go-review.googlesource.com/127356
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agovendor: update golang.org/x/net/http2/hpack
Brad Fitzpatrick [Wed, 1 Aug 2018 19:48:58 +0000 (19:48 +0000)]
vendor: update golang.org/x/net/http2/hpack

Updates bundled golang.org/x/net/http2/hpack to x/net git rev 22bb95c5e for:

   http2/hpack: lazily build huffman table on first use
   https://golang.org/cl/127275

   http2/hpack: reduce memory for huffman decoding table
   https://golang.org/cl/127235

   http2/hpack: dynamic table updates must occur first
   https://golang.org/cl/111681

And a typo & gofmt CL.

Updates #25023

Change-Id: I7027fdb4982305aa671d811fe87f61e5df0f8e0e
Reviewed-on: https://go-review.googlesource.com/127355
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agogo/build: accept ! in cgo arguments
Ian Lance Taylor [Wed, 1 Aug 2018 18:37:14 +0000 (11:37 -0700)]
go/build: accept ! in cgo arguments

The ! can show up when using ${SRCDIR} with uppercase letters in module names.

Fixes #26716

Change-Id: Ia474ed8ec40a88076e8aac21103f6c7bb3848bdb
Reviewed-on: https://go-review.googlesource.com/127297
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: avoid panic on 'go mod' without arguments
as [Wed, 1 Aug 2018 18:38:46 +0000 (18:38 +0000)]
cmd/go: avoid panic on 'go mod' without arguments

Fixes #26738

Change-Id: Icede3f59acb5b0e388660653cefc24a195b5d43b
GitHub-Last-Rev: 9989b74c12e94163c1f18859485a4ac0d74c5453
GitHub-Pull-Request: golang/go#26739
Reviewed-on: https://go-review.googlesource.com/127160
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agoruntime: fix syscall error returns on mips/mips64/ppc64
David Wimmer [Wed, 25 Jul 2018 18:44:07 +0000 (18:44 +0000)]
runtime: fix syscall error returns on mips/mips64/ppc64

The linux syscall functions used in runtime are designed around the calling
convention of returning errors as negative numbers. On some other systems
(like mips and ppc) the actual syscalls signal errors in other ways. This
means that the assembly implementations of the syscall functions on these
platforms need to transform the return values in the error cases to match
the expected negative errno values. This was addressed for certain syscalls
in https://golang.org/cl/19455 and https://golang.org/cl/89235. This patch
handles the rest of the syscall functions in sys_linux_*.s that return any
value for mips/mips64/ppc64.

Fixes #23446

Change-Id: I302100261231f76d5850ab2c2ea080170d7dba72
GitHub-Last-Rev: e358e2b08c76897b13f917cfa12b5085e20337f9
GitHub-Pull-Request: golang/go#26606
Reviewed-on: https://go-review.googlesource.com/125895
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/cgo: stop expanding typedefs once we reach __builtin types
Keith Randall [Wed, 1 Aug 2018 04:31:19 +0000 (21:31 -0700)]
cmd/cgo: stop expanding typedefs once we reach __builtin types

Expanding __builtin types (__builtin_va_list, particularly) leads
to problems because they are expanded by the compiler itself - the
expansions are not generated by anything in a .h file. The types
a __builtin type expand to are thus very confusing to cgo.

See CL 126275.

Change-Id: I66eb6a4f27f652f1b934ba702f580f6daa62a566
Reviewed-on: https://go-review.googlesource.com/127156
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agostrconv: clarify "g" and "G" precision in the docs
Daniela Petruzalek [Wed, 1 Aug 2018 00:19:55 +0000 (00:19 +0000)]
strconv: clarify "g" and "G" precision in the docs

Fix the wording in "strconv" and "fmt" to make explicit
that the "g" and "G" formats remove trailing zeroes.

Fixes #25082

Change-Id: I2e2ad0a98d2ea27a3a8a006a0563b366f7a3b71b
Reviewed-on: https://go-review.googlesource.com/127135
Reviewed-by: Rob Pike <r@golang.org>
5 years agocmd/doc: adapt directory search for modules
Russ Cox [Mon, 30 Jul 2018 18:53:44 +0000 (14:53 -0400)]
cmd/doc: adapt directory search for modules

Previously, cmd/doc treated GOROOT/src and GOPATH/src
as the roots of the directory trees holding packages, assuming
that the import path would be the path elements after the src directory.

With modules, each module serves as its own root of a file tree,
and the import path prefix starts with the module path before
adding the path elements after the module root.

There are ways we could make this more efficient,
but for now this is a fairly small adjustment to get 'go doc'
working OK for modules for Go 1.11.

Fixes #26635.

Change-Id: Ifdee4194601312846c7b1fc67f2fe7a4a44269cc
Reviewed-on: https://go-review.googlesource.com/126799
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
5 years agocmd/go: move module cache from $GOPATH/src/mod to $GOPATH/pkg/mod
Russ Cox [Mon, 30 Jul 2018 18:58:45 +0000 (14:58 -0400)]
cmd/go: move module cache from $GOPATH/src/mod to $GOPATH/pkg/mod

Using $GOPATH/src/mod confuses too many tools.
$GOPATH/pkg/mod seems better for now.
It's also next to dep's cache, $GOPATH/pkg/dep.
If we do eliminate GOPATH/pkg for holding .a files (#4719)
then we could still keep it around for pkg/mod.
(Or we could move the module cache again then.)

Fixes #26401.
Fixes #26635.

Change-Id: I18f7da216ed9f490eded3c00d837fb086ae5b6a4
Reviewed-on: https://go-review.googlesource.com/126755
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Rob Pike <r@golang.org>
5 years agocmd/go: add list -find to find packages but not resolve imports
Russ Cox [Mon, 30 Jul 2018 17:51:35 +0000 (13:51 -0400)]
cmd/go: add list -find to find packages but not resolve imports

This is needed by golang.org/x/tools/go/packages
and also gives a way to do a quicker scan for
packages with a given final path element:

go list -find .../template

Change-Id: I092f4ac5ba7af7d727eb8204379fa436667061b9
Reviewed-on: https://go-review.googlesource.com/126716
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: allow list of absolute directory path
Russ Cox [Mon, 30 Jul 2018 16:59:42 +0000 (12:59 -0400)]
cmd/go: allow list of absolute directory path

Relative directory paths have always worked.
This CL makes absolute directory paths be handled the same way.
(It was an oversight that they were excluded.)

It also fixes the case of naming the directory holding source code
for a package in a module dependency.

Fixes #14177.
Fixes #26550.

Change-Id: I29a0ca2795d35eca773121ee91a97628b56947ce
Reviewed-on: https://go-review.googlesource.com/126715
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: replace -getmode with -mod, $GOPROXY
Russ Cox [Sun, 29 Jul 2018 05:38:25 +0000 (01:38 -0400)]
cmd/go: replace -getmode with -mod, $GOPROXY

The old -getmode flag had two settings:
-getmode=local meant don't download from the network.
-getmode=vendor meant only use the vendor directory.

The new -mod flag has two settings:
-mod=readonly means refuse to automatically update go.mod (mainly for CI testing).
-mod=vendor means only use the vendor directory.

The old GOPROXY variable had two settings:
a proxy URL or else the empty string (direct connect).

The new GOPROXY variable has three settings:
a proxy URL, the string "off" (no network use allowed),
or else the empty string or the explicit string "direct" (direct connection).
We anticipate allow a comma-separated sequence in a future release,
so commas are disallowed entirely right now.

Fixes #24666.
Fixes #26586.
Fixes #26370.
Fixes #26361.

Change-Id: If2601a16b09f04800f666938c071fc053b4c3f9c
Reviewed-on: https://go-review.googlesource.com/126696
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: add $GOFLAGS environment variable
Russ Cox [Sun, 29 Jul 2018 05:10:02 +0000 (01:10 -0400)]
cmd/go: add $GOFLAGS environment variable

People sometimes want to turn on a particular go command flag by default.
In Go 1.11 we have at least two different cases where users may need this.

1. Linking can be noticeably slower on underpowered systems
due to DWARF, and users may want to set -ldflags=-w by default.

2. For modules, some users or CI systems will want vendoring always,
so they want -getmode=vendor (soon to be -mod=vendor) by default.

This CL generalizes the problem to “set default flags for the go command.”

$GOFLAGS can be a space-separated list of flag settings, but each
space-separated entry in the list must be a standalone flag.
That is, you must do 'GOFLAGS=-ldflags=-w' not 'GOFLAGS=-ldflags -w'.
The latter would mean to pass -w to go commands that understand it
(if any do; if not, it's an error to mention it).

For #26074.
For #26318.
Fixes #26585.

Change-Id: I428f79c1fbfb9e41e54d199c68746405aed2319c
Reviewed-on: https://go-review.googlesource.com/126656
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
5 years agocmd/go: change list -compiled to populate new CompiledGoFiles list
Russ Cox [Sun, 29 Jul 2018 13:26:24 +0000 (09:26 -0400)]
cmd/go: change list -compiled to populate new CompiledGoFiles list

CL 108156 added -cgo during the Go 1.11 cycle.
To avoid adding a new field to Package, it redefined the
meaning of the CgoFiles list to be the cgo output instead
of the cgo input.

This was awkward in the go command itself, since the meaning
of the list changed midway through the build.

But, worse, it is awkward to users of go list.
When gathering information about a tree of packages,
we may want the names of both the cgo inputs and the cgo outputs
(golang.org/x/tools/go/packages does, it turns out),
or when combined with -deps (CL 107776),
we may only care about one list or the other depending
on whether the package was requested explicitly or is
being returned as a dependency.

Also, it's not general enough. SWIGFiles turn into cgo files
and then end up in the list too. And maybe there will be others
in the future. What clients really want is the list of files that
are presented to the go compiler, so that they can parse
and type-check them as if they were the compiler instead.

Eliminate all this awkwardness by dropping -cgo and adding
a new -compiled that populates a new CompiledGoFiles list.

Change-Id: I5f152da17cfb2692eedde61721d01ec13067c57d
Reviewed-on: https://go-review.googlesource.com/126695
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: split go mod into multiple subcommands
Russ Cox [Sun, 29 Jul 2018 00:25:06 +0000 (20:25 -0400)]
cmd/go: split go mod into multiple subcommands

The current "go mod" command does too many things.
The design is unclear.

It looks like "everything you might want to do with modules"
which causes people to think all module operations go through
"go mod", which is the opposite of the seamless integration we're
going for. In particular too many people think "go mod -require"
and "go get" are the same.

It does make sense to put the module-specific functionality
under "go mod", but not as flags. Instead, split "go mod" into
multiple subcommands:

go mod edit   # old go mod -require ...
go mod fix    # old go mod -fix
go mod graph  # old go mod -graph
go mod init   # old go mod -init
go mod tidy   # old go mod -sync
go mod vendor # old go mod -vendor
go mod verify # old go mod -verify

Splitting out the individual commands makes both the docs
and the implementations dramatically easier to read.
It simplifies the command lines
(go mod -init -module m is now 'go mod init m')
and allows command-specific flags.

We've avoided subcommands in the go command to date, and we
should continue to avoid adding them unless it really makes
the experience significantly better. In this case, it does.

Creating subcommands required some changes in the core
command-parsing and help logic to generalize from one
level to multiple levels.

As part of having "go mod init" be a separate command,
this CL changes the failure behavior during module initialization
to be delayed until modules are actually needed.
Initialization can still happen early, but the base.Fatalf
is delayed until something needs to use modules.
This fixes a bunch of commands like 'go env' that were
unhelpfully failing with GO111MODULE=on when not in a
module directory.

Fixes #26432.
Fixes #26581.
Fixes #26596.
Fixes #26639.

Change-Id: I868db0babe8c288e8af684b29d4a5ae4825d6407
Reviewed-on: https://go-review.googlesource.com/126655
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: add 'go version' statement in go.mod
Russ Cox [Wed, 25 Jul 2018 04:24:13 +0000 (00:24 -0400)]
cmd/go: add 'go version' statement in go.mod

We aren't planning to use this or advertise it much yet,
but having support for it now will make it easier to start
using in the future - older go commands will understand
what 'go 1.20' means and that they don't have go 1.20.

Fixes #23969.

Change-Id: I729130b2690d3c0b794b49201526b53de5093c45
Reviewed-on: https://go-review.googlesource.com/125940
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agohtml: lazily populate Unescape tables
Brad Fitzpatrick [Tue, 31 Jul 2018 21:37:35 +0000 (21:37 +0000)]
html: lazily populate Unescape tables

Saves ~105KB of heap for callers who don't use html.UnescapeString.
(EscapeString is much more common).

Also saves 70KB of binary size, because now the linker can do dead
code elimination. (because #2559 is still open and global maps always
generate init code)

Fixes #26727
Updates #6853

Change-Id: I18fe9a273097e2c7e0cb7f88205cae1bb60fa89b
Reviewed-on: https://go-review.googlesource.com/127075
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc: fix link in contribute.html
Mohit kumar Bajoria [Tue, 31 Jul 2018 21:21:52 +0000 (21:21 +0000)]
doc: fix link in contribute.html

Fixes #26611

Change-Id: I111152c7b1156a461c9ddeaf16d2fe7a2d5a00c1
GitHub-Last-Rev: 72090d539b5601b8c585628a11a99b03103d5a75
GitHub-Pull-Request: golang/go#26724
Reviewed-on: https://go-review.googlesource.com/126935
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/cgo: add column number to line directives
Kir Kolyshkin [Mon, 30 Jul 2018 14:05:49 +0000 (17:05 +0300)]
cmd/cgo: add column number to line directives

Due to a new specification of //line: directives, missing
column info is now treated as column 0, aka "unknown column"
(see https://github.com/golang/go/issues/24183 for details).

As cgo does not add column number to generated //line: directive,
resulting files parsed do not have column info.

Fix by adding column of 1 to generated line directives.

Fixes #26692

Change-Id: Ie9263c0cf666b92d19c34240e745e8f32ffe7174
Reviewed-on: https://go-review.googlesource.com/126675
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/cgo: make sure we FinishType everything
Keith Randall [Thu, 26 Jul 2018 23:33:27 +0000 (16:33 -0700)]
cmd/cgo: make sure we FinishType everything

Ensure that we call FinishType on all the types added to the ptrs map.
We only add a key to ptrKeys once. Once we FinishType for that key,
we'll never look at that key again. But we can add a new type under that
key later, and we'll never finish it.

Make sure we add the key to the ptrKeys list every time we make the list
of types for that key non-empty.

This makes sure we FinishType each pointer type exactly once.

Fixes #26517

Change-Id: Iad86150d516fcfac167591daf5a26c38bec7d143
Reviewed-on: https://go-review.googlesource.com/126275
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/go/internal/modfetch/codehost: quote arguments to commands printed from -x
Bryan C. Mills [Tue, 31 Jul 2018 18:37:43 +0000 (14:37 -0400)]
cmd/go/internal/modfetch/codehost: quote arguments to commands printed from -x

Some of the arguments — particularly format strings passed to git commands — may
contain spaces, and it's useful to be able to paste commands from 'go get -x
foo' directly into a shell to reproduce their output.

Change-Id: I4f0c0b4e05db8b5232458e9a271f2ccbb665e85a
Reviewed-on: https://go-review.googlesource.com/126955
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc/go1.11: mention ReverseProxy passing TE: trailers headers to backend
Brad Fitzpatrick [Wed, 25 Jul 2018 17:00:40 +0000 (17:00 +0000)]
doc/go1.11: mention ReverseProxy passing TE: trailers headers to backend

Change-Id: Idbc507ae3df791a759b967bcbe833b8e08bd9611
Reviewed-on: https://go-review.googlesource.com/125817
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agonet/http: revert CL 89275 (don't sniff Content-Type when nosniff set)
Brad Fitzpatrick [Tue, 31 Jul 2018 17:09:49 +0000 (17:09 +0000)]
net/http: revert CL 89275 (don't sniff Content-Type when nosniff set)

Also updates the bundled http2 to x/net/http2 git rev 49c15d80 for:

   http2: revert CL 107295 (don't sniff Content-type in Server when nosniff)
   https://golang.org/cl/126895

Fixes #24795

Change-Id: I6ae1a21c919947089274e816eb628d20490f83ce
Reviewed-on: https://go-review.googlesource.com/126896
Reviewed-by: Damien Neil <dneil@google.com>
5 years agosyscall: remove support for O_NONBLOCK and O_SYNC on js/wasm
Richard Musiol [Sat, 28 Jul 2018 11:45:02 +0000 (13:45 +0200)]
syscall: remove support for O_NONBLOCK and O_SYNC on js/wasm

This commit removes O_NONBLOCK on js/wasm. O_SYNC can't be
removed, because it is referenced by the os package, so instead
its use returns an error.

On Windows, the options O_NONBLOCK and O_SYNC are not available
when opening a file with Node.js. This caused the initialization
of the syscall package to panic.

The simplest solution is to not support these two options on js/wasm
at all. Code written for js/wasm is supposed to be portable,
so platform-specific options should not be used.

Fixes #26524.

Change-Id: I366aa3cdcfa59dfa9dc513368259f363ca090f00
Reviewed-on: https://go-review.googlesource.com/126600
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc/go1.11: add note to remove CLI support for godoc
Agniva De Sarker [Tue, 31 Jul 2018 04:11:31 +0000 (09:41 +0530)]
doc/go1.11: add note to remove CLI support for godoc

Updates #25443

Change-Id: I5e2f84f3cee6582807b2756ffac91e8583a2baec
Reviewed-on: https://go-review.googlesource.com/126737
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agosyscall/js: improve documentation about mappings to JavaScript values
Richard Musiol [Tue, 31 Jul 2018 13:17:31 +0000 (15:17 +0200)]
syscall/js: improve documentation about mappings to JavaScript values

This commit moves the documentation about how Go values are mapped to
JavaScript values to the functions that apply the mapping, instead of
mentioning them in the documentation of the types being mapped. This
should be easier to read.

Change-Id: I2465eb4a45f71b3b61624349e908a195010a09f1
Reviewed-on: https://go-review.googlesource.com/126856
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agogo/doc: do not treat methods as test functions
Roger Peppe [Fri, 20 Jul 2018 10:31:39 +0000 (11:31 +0100)]
go/doc: do not treat methods as test functions

The example code was treating a method starting with Test
as a test function when considering whether to produce
a whole-file example or not. As a method can never be
a test function, this isn't correct.

Change-Id: Idd8ec9eaf0904af076e941d7fe7d967f6b7eef78
Reviewed-on: https://go-review.googlesource.com/125257
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc: mention Faccessat flags support in go1.11
Ian Lance Taylor [Fri, 27 Jul 2018 21:16:45 +0000 (14:16 -0700)]
doc: mention Faccessat flags support in go1.11

Change-Id: I4d01be5330db06877065aabe7a3faf69bce0dfb2
Reviewed-on: https://go-review.googlesource.com/126515
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: remove dead code
Yury Smolsky [Fri, 27 Jul 2018 21:29:38 +0000 (00:29 +0300)]
cmd/compile: remove dead code

This struct, global var and method are not used anywhere.

Change-Id: I83d9e93041a46904064d0fa88ab655a50149c747
Reviewed-on: https://go-review.googlesource.com/126397
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agodoc: add link to go command modules docs from Go 1.11 release notes
Paul Jolly [Mon, 30 Jul 2018 21:31:01 +0000 (22:31 +0100)]
doc: add link to go command modules docs from Go 1.11 release notes

The FAQ already has a link to the release notes and the go command docs.
Add a link from the release notes to the go command docs, to ensure that
people ultimately end up there (the docs that then signpost
people to the relevant other help docs).

Updates #25517.

Change-Id: I284c84af712d4519c59f7ca6c396b05a4c967cee
Reviewed-on: https://go-review.googlesource.com/126777
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agonet/http: expand a TimeoutHandler test a bit
Brad Fitzpatrick [Wed, 25 Jul 2018 18:08:16 +0000 (18:08 +0000)]
net/http: expand a TimeoutHandler test a bit

Updates #22821

Change-Id: I2d0d483538174a90f56c26d99bea89fe9ce4d144
Reviewed-on: https://go-review.googlesource.com/125855
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agocmd/go: prohibit modules from importing vendored golang_org packages
Bryan C. Mills [Wed, 25 Jul 2018 19:56:43 +0000 (15:56 -0400)]
cmd/go: prohibit modules from importing vendored golang_org packages

Expand mod_internal tests to cover vendoring, replacements, and failure
messages.

Packages beginning with "golang_org/" resolve to $GOROOT/src/vendor, and should
therefore not be visible within module code.

Fixes #23970.

Change-Id: I706e9c4a1d1e025883e84b897972678d0fa3f2bd
Reviewed-on: https://go-review.googlesource.com/125836
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agocmd/go: forbid use of one module with two different paths
Bryan C. Mills [Thu, 26 Jul 2018 20:42:15 +0000 (16:42 -0400)]
cmd/go: forbid use of one module with two different paths

If a single module is imported via two different paths (e.g., as itself and as a
replacement for something else), some users may be surprised if the two paths
do not share the same package-level state. Others may be surprised if the two
paths do share state.

Punt on the question for now by rejecting that condition explicitly.

Fixes #26607.

Change-Id: I15c3889f61f8dd4ba5e5c48ca33ad63aeecac04e
Reviewed-on: https://go-review.googlesource.com/126156
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agocmd/go/internal/modload: inline doImport into doPkg
Bryan C. Mills [Wed, 25 Jul 2018 18:55:42 +0000 (14:55 -0400)]
cmd/go/internal/modload: inline doImport into doPkg

doImport is itself a thin wrapper around Import, and doPkg is its only call
site. I'm having trouble following what doPkg is doing due to the indirection,
so I'm removing it.

Change-Id: I6167be68e869a36010a56a5869df50b1145ac813
Reviewed-on: https://go-review.googlesource.com/125837
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agocmd/go: allow internal imports based on module paths
Bryan C. Mills [Tue, 24 Jul 2018 23:10:08 +0000 (19:10 -0400)]
cmd/go: allow internal imports based on module paths

Updates #23970.

Change-Id: I2e69ad15b9d1097bfeef9947f03cfa6834a6a049
Reviewed-on: https://go-review.googlesource.com/125676
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agocmd/go: allow unversioned paths to -dropreplace flag
Bryan C. Mills [Wed, 25 Jul 2018 21:56:57 +0000 (17:56 -0400)]
cmd/go: allow unversioned paths to -dropreplace flag

We can add unversioned paths via -replace;
-dropreplace must be able to drop them.

Fixes #26417.

Change-Id: Ic05e9ae2ad80c008e11b195695cbb9d0fc8dbc0a
Reviewed-on: https://go-review.googlesource.com/126155
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agocmd/go: add test code packages in list -test
Michael Matloob [Fri, 27 Jul 2018 20:23:16 +0000 (16:23 -0400)]
cmd/go: add test code packages in list -test

Previously go list -test <pkg> would return pkg and, if it exists,
pkg.test, the test main package. This change will also list the
two test code packages (if they exist) that contain testing functions,
<pkg> [<pkg>.test] and <pkg>_test [<pkg>.test].

These packages which contain testing code are usually the packages
go list users desire to know about, so they should be surfaced
in go list -test.

See the discussion at
golang.org/cl/123635#message-5befbc66663063fb7247645a02ab1327a681e362
for more context.

Change-Id: I7170b539d02b548c050ac54048735ed785f47389
Reviewed-on: https://go-review.googlesource.com/126475
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agocmd/internal/obj/arm64: reject incorrect form of LDP/STP
Ben Shi [Tue, 24 Jul 2018 03:47:39 +0000 (03:47 +0000)]
cmd/internal/obj/arm64: reject incorrect form of LDP/STP

"LDP (R0), (F0, F1)" and "STP (F1, F2), (R0)" are
silently accepted by the arm64 assembler without
any error message. And this CL fixes that bug.

fixes #26556.

Change-Id: Ib6fae81956deb39a4ffd95e9409acc8dad3ab2d2
Reviewed-on: https://go-review.googlesource.com/125637
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agodoc/go1.11: add missing word
Alberto Donizetti [Mon, 30 Jul 2018 09:24:09 +0000 (11:24 +0200)]
doc/go1.11: add missing word

Change-Id: Iad01c9a4a080cf0c317768c34b3fbfd3c9707969
Reviewed-on: https://go-review.googlesource.com/126609
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agodoc/go1.11: note that godoc now shows the Go version that added features
Brad Fitzpatrick [Sun, 29 Jul 2018 19:11:55 +0000 (19:11 +0000)]
doc/go1.11: note that godoc now shows the Go version that added features

Change-Id: Ie613a707dad1ac69627e1d7584d7d4e311db22f7
Reviewed-on: https://go-review.googlesource.com/126622
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agopath: present the correct error message in TestMatch
John Gibb [Sun, 29 Jul 2018 15:19:17 +0000 (15:19 +0000)]
path: present the correct error message in TestMatch

The message was hardcoded to indicate that the test wanted a nil error, even
though in some cases a specific error was wanted. This patch fixes the
message to print the wanted error.

Change-Id: Id86ea89d6f41f25bfa164acc50142ae8ff0ec410
GitHub-Last-Rev: c220374845667942c608c02afadff95443e2ec20
GitHub-Pull-Request: golang/go#26674
Reviewed-on: https://go-review.googlesource.com/126619
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: fix TestScript/mod_gobuild_import on Plan 9
David du Colombier [Sun, 29 Jul 2018 11:15:25 +0000 (13:15 +0200)]
cmd/go: fix TestScript/mod_gobuild_import on Plan 9

CL 125296 added TestScript/mod_gobuild_import. This
test is failing on Plan 9, because go/build invokes
the go tool which cannot be found in the path.

The "PATH" environment variable has been updated to
contain the path to the go tool on Unix and Windows,
but on Plan 9, the analogous environment variable is
called "path".

This change fixes the script engine by setting
the "path" environment variable on Plan 9.

Fixes #26669.

Change-Id: If1be50e14baceccee591f4f76b7e698f5e12a2d4
Reviewed-on: https://go-review.googlesource.com/126608
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: uses SID of group Guests to test ACL
Constantin Konstantinidis [Sat, 28 Jul 2018 08:16:40 +0000 (10:16 +0200)]
cmd/go: uses SID of group Guests to test ACL

The test TestACL failed when ran on a Windows set
up in another language as the "Guest" account
name is translated. The SID of the group of Guests
always exist and is used instead.

Fixes #26658

Change-Id: Ia885d08a9e50563787e389c2d2dc2547881a2943
Reviewed-on: https://go-review.googlesource.com/126598
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: ignore unknown directives in dependency go.mod files
Russ Cox [Wed, 25 Jul 2018 00:21:37 +0000 (20:21 -0400)]
cmd/go: ignore unknown directives in dependency go.mod files

This will help with forward compatibility when we add additional
directives that only matter for the main module (or that can be
safely ignored otherwise).

Change-Id: Ida1e186fb2669b128aeb5a9a1187e2535b72b763
Reviewed-on: https://go-review.googlesource.com/125936
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: document in 'go help mod' that people should use 'go get'
Russ Cox [Wed, 25 Jul 2018 00:02:26 +0000 (20:02 -0400)]
cmd/go: document in 'go help mod' that people should use 'go get'

We're starting to see tutorials that assume
'go mod' is the only module-related command.

Fixes #26597.

Change-Id: I44701f29f89fc67086f96307afbdb4659bb63873
Reviewed-on: https://go-review.googlesource.com/125935
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: add 'go help goproxy'
Russ Cox [Tue, 24 Jul 2018 19:07:19 +0000 (15:07 -0400)]
cmd/go: add 'go help goproxy'

Fixes #26553.

Change-Id: I522a0fa96ae161b67d89f38dafde528adcbae243
Reviewed-on: https://go-review.googlesource.com/125658
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: fix spurious edges in mod -graph output
Russ Cox [Tue, 24 Jul 2018 19:05:11 +0000 (15:05 -0400)]
cmd/go: fix spurious edges in mod -graph output

The mod -graph output was showing every dependency
as an edge from the main module, instead of showing only
the things that are listed in go.mod.

Fixes #26489.

Change-Id: I248fedb1fc9225e2a7a9ddc2f4a84520b3a96138
Reviewed-on: https://go-review.googlesource.com/125657
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: add go list -m -f {{.GoMod}} to show path to go.mod file
Russ Cox [Tue, 24 Jul 2018 19:01:22 +0000 (15:01 -0400)]
cmd/go: add go list -m -f {{.GoMod}} to show path to go.mod file

"go env GOMOD" gives this for the main module already
but it's useful to be able to query other modules.
Using {{.Dir}} does not work if the go.mod was auto-synthesized.

Change-Id: If4844571e9e429b541de0d40c36ff4c5743b2031
Reviewed-on: https://go-review.googlesource.com/125656
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: document go env GOMOD
Russ Cox [Tue, 24 Jul 2018 18:41:44 +0000 (14:41 -0400)]
cmd/go: document go env GOMOD

Fixes #26500.

Change-Id: I0a00009ce10f7aab3e6e79f7218307c3008422d1
Reviewed-on: https://go-review.googlesource.com/125655
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/cgo: document that #including source files in subdirectories is a bad idea
Russ Cox [Fri, 20 Jul 2018 15:22:21 +0000 (11:22 -0400)]
cmd/cgo: document that #including source files in subdirectories is a bad idea

Suggested in discussion on #26366.

Change-Id: Id9ad2e429a915f88b4c4b30fc415c722eebe0ea4
Reviewed-on: https://go-review.googlesource.com/125297
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agogo/build: invoke go command to find modules during Import, Context.Import
Russ Cox [Fri, 20 Jul 2018 14:59:57 +0000 (10:59 -0400)]
go/build: invoke go command to find modules during Import, Context.Import

The introduction of modules has broken (intentionally) the rule
that the source code for a package x/y/z is in GOPATH/src/x/y/z
(or GOROOT/src/x/y/z). This breaks the code in go/build.Import,
which uses that rule to find the directory for a package.

In the long term, the fix is to move programs that load packages
off of go/build and onto golang.org/x/tools/go/packages, which
we hope will eventually become go/packages. That code invokes
the go command to learn what it needs to know about where
packages are.

In the short term, though, there are lots of programs that use go/build
and will not be able to find code in module dependencies.
To help those programs, go/build now runs the go command to
ask where a package's source code can be found, if it sees that
modules are in use. (If modules are not in use, it falls back to the
usual lookup code and does not invoke the go command, so that
existing uses are unaffected and not slowed down.)

Helps #24661.
Fixes #26504.

Change-Id: I0dac68854cf5011005c3b2272810245d81b7cc5a
Reviewed-on: https://go-review.googlesource.com/125296
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agonet/http: document Transport.Proxy's https support
Craig Citro [Fri, 27 Jul 2018 20:39:49 +0000 (13:39 -0700)]
net/http: document Transport.Proxy's https support

The net/http module added support for HTTPS proxies in CL 68550, but the
Transport.Proxy docstring was never updated to reflect this. This (doc-only)
update adds "https" to the list of supported schemes.

Change-Id: I0570fcdae8232bb42d52c4dd739dd09ee8dfd612
Reviewed-on: https://go-review.googlesource.com/126495
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agosyscall: support Faccessat flags argument
Ian Lance Taylor [Fri, 27 Jul 2018 17:48:18 +0000 (10:48 -0700)]
syscall: support Faccessat flags argument

The Linux kernel faccessat system call does not take a flags parameter.
The flag parameter to the C library faccessat function is implemented in C.
The syscall.Faccessat function takes a flags parameter. In older releases
we have passed the flags parameter to the kernel, which ignored it.
In CL 120015 we started returning an error if any flags were set.
That seems clearly better than ignoring them, but it turns out that some
code was using the flags. The code was previously subtly broken.
Now it is obviously broken. That is better, but we can do better still:
we can implement the flags as the C library does. That is what this CL does.

Change-Id: I259bd6f240c3951e939b81c3032dead3d9c567b4
Reviewed-on: https://go-review.googlesource.com/126415
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agonet/http: try to document ServeFile security more
Brad Fitzpatrick [Wed, 25 Jul 2018 18:19:51 +0000 (18:19 +0000)]
net/http: try to document ServeFile security more

We've expanded this several times. Try more.

Fixes #18837

Change-Id: I03b699391351a30ee60a15d7aa712c6c66444cf9
Reviewed-on: https://go-review.googlesource.com/125875
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/link: added test of availability of gcc
Constantin Konstantinidis [Thu, 26 Jul 2018 14:01:34 +0000 (16:01 +0200)]
cmd/link: added test of availability of gcc

The test RuntimeTypeAttr always failed when gcc
was unavailable. The test is duplicated for internal
and external linking. The usual verification
of host linker is added at the beginning of the
external link test.

Fixes #26621

Change-Id: I076d661f854c8a6de8fa5e7b069942a471445047
Reviewed-on: https://go-review.googlesource.com/126075
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
5 years agosyscall: improve NewCallback documentation and panic message
Jeet Parekh [Fri, 27 Jul 2018 15:52:36 +0000 (15:52 +0000)]
syscall: improve NewCallback documentation and panic message

Fixes #26138

Change-Id: If77b2839bccc600223735df42438a19131cd051c
GitHub-Last-Rev: 64ceaea9f1cb7afb3d552dce0223b818bac1faf9
GitHub-Pull-Request: golang/go#26617
Reviewed-on: https://go-review.googlesource.com/126035
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/cgo: don't resolve typedefs in -godefs mode
Ian Lance Taylor [Wed, 25 Jul 2018 22:24:27 +0000 (15:24 -0700)]
cmd/cgo: don't resolve typedefs in -godefs mode

In -godefs mode any typedefs that appear in struct fields and the like
will presumably be defined in the input file. If we resolve to the
base type, those cross-references will not work. So for -godefs mode,
keep the Go 1.10 behavior and don't resolve the typedefs in a loop.

Fixes #26644

Change-Id: I48cf72d9eb5016353c43074e6aff6495af326f35
Reviewed-on: https://go-review.googlesource.com/125995
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocrypto/x509: skip TestSystemRoots
Martin Möhrmann [Fri, 20 Jul 2018 14:41:26 +0000 (16:41 +0200)]
crypto/x509: skip TestSystemRoots

cgo and non-cgo code paths can disagree
on the number of root certificates:
=== RUN   TestSystemRoots
--- FAIL: TestSystemRoots (0.31s)
    root_darwin_test.go:31:     cgo sys roots: 93.605184ms
    root_darwin_test.go:32: non-cgo sys roots: 213.998586ms
    root_darwin_test.go:44: got 168 roots
    root_darwin_test.go:44: got 427 roots
    root_darwin_test.go:73: insufficient overlap between cgo and non-cgo roots; want at least 213, have 168
FAIL
exit status 1

Updates #21416
Updates #24652

Change-Id: Idb6d35b17c142dfff79a10cf6b40a42d12f9d17e
Reviewed-on: https://go-review.googlesource.com/125259
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go/internal/par: fix TestWorkParallel retries
Daniel Martí [Fri, 27 Jul 2018 10:24:00 +0000 (11:24 +0100)]
cmd/go/internal/par: fix TestWorkParallel retries

When the test retried multiple times, it reused the same Work variable,
causing in the builders being flaky due to panics. I was able to
immediately reproduce the failure with stress and -race:

$ go test -race -c && stress -p 32 ./par.test -test.run=TestWorkParallel$

/tmp/go-stress909062277
--- FAIL: TestWorkParallel (0.07s)
panic: par.Work.Do: already called Do [recovered]
panic: par.Work.Do: already called Do

Instead, use a new Work variable at each retry. Now, the line above
seems to never fail. Of course, much higher 'stress -p' values will
still result in "does not seem to be parallel" test failures since the
machine lacks resources. But those are test failures, not panics.

Fixes #26642.

Change-Id: I5e962eca7602cf413d911ff5669f56d4f52da5a7
Reviewed-on: https://go-review.googlesource.com/126355
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: remove unused global var isGoRelease
Yury Smolsky [Fri, 27 Jul 2018 14:01:34 +0000 (17:01 +0300)]
cmd/go: remove unused global var isGoRelease

This variable is not used anymore. It was used in the
TestPackageNotStaleWithTrailingSlash test.

Change-Id: I5e52d4d1d91592dd21e2d9cff96974a49d07f5f8
Reviewed-on: https://go-review.googlesource.com/126376
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agosyscall: implement pipe() on linux/mips
David Wimmer [Wed, 25 Jul 2018 19:16:07 +0000 (19:16 +0000)]
syscall: implement pipe() on linux/mips

Change the Pipe() function to use the pipe() syscall (which has a unique
calling convention on linux/mips) instead of using pipe2(). This allows
it work on kernels <2.6.27 when pipe2() was introduced.

Change-Id: I65dfbd2a02b64e777a8eb13013d718e356521be6
GitHub-Last-Rev: c483a06168387c2cf151b6419e4e16576fab640a
GitHub-Pull-Request: golang/go#26608
Reviewed-on: https://go-review.googlesource.com/125915
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Vladimir Stefanovic <vladimir.stefanovic@mips.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocrypto/tls: fix deadlock when Read and Close called concurrently
Minaev Mike [Fri, 26 Jan 2018 09:17:46 +0000 (09:17 +0000)]
crypto/tls: fix deadlock when Read and Close called concurrently

The existing implementation of TLS connection has a deadlock. It occurs
when client connects to TLS server and doesn't send data for
handshake, so server calls Close on this connection. This is because
server reads data under locked mutex, while Close method tries to
lock the same mutex.

Fixes #23518

Change-Id: I4fb0a2a770f3d911036bfd9a7da7cc41c1b27e19
Reviewed-on: https://go-review.googlesource.com/90155
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years agocmd/go: for missing binary-only package, say where it should be
Ian Lance Taylor [Wed, 25 Jul 2018 17:03:40 +0000 (10:03 -0700)]
cmd/go: for missing binary-only package, say where it should be

Before this CL the user effectively has to guess at the expected
location of a binary-only package. While the location is normally
obvious ($GOPATH/pkg/GOOS_GOARCH/PATH/PKG.a) it is much less so when
building with options that implicitly add an -installsufix option.

Fixes #26590

Change-Id: I753ef54d6dcf733bb456dba65a4a92e4db57a1b0
Reviewed-on: https://go-review.googlesource.com/125818
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agoruntime: ignore GNU/Linux sigaction errors for signals 32 and 33
Ian Lance Taylor [Wed, 25 Jul 2018 21:09:02 +0000 (14:09 -0700)]
runtime: ignore GNU/Linux sigaction errors for signals 32 and 33

This avoids problems when running under QEMU. It seems that at least
some QEMU versions turn the sigaction implementation into a call to
the C library sigaction function. The C library function will reject
attempts to set the signal handler for signals 32 and 33. Ignore
errors in that case.

Change-Id: Id443a9a32f6fb0ceef5c59a398e7ede30bf71646
Reviewed-on: https://go-review.googlesource.com/125955
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agonet: fix handling of Conns created by Resolver.Dial
Ian Gudger [Tue, 24 Jul 2018 23:19:19 +0000 (16:19 -0700)]
net: fix handling of Conns created by Resolver.Dial

The DNS client in net is documented to treat Conns returned by
Resolver.Dial which implement PacketConn as UDP and those which don't as
TCP regardless of what was requested. golang.org/cl/37879 changed the
DNS client to assume that the Conn returned by Resolver.Dial was the
requested type which broke compatibility.

Fixes #26573
Updates #16218

Change-Id: Idf4f073a4cc3b1db36a3804898df206907f9c43c
Reviewed-on: https://go-review.googlesource.com/125735
Run-TryBot: Ian Gudger <igudger@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agodoc: fix a couple of drive-by review comments in FAQ
Rob Pike [Tue, 24 Jul 2018 22:26:01 +0000 (08:26 +1000)]
doc: fix a couple of drive-by review comments in FAQ

Change-Id: I10cc2073e28cefb1b9a10c0ae89d819ad6417d66
Reviewed-on: https://go-review.googlesource.com/125695
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agonet/http: fix and normalize the [Server.][ListenAnd]Serve[TLS] docs
Filippo Valsorda [Fri, 30 Mar 2018 23:09:59 +0000 (19:09 -0400)]
net/http: fix and normalize the [Server.][ListenAnd]Serve[TLS] docs

The only inaccurate part was the HTTP/2 caveat in Server.ServeTLS, which
only applies to the plain Serve variant.

The restriction implemented in shouldConfigureHTTP2ForServe is not on
the setupHTTP2_ServeTLS codepath because ServeTLS owns the tls.Listener,
so we fix it for the user instead of disabling HTTP/2.

Fixes #24607

Change-Id: Ie5f207d0201f09db27bf81b75535e5f6fdaf91e2
Reviewed-on: https://go-review.googlesource.com/103815
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: traceback from outermost libc call
Keith Randall [Mon, 16 Jul 2018 21:39:40 +0000 (14:39 -0700)]
runtime: traceback from outermost libc call

If we're in a libc call and get a trap, don't try to traceback the libc call.
Start from the state we had at entry to libc.

If there are multiple libc calls outstanding, remember the outermost one.

Fixes #26393

Change-Id: Icfe8794b95bf3bfd1a0679b456dcde2481dcabf3
Reviewed-on: https://go-review.googlesource.com/124195
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/compile: set stricter inlining threshold in large functions
Keith Randall [Mon, 23 Jul 2018 20:09:48 +0000 (13:09 -0700)]
cmd/compile: set stricter inlining threshold in large functions

If we're compiling a large function, be more picky about how big
the function we're inlining is.  If the function is >5000 nodes,
we lower the inlining threshold from a cost of 80 to 20.

Turns out reflect.Value's cost is exactly 80.  That's the function
at issue in #26546.

20 was chosen as a proxy for "inlined body is smaller than the call would be".
Simple functions still get inlined, like this one at cost 7:

func ifaceIndir(t *rtype) bool {
return t.kind&kindDirectIface == 0
}

5000 nodes was chosen as the big function size.  Here are all the
5000+ node (~~1000+ lines) functions in the stdlib:

5187 cmd/internal/obj/arm (*ctxt5).asmout
6879 cmd/internal/obj/s390x (*ctxtz).asmout
6567 cmd/internal/obj/ppc64 (*ctxt9).asmout
9643 cmd/internal/obj/arm64 (*ctxt7).asmout
5042 cmd/internal/obj/x86 (*AsmBuf).doasm
8768 cmd/compile/internal/ssa rewriteBlockAMD64
8878 cmd/compile/internal/ssa rewriteBlockARM
8344 cmd/compile/internal/ssa rewriteValueARM64_OpARM64OR_20
7916 cmd/compile/internal/ssa rewriteValueARM64_OpARM64OR_30
5427 cmd/compile/internal/ssa rewriteBlockARM64
5126 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_50
6152 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_60
6412 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_70
6486 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_80
6534 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_90
6534 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_100
6534 cmd/compile/internal/ssa rewriteValuePPC64_OpPPC64OR_110
6675 cmd/compile/internal/gc typecheck1
5433 cmd/compile/internal/gc walkexpr
14070 cmd/vendor/golang.org/x/arch/arm64/arm64asm decodeArg

There are a lot more smaller (~1000 node) functions in the stdlib.
The function in #26546 has 12477 nodes.

At some point it might be nice to have a better heuristic for "inlined
body is smaller than the call", a non-cliff way to scale down the cost
as the function gets bigger, doing cheaper inlined calls first, etc.
All that can wait for another release. I'd like to do this CL for
1.11.

Fixes #26546
Update #17566

Change-Id: Idda13020e46ec2b28d79a17217f44b189f8139ac
Reviewed-on: https://go-review.googlesource.com/125516
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
5 years agocmd/go/internal/modfetch: run git log with "-c log.showsignature=false"
Baokun Lee [Fri, 20 Jul 2018 17:37:21 +0000 (01:37 +0800)]
cmd/go/internal/modfetch: run git log with "-c log.showsignature=false"

The old version git not support "--no-show-signature", git add this from
v2.10.0.

Fixes golang/go#26501.

Change-Id: Ia6b54488651e8687b08a4d40e092822bf960c4fe
Reviewed-on: https://go-review.googlesource.com/125315
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: fix Go structs in -json documentation
Yann Hodique [Tue, 24 Jul 2018 06:23:50 +0000 (23:23 -0700)]
cmd/go: fix Go structs in -json documentation

"string" should really be "struct" in the structures describing the module.

Change-Id: I4e9cb12434bd33aa243622380c78e5e297d01d0b
Reviewed-on: https://go-review.googlesource.com/125638
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agonet/rpc: clarify requirements for connections and codecs
Dmitry Vyukov [Tue, 26 Jun 2018 11:28:04 +0000 (13:28 +0200)]
net/rpc: clarify requirements for connections and codecs

1. Connections and codecs need to be partially safe for concurrent use.
   Namely, read side is serialized by one mutex,
   and writing side is serialized by another.
   Current comment says that they need to be fully thread-safe,
   which makes the default implementations (gobClientCodec/gobServerCodec)
   non-conforming.

2. Say that ServerCodec.Close can be called multiple times
   and must be idempotent. Server requires this and gobServerCodec
   accounts for this,  but the requirement is not documented.

Change-Id: Ie877e37891fed28056e3d9d1722edaed8e154067
Reviewed-on: https://go-review.googlesource.com/120818
Reviewed-by: Rob Pike <r@golang.org>
5 years agonet/http: document that Client methods always return *url.Error
Brad Fitzpatrick [Tue, 24 Jul 2018 00:24:49 +0000 (00:24 +0000)]
net/http: document that Client methods always return *url.Error

Updates #9424

Change-Id: If117ba3e7d031f84b30d3a721ef99fe622734de2
Reviewed-on: https://go-review.googlesource.com/125575
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agonet/http: deflake TestRetryRequestsOnError
Brad Fitzpatrick [Mon, 23 Jul 2018 23:42:10 +0000 (23:42 +0000)]
net/http: deflake TestRetryRequestsOnError

There's a 50ms threshold in net/http.Transport that this test
sometimes hitting on slower devices. That was unrelated to what this
test was trying to test. So instead just t.Skip on RoundTrip errors
unless the failure was quick (under 25ms), in which case the error
must've been about something else. Our fast machines should catch
regressions there.

Fixes #25366

Change-Id: Ibe8e2716a5b68558b57d0b8b5c46f38e46a2cba2
Reviewed-on: https://go-review.googlesource.com/125555
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/vet: if a function modifies its args, it's not a print wrapper
Ian Lance Taylor [Thu, 19 Jul 2018 21:35:02 +0000 (14:35 -0700)]
cmd/vet: if a function modifies its args, it's not a print wrapper

Fixes #26486
Updates #26555

Change-Id: I402137b796e574e9b085ab54290d1b4ef73d3fcc
Reviewed-on: https://go-review.googlesource.com/125039
Reviewed-by: Russ Cox <rsc@golang.org>
5 years agonet/http: update Serve docs on when HTTP/2 is enabled
Brad Fitzpatrick [Mon, 23 Jul 2018 18:31:23 +0000 (18:31 +0000)]
net/http: update Serve docs on when HTTP/2 is enabled

Contains portions and modified portions of CL 103815

Fixes #24607

Change-Id: Ic330850a0f098f183315f04ea4780eded46c5b77
Reviewed-on: https://go-review.googlesource.com/125515
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/go/internal/modfetch: do not panic when zip is incorrect
marwan-at-work [Sun, 22 Jul 2018 20:23:29 +0000 (20:23 +0000)]
cmd/go/internal/modfetch: do not panic when zip is incorrect

Fixes #26536

Change-Id: I75d284bd39af0a06e31d18c7f7745c5a8ecbe6ac
GitHub-Last-Rev: 88040a9edb0cb547a498cb8c8b662eb8729eb8bf
GitHub-Pull-Request: golang/go#26537
Reviewed-on: https://go-review.googlesource.com/125436
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>