1
0
mirror of https://github.com/golang/go synced 2024-10-01 10:38:33 -06:00
Commit Graph

2233 Commits

Author SHA1 Message Date
Chris Broadfoot
ac1e4b1998 cmd/getgo: initial commit
Initial commit of getgo, a "one-line installer".

Example use from bash:

  curl -LO https://get.golang.org/$(uname)/go_installer && chmod +x go_installer && ./go_installer && rm go_installer

It's comprised of two parts:

cmd/getgo/server: an App Engine application that redirects users to an
appropriate installer based on the request path, which identifies the
user's operating system. It's deployed to get.golang.org.

cmd/getgo: a cross-compiled binary that does the heavy lifting of
downloading and installing the latest Go version (including setting up
the environment) to the user's system. The installers are served from
the golang GCS bucket.

Currently supported systems:
  linux, darwin, windows / amd64, 386

Authored by Jess Frazelle, Steve Francia, Chris Broadfoot.

Change-Id: I615de86e198d3bd93e418fa23055d00ddbdd99fb
Reviewed-on: https://go-review.googlesource.com/51115
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
2017-07-28 18:26:31 +00:00
Matthew Dempsky
3da34b1b52 cmd/gorename: disable TestGeneratedFiles for !cgo builds
Fixes golang/go#21055.

Change-Id: I126cef4496c15424048e39b2af111c95580b90fb
Reviewed-on: https://go-review.googlesource.com/49390
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-17 21:59:59 +00:00
Tim Heckman
807424b52b cmd/go-contrib-init: exit with an error if package install fails
During the first run of `go-contrib-init` it tries to install the
golang.org/x/review/git-codereview package using `go get`. If this command were
to fail, we would check for the error and log that the command failed to
succeed. However, when failure occurred we would only log the error and not
interrupt the flow of the program. This would cause the program to continue with
the assumption that git-codereview had been installed correctly.

This change enhances the `go-contrib-init` command to exit with a bad status
code, after logging the failure, if installing git-codereview fails.

Fixes golang/go#21040

Change-Id: Ie01d78557d54285001db61faafbb409888b2893c
Reviewed-on: https://go-review.googlesource.com/49151
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-17 03:20:55 +00:00
Josh Bleecher Snyder
478150226d imports: update zstdlib to Go 1.9
We're at beta 2 already, so the API is likely stable.
If anything gets rolled back, we can update imports again.

Change-Id: I87e0adde062e45cab16e2bee2f929c1ac1bb828d
Reviewed-on: https://go-review.googlesource.com/49150
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-17 03:03:41 +00:00
Edward Muller
41b76ca51c present: Set the background using CSS
This allowed me to better match the background image to the size of
the slides.

Change-Id: Ieaae93cd78582a3059ed6c3e64e740dea9088af5
Reviewed-on: https://go-review.googlesource.com/47130
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-17 00:28:30 +00:00
Andy Walker
d78e5d2552 refactor/eg: already documented; remove TODO
Change-Id: I7166006a3a922505a5f0a619bd98c0a1505831bc
Reviewed-on: https://go-review.googlesource.com/48981
Reviewed-by: Leo Rudberg <ljr@google.com>
Reviewed-by: Ross Light <light@google.com>
Run-TryBot: Ross Light <light@google.com>
2017-07-15 20:28:46 +00:00
Austin Clements
7a4327eb7a cmd/go-contrib-init: don't crash from src/golang.org/x
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>
2017-07-15 16:38:41 +00:00
Michael Edwards
4ce273956a godoc: follow symbolic links to folders in GOROOT
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.

Fixes golang/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>
2017-07-14 21:15:33 +00:00
Kevin Burke
6f1996fdfe cmd/go-contrib-init: better GOPATH checkout error message
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>
2017-07-13 05:25:58 +00:00
Leo Rudberg
7a94893dc3 cmd/eg: Gofmt eg's dry-run output.
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>
2017-07-13 04:09:46 +00:00
Kevin Burke
76622760f0 cmd/go-contrib-init: match subdomain-less .gitcookies file
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".

Fixes golang/go#20992.

Change-Id: I29d3c0b1e958382495a90502f280bdb52868c2c7
Reviewed-on: https://go-review.googlesource.com/48230
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-13 03:45:07 +00:00
Hiroshi Ioka
bce9606b3f cmd/bundle: include non-associated comments
https://golang.org/cl/45117 doesn't handle comments which don't
belong to any declarations. This CL addresses it.

Fixes golang/go#20627

Change-Id: I81c7cdc070efc6cb9e9f38101d7b2b8909916ba6
Reviewed-on: https://go-review.googlesource.com/45190
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-07-07 17:27:36 +00:00
suzmue
9dc2b714a0 cmd/gorename: add tests that run successfully
Set the env variable to only include the correct gopath in the test.

Fixes golang/go#20805

