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

37338 Commits

Author SHA1 Message Date
as
27a9b1bbec cmd/go: avoid panic on 'go mod' without arguments
Fixes #26738

Change-Id: Icede3f59acb5b0e388660653cefc24a195b5d43b
GitHub-Last-Rev: 9989b74c12
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>
2018-08-01 18:53:51 +00:00
David Wimmer
acd30e9a82 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: e358e2b08c
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>
2018-08-01 18:44:46 +00:00
Keith Randall
b8669ef1ce 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>
2018-08-01 14:29:58 +00:00
Daniela Petruzalek
6b9c782f9f 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>
2018-08-01 00:57:00 +00:00
Russ Cox
b7d3f4c0b2 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>
2018-08-01 00:35:28 +00:00
Russ Cox
b8f42d74e8 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>
2018-08-01 00:35:26 +00:00
Russ Cox
27e546be86 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>
2018-08-01 00:35:25 +00:00
Russ Cox
cdac6c22c3 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>
2018-08-01 00:35:23 +00:00
Russ Cox
30a84b389d 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>
2018-08-01 00:35:22 +00:00
Russ Cox
c1a4fc3b36 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>
2018-08-01 00:35:21 +00:00
Russ Cox
53859e575b 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>
2018-08-01 00:35:19 +00:00
Russ Cox
6121987a10 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>
2018-08-01 00:35:17 +00:00
Russ Cox
16962faf99 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>
2018-08-01 00:35:16 +00:00
Brad Fitzpatrick
740e589bd0 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>
2018-07-31 22:10:54 +00:00
Mohit kumar Bajoria
04c095886f doc: fix link in contribute.html
Fixes #26611

Change-Id: I111152c7b1156a461c9ddeaf16d2fe7a2d5a00c1
GitHub-Last-Rev: 72090d539b
GitHub-Pull-Request: golang/go#26724
Reviewed-on: https://go-review.googlesource.com/126935
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-07-31 21:42:50 +00:00
Kir Kolyshkin
6bea321ba2 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>
2018-07-31 20:20:47 +00:00
Keith Randall
344d0e0bf7 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>
2018-07-31 19:29:20 +00:00
Bryan C. Mills
f152f83a6e 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>
2018-07-31 19:14:46 +00:00
Brad Fitzpatrick
ce06f5a222 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>
2018-07-31 18:11:29 +00:00
Brad Fitzpatrick
d3c3aaa61f 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>
2018-07-31 17:29:58 +00:00
Richard Musiol
9e2a4f4dff 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>
2018-07-31 17:03:39 +00:00
Agniva De Sarker
137f2fba57 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>
2018-07-31 16:52:15 +00:00
Richard Musiol
ecec63c8a1 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>
2018-07-31 16:34:38 +00:00
Roger Peppe
1a5350e123 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>
2018-07-31 16:11:48 +00:00
Ian Lance Taylor
5332b5e75a 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>
2018-07-31 15:44:37 +00:00
Yury Smolsky
0b7d87e6f9 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>
2018-07-31 15:42:33 +00:00
Paul Jolly
af29e98390 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>
2018-07-31 15:16:27 +00:00
Brad Fitzpatrick
d10ab13c18 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>
2018-07-31 15:07:39 +00:00
Bryan C. Mills
b294fe9b0a 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>
2018-07-31 02:04:53 +00:00
Bryan C. Mills
68170aa677 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>
2018-07-31 02:02:51 +00:00
Bryan C. Mills
682faae2e3 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>
2018-07-31 02:00:47 +00:00
Bryan C. Mills
db2f680fdf 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>
2018-07-31 01:58:53 +00:00
Bryan C. Mills
38dc795074 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>
2018-07-31 01:57:22 +00:00
Michael Matloob
52cc9e3762 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>
2018-07-30 16:40:04 +00:00
Ben Shi
e351a16005 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>
2018-07-30 15:31:06 +00:00
Alberto Donizetti
86f907fdec doc/go1.11: add missing word
Change-Id: Iad01c9a4a080cf0c317768c34b3fbfd3c9707969
Reviewed-on: https://go-review.googlesource.com/126609
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-07-30 14:44:47 +00:00
Brad Fitzpatrick
12d27d8ea5 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>
2018-07-29 20:05:41 +00:00
John Gibb
f6a5fada27 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: c220374845
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>
2018-07-29 19:18:48 +00:00
David du Colombier
154394f8d3 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>
2018-07-29 15:42:29 +00:00
Constantin Konstantinidis
5ad0a524d2 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>
2018-07-28 09:06:26 +00:00
Russ Cox
0090c13c91 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>
2018-07-28 01:15:16 +00:00
Russ Cox
9cde8048ad 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>
2018-07-28 01:15:10 +00:00
Russ Cox
a74cc47244 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>
2018-07-28 01:15:05 +00:00
Russ Cox
f37ca81c84 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>
2018-07-28 01:15:00 +00:00
Russ Cox
0cb6b55f43 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>
2018-07-28 01:14:56 +00:00
Russ Cox
011b6ff8d7 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>
2018-07-28 01:14:50 +00:00
Russ Cox
8fbbf63cc6 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>
2018-07-28 01:14:45 +00:00
Russ Cox
f85125345c 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>
2018-07-28 01:14:39 +00:00
Craig Citro
8450fd9677 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>
2018-07-27 21:40:10 +00:00
Ian Lance Taylor
d970519086 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>
2018-07-27 21:13:43 +00:00