If go-contrib-init is executed from the src/golang.org/x directory (as
opposed to a sub-directory), it crashes with an index out-of-bounds.
Fix this by including the trailing slash in the inspected path prefix
so we never slice more than what we know is in the string.
Change-Id: Ibbb74759c2ba839972de34a8ffb28b6cfb6825e2
Reviewed-on: https://go-review.googlesource.com/48690
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Directory walking in godoc relies on ReadDir which returns the result
of os.Lstat.
Instead make the the OS VFS's ReadDir use os.Stat on symlinks before
returning.
Fixesgolang/go#15049
Change-Id: I34d17ca0027b0245f5ef434a000e5a3fe2af11cf
Reviewed-on: https://go-review.googlesource.com/45096
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Modify the error message to provide more context if the user is in the
wrong directory. (The default Terminal.app does not do a great job of
showing what directory you are currently in).
Change-Id: Iafcbbd2070ca968863120fb8c4bc15609475cda2
Reviewed-on: https://go-review.googlesource.com/48232
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The content of the dry-run and the actual (file-editing) run should now
be the same.
Change-Id: If89f85838f7f53f14ffa4e2b6a425507835dda62
Reviewed-on: https://go-review.googlesource.com/48210
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
My `.gitcookies` file starts with ".googlesource.com", which
errored because it did not match "go.googlesource.com" or
"go-review.googlesource.com". Fix this by optionally matching on
"go.googlesource.com" or ".googlesource.com".
Fixesgolang/go#20992.
Change-Id: I29d3c0b1e958382495a90502f280bdb52868c2c7
Reviewed-on: https://go-review.googlesource.com/48230
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Set the env variable to only include the correct gopath in the test.
Fixesgolang/go#20805
Change-Id: I496ed5c60278e508016f915cf53a115cc3c222ae
Reviewed-on: https://go-review.googlesource.com/47410
Reviewed-by: Alan Donovan <adonovan@google.com>
Don't panic when reading from stdin on Windows. This is a regression
from https://golang.org/cl/43454
Also fix some weird behavior with stdin processing I noticed during
reviewing the code: don't allow the -w (write) flag, and adust the
filename shown with the -d (diff) flag.
Fixesgolang/go#20941
Change-Id: I73d0a1dc74c919238a3bb72823585bbf1b7daba1
Reviewed-on: https://go-review.googlesource.com/47810
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Jones <rbjones@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(*build.Context).Import has signature of
(ctx, importPath, fromDir, mode)
not
(ctx, fromDir, importPath, mode)
and the loader actually uses the first version.
The thinko was introduced in d6e83e53 (go/loader: changes for vendor
support; CL 18053) and was possible because importPath and fromDir both
have the same type string.
Fix it.
Change-Id: I52deaec6d141846b8a495835b121c1bdc2864215
Reviewed-on: https://go-review.googlesource.com/47343
Reviewed-by: Alan Donovan <adonovan@google.com>
golint suggested:
comment on exported var LocalPrefix should be of the form "LocalPrefix ..."
Change-Id: I1d2f92ba76e3c091440f676936dbb1fc1ce07f3a
Reviewed-on: https://go-review.googlesource.com/46432
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
In the loader API, (*Config).Import, like go/build, accepts relative
paths such as ".", but (*Program).Package requires the exact path of a
loaded package. So, to find the package identified by "." we must
look at the set of packages actually loaded, which in this scenario is
guaranteed to be a singleton.
(This is a definite weakness of the loader API. In the more general
case where two or more packages are imported, it's tricky to correlate
the calls to Import with the package(s) each call actually loads.)
Fixesgolang/go#20751
Change-Id: I925e969c9b4f4d6b6344c16f156b47857436d70a
Reviewed-on: https://go-review.googlesource.com/46414
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Previous implementation will overwrite files the import "C" with the
cgo preprocessing and renaming. Rename will now emit an error when
rename must edit files that import "C". Will also emit more useful
error when using -offset in a "C" importing file.
Fixesgolang/go#17839
Change-Id: I072100b22197ec145b56d727feca58be7529e359
Reviewed-on: https://go-review.googlesource.com/45930
Reviewed-by: Alan Donovan <adonovan@google.com>
tilde should be located at the beginning of line.
Change-Id: I271ba5220da3c483838d1741d908755aee8e081e
Reviewed-on: https://go-review.googlesource.com/46430
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Go runtime now uses user homedir+go (i.e. $HOME/go) if GOPATH
environment variable is not set.
Change-Id: I26d90e07976a5311ea19de8a6e2c63830b802882
Reviewed-on: https://go-review.googlesource.com/46234
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The loader was calling (*types.Checker).Files on the "unsafe" package,
a global variable. Even with zero files, this operation is not a no-op
because it sets the package's "complete" flag, leading to a data race.
(Because Unsafe.complete is already set at construction, the
race is benign, but is reported by -race nonetheless.)
Fixesgolang/go#20718
Change-Id: I5a4f95be5ab4c60ea3b6c2a7fb6f1b67acbf42bc
Reviewed-on: https://go-review.googlesource.com/46071
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
https://go-review.googlesource.com/37157 introduced a bug that caused
some live φ-nodes to be removed from the CFG. The cause was that
reachability traversal considered edges only among "new" φ-nodes
(those introduced during SSA renaming) but not existing φ-nodes from
&& and || expressions. The fix is to mark existing phis, and thus
other phis reachable from them, as live. We also clear the Phi.block
field when eliminating a φ-node.
Also, during reachability, we treat DebugRef instructions as roots
like any other non-Phi instruction. This eliminates a related known
bug whereby the operand of a DebugRef may be a dead φ.
This change also adds a sanity check that all operands of an SSA value
that are themselves instructions must belong to a block. The sanity
check would fail 7 times on the standard library without the fix.
Fixesgolang/go#19622
Change-Id: If3a897a6a593a17bc3f0f8228d1edf483be7a3d0
Reviewed-on: https://go-review.googlesource.com/45832
Run-TryBot: Dominik Honnef <dominik@honnef.co>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
In the dom tree traversal, the final child of each node now
inherits the parent's renaming map, reducing garbage.
This reduces allocations by 1.4% and bytes allocated by 2.0% when
building SSA for the entire standard library.
Change-Id: Id19b6d6766b3e0bf32d1db1238eff8a42d11b242
Reviewed-on: https://go-review.googlesource.com/45833
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
It's okay to have GOROOT=$HOME/go, GOPATH=$HOME.
That's what I have.
It's just not okay to hack in Go under $GOPATH/src.
Change-Id: I6ae69aceb43970bbdc9631ab090689a153954087
Reviewed-on: https://go-review.googlesource.com/45651
Reviewed-by: Steve Francia <spf@golang.org>
Disable health checker - it only causes trouble if we're running on one
instance. We'd rather see "starting up" than to have nothing served and
the instance killed when it doesn't come up ready in time.
Change-Id: I3396c626f840d606e0fb4a5ec4c0493195fd015f
Reviewed-on: https://go-review.googlesource.com/45654
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This error was previously ignored. This caused a silent failure when the
meta URL wasn't accessible.
Change-Id: I4020897ac15fec7b60a46277d81a99a6b6447a7d
Reviewed-on: https://go-review.googlesource.com/45655
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Provide more context when you run `stress -h` besides just the flags.
Change-Id: I9dbe7ba2b7178dd7a542d8c4c29bf79999a38234
Reviewed-on: https://go-review.googlesource.com/44810
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Adds an Imports field to packageInfo with the imports used by sibling
files, and uses it preferentially if it matches a missing import.
Example: if foo/foo.go imports "local/log", it's a reasonable assumption
that foo/bar.go will also want "local/log" instead of "log".
Change-Id: Ifb504ed5e00ff18459f19d8598cc2c94099ae563
Reviewed-on: https://go-review.googlesource.com/43454
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This time, chose a package that's not changed across several builds.
Follow-up on https://go-review.googlesource.com/45151.
Change-Id: I0b487a45f8b12179b3aa495d852c0b7caa44c921
Reviewed-on: https://go-review.googlesource.com/45154
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This is now allowed in go1.8.
Fixesgolang/go#19646.
Change-Id: Iece4fd2a881144bdbe841e0a26ba4348d6b8828e
Reviewed-on: https://go-review.googlesource.com/38452
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
DeleteNamedImport assumes the import declaration is in the form of:
import (
"foo"
)
If an import path is deleted there might be a blank line-sized hole:
import (
)
It'll merge the black hole with the last line to change it to:
import (
)
However the import declaration might be in the following form as well:
import (
"foo")
Whic means after deleting the import path, it changes to:
import (
)
In this case it still tries to merge the line with a non existing line,
causing token.File.MergeLine to panic.
We fix the issue by checking that the import path line is not the last
line to avoid panicing.
Fixesgolang/go#20229
Change-Id: I37537a4eaa83d14db59a2926d7bb14c27167a2e4
Reviewed-on: https://go-review.googlesource.com/44372
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
In the go/doc, the same map as "predeclared" is defined.
Instead of the "predeclared" map use the "IsPredeclared" function
which is an accessor for the go/doc map.
Deleted unnecessary "predeclared".
Fixesgolang/go#20357
Change-Id: I7fdf42cfeb4440fb490be9380f39035be88f9a5a
Reviewed-on: https://go-review.googlesource.com/43473
Reviewed-by: Kevin Burke <kev@inburke.com>
The link of the function declaration part is unnecessary because it points to the same place.
Removed the link of the function declaration part.
"IdentMode" has been removed since it is no longer used.
Fixesgolang/go#20269
Change-Id: I6399899947e46dc84c5432c1d645f6d96b7db4f6
Reviewed-on: https://go-review.googlesource.com/42892
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This mostly reverts commit 1c59bc354d
(CL 43350) which had fixed Go tip but broken Go 1.7 and Go 1.8
builders.
Change-Id: I4e7bdfafde74c9e730bb870b9db05b663b4f56a3
Reviewed-on: https://go-review.googlesource.com/43391
Reviewed-by: Alan Donovan <adonovan@google.com>
http://golang.org/cl/41476 added the internal/cpu package
to unify cpu feature flag detection in the standard library.
Add a replacement for the assembler function internal/cpu.cpuid
that simulates a x86 cpu with no feature detection capabilities.
Remove bytes.init and strings.init from the external function list
because they do not depend on assembler functions anymore.
Remove hash/crc32.haveSSE42 and math.hasSSE4 because they
have been removed from the go standard library.
Change-Id: Icab6ed3cb13eb14b28d23f2b9c5ae94688f2dc95
Reviewed-on: https://go-review.googlesource.com/43350
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Updates golang/go#19906
Change-Id: If13c828541cdb3937e5e970dd8add7615d36d866
Reviewed-on: https://go-review.googlesource.com/40171
Reviewed-by: David R. Jenni <david.r.jenni@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>