Change-Id: I496ed5c60278e508016f915cf53a115cc3c222ae
Reviewed-on: https://go-review.googlesource.com/47410
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-07-07 17:24:26 +00:00
Brad Fitzpatrick
6e57528ade imports: fix reading from stdin on Windows
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.

Fixes golang/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>
2017-07-07 17:20:05 +00:00
Brad Fitzpatrick
72ed06fbe2 godoc: include dir listing in rate limit, log dir reading errors
Updates golang/go#14252

Change-Id: I3ce2a410708900f5c80d15e722b410855fd9c571
Reviewed-on: https://go-review.googlesource.com/47651
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-06 20:06:05 +00:00
Kirill Smelkov
c2d03f470b go/loader: Fix thinko in FindPackage hook signature
(*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>
2017-07-05 16:38:48 +00:00
Brad Fitzpatrick
1b3bb8de7d godoc/dl: change OS X to macOS, clarify WinXP requirement
Change-Id: Ib90881aef9c1bec0339dbbc38cbb320d5b731d97
Reviewed-on: https://go-review.googlesource.com/47251
Reviewed-by: Andrew Bonventre <andybons@google.com>
2017-06-29 19:46:10 +00:00
Brad Fitzpatrick
9be3b7cbc7 godoc/dl: update some pretty GOARCH strings
Fixes golang/go#19082

Change-Id: Id0e985eeff543ad24ff969ff8c94e086a7bc9303
Reviewed-on: https://go-review.googlesource.com/46916
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2017-06-29 18:26:36 +00:00
Koichi Shiraishi
e6cb469339 imports: fix LocalPrefix document prefix
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>
2017-06-23 12:26:59 +00:00
Alan Donovan
da9759ca30 cmd/bundle: fix nil dereference panic
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.)

Fixes golang/go#20751

Change-Id: I925e969c9b4f4d6b6344c16f156b47857436d70a
Reviewed-on: https://go-review.googlesource.com/46414
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-06-23 02:24:18 +00:00
Suzy Mueller
1ab5277e83 refactor/rename: fail cleanly when attempting to rename cgo files
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.

Fixes golang/go#17839

Change-Id: I072100b22197ec145b56d727feca58be7529e359
Reviewed-on: https://go-review.googlesource.com/45930
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-06-23 01:23:57 +00:00
Yasuhiro Matsumoto
545ce0dcdd tools: handle paths like ~/ or $HOME/.
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>
2017-06-22 02:08:34 +00:00
Koichi Shiraishi
cd6e398dae cmd/git-contrib-init: support http.cookiefile config for gitcookies
Change-Id: I097905122e1cb7298c31c330731f0fc3c6fc9b59
Reviewed-on: https://go-review.googlesource.com/46235
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-21 15:43:17 +00:00
Koichi Shiraishi
601a54bfa3 cmd/go-contrib-init: fix get GOPATH env logic
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>
2017-06-21 05:03:32 +00:00
Alan Donovan
63c6481f3b go/loader: fix a data race
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.)

Fixes golang/go#20718

Change-Id: I5a4f95be5ab4c60ea3b6c2a7fb6f1b67acbf42bc
Reviewed-on: https://go-review.googlesource.com/46071
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-19 17:45:44 +00:00
Sina Siadat
5128de7288 godoc: add links to docs in text and dir pages
Fixes golang/go#17125

Change-Id: I22dd0561cd1c8eb30524797b6c0488d08a65285b
Reviewed-on: https://go-review.googlesource.com/29279
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-16 21:49:54 +00:00
Alan Donovan
34f7837286 go/ssa: remove statement with no effect
Change-Id: I1c7958ab16f19fbdc71d2305da3d4afb6e150f73
Reviewed-on: https://go-review.googlesource.com/45934
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
2017-06-15 21:28:45 +00:00
Alan Donovan
6d30ceaab7 go/ssa: fix regression in φ-elimination
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.

Fixes golang/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>
2017-06-15 18:36:17 +00:00
Alan Donovan
365911de24 go/ssa: opt: avoid an allocation
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>
2017-06-15 16:36:43 +00:00
Brad Fitzpatrick
f2cd9d3b51 cmd/go-contrib-init: fix in-GOPATH check
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>
2017-06-14 16:55:02 +00:00
Chris Broadfoot
b4e0c5ecfb cmd/tip: manually scale talks to 1 instance
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>
2017-06-13 23:21:29 +00:00
Chris Broadfoot
aca8b28035 cmd/tip: log error when fetching metadata
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>
2017-06-13 23:21:17 +00:00
Brad Fitzpatrick
7d47e840ac cmd/goimports: update docs to not imply goimports is superset of gofmt
Change-Id: I098fa50c274d8206b6e2534d647cfae18d6b2703
Reviewed-on: https://go-review.googlesource.com/45390
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-06-13 20:38:26 +00:00
Alan Donovan
5d733ef37e godoc: fix crash in -analysis
Fixes golang/go#20641

Change-Id: I499b4b8da2899c4b606ce3eedd30caab57607a85
Reviewed-on: https://go-review.googlesource.com/45570
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-06-13 17:41:52 +00:00
Kevin Burke
011098bb92 cmd/stress: flush out Usage doc
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>
2017-06-12 21:12:06 +00:00
Brad Jones
e011c1062a imports: prefer paths imported by sibling files.
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>
2017-06-09 17:18:19 +00:00
Hiroshi Ioka
e493388965 x/tools/cmd/bundle: include comments inside functions
Fixes golang/go#20548

Change-Id: Ieff2323b63308cbc052a2883237520620965cf86
Reviewed-on: https://go-review.googlesource.com/45117
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-06-09 02:56:03 +00:00
Robert Griesemer
b9ad13c5e8 go/gcexportdata: fix test again (fix older builds)
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>
2017-06-08 21:12:18 +00:00
Robert Griesemer
add5a52034 go/gcexportdata: fix test output (fix build)
Change-Id: Ib9a92c7b7ac09e739177b8c4c16f893dfb5e4420
Reviewed-on: https://go-review.googlesource.com/45151
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-06-08 18:19:49 +00:00
Steve Francia
2a3bccfb1b cmd/go-contrib-init: check working dir and autodectect repo
Change-Id: I730216e2954ff591a57314e82ffd7b43d1da8ed4
Reviewed-on: https://go-review.googlesource.com/45084
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-08 03:08:27 +00:00
kortschak
987877771e x/tools/present: fix element number check
Fixes golang/go#20605

Change-Id: Ia87097741b743d9b138f0f16540d601b9525c7de
Reviewed-on: https://go-review.googlesource.com/45110
Reviewed-by: Andrew Gerrand <adg@golang.org>
2017-06-08 00:01:16 +00:00
Brad Fitzpatrick
a768197954 cmd/go-contrib-init: add git alias dry run mode, add success message
Updates golang/go#17802

Change-Id: I2b5473bc0539a760c26889497a301808deb5e5ae
Reviewed-on: https://go-review.googlesource.com/45083
Reviewed-by: Steve Francia <spf@golang.org>
2017-06-07 23:52:31 +00:00
Brad Fitzpatrick
16c483b02b cmd/go-contrib-init: don't assume user is in root directory of git checkout
Updates golang/go#17802

Change-Id: I8eeae42f395dee4eedd17114f10bb56536783089
Reviewed-on: https://go-review.googlesource.com/45082
Reviewed-by: Steve Francia <spf@golang.org>
2017-06-07 23:32:37 +00:00
Brad Fitzpatrick
154c88c09d cmd/go-contrib-init: add git-codereview bits
Updates golang/go#17802

Change-Id: Ic5278804203029926dd5a26e571f79aaafb13110
Reviewed-on: https://go-review.googlesource.com/45080
Reviewed-by: Steve Francia <spf@golang.org>
2017-06-07 23:21:04 +00:00
Brad Fitzpatrick
fe66dd2e3e cmd/go-contrib-init: add some git origin checks
Updates golang/go#17802

Change-Id: I70d30c5ff12837d51d13b5ca7e73be96eb535286
Reviewed-on: https://go-review.googlesource.com/45079
Reviewed-by: Steve Francia <spf@golang.org>
2017-06-07 22:49:11 +00:00
Brad Fitzpatrick
851770f01f cmd/go-contrib-init: add start of new tool to help new Go contributors
Updates golang/go#17802

Change-Id: Ieb4be41039d414a3ba6766d98ed95a6154f964f4
Reviewed-on: https://go-review.googlesource.com/45078
Reviewed-by: Steve Francia <spf@golang.org>
2017-06-07 22:20:13 +00:00
Eyal Posener
92d42b9ff1 present: return an error for a bad link instead of panic
Change-Id: Ic41b2794268b6399bda01febafb85852f6634198
Reviewed-on: https://go-review.googlesource.com/44690
Reviewed-by: Andrew Gerrand <adg@golang.org>
2017-06-05 22:57:01 +00:00
Alan Donovan
b62b8c72b8 go/gcexportdata: a command for inspecting gc export data in archive files
Change-Id: I2428b201c49dc441a0023053798f3287902fc370
Reviewed-on: https://go-review.googlesource.com/44861
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-06-05 19:49:53 +00:00
Spencer Nelson
2a5864fcfb x/tools/go/ssa: Accept struct conversions that ignore tags
This is now allowed in go1.8.

Fixes golang/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>
2017-06-02 20:57:42 +00:00
Fatih Arslan
bc6db94186 go/ast/astutil: do not merge if import path is last line
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.

Fixes golang/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>
2017-05-29 01:35:25 +00:00