1
0
mirror of https://github.com/golang/go synced 2024-11-05 14:56:10 -07:00
Commit Graph

721 Commits

Author SHA1 Message Date
Alan Donovan
25abe5b322 cmd/guru: fix and reenable failing test case
And avoid assumptions about the contents of the standard hash/fnv
package.

Change-Id: I10cc95ac6e3b482da5b027d68ff218d08f425e89
Reviewed-on: https://go-review.googlesource.com/40870
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-14 23:25:34 +00:00
Brad Fitzpatrick
2a4809d2cb cmd/guru: disable a failing test for now
Updates golang/go#19464

Change-Id: I60a77bc25aa8d92c4f2fc1835d96002ea5b8bfea
Reviewed-on: https://go-review.googlesource.com/40850
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-04-14 23:03:32 +00:00
Josh Bleecher Snyder
cbb995d093 cmd/compilebench: make StdCmd respect compiler flags flag
Change-Id: I9230492805583092c52ccc87e3be7740ba794c3f
Reviewed-on: https://go-review.googlesource.com/40652
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-13 18:39:38 +00:00
Josh Bleecher Snyder
9bf174b4d3 cmd/stringer: use source importer when available
This means that running stringer should always
have the intended effect, without having to
go install the package first, which was a common
source of confusion.

The source importer is marginally slower,
but stringer is run infrequently,
and we're only typechecking one package (and fmt),
not an entire tree, as vet does.

Fixes golang/go#10249

Change-Id: Ib8cde29bd6cc596964dbe7348065932dd59075fc
Reviewed-on: https://go-review.googlesource.com/40403
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-04-12 18:56:47 +00:00
Dmitri Shuralyov
ef3dcd5937 cmd/heapview: look for tools repository in all GOPATH entries
The GOPATH environment variable is defined at
https://golang.org/cmd/go/#hdr-GOPATH_environment_variable as:

> The GOPATH environment variable lists places to look for Go code. On
> Unix, the value is a colon-separated string. On Windows, the value is
> a semicolon-separated string. On Plan 9, the value is a list.

It is legal for Go packages to be in any of those places, not only
the first entry. Look in all places for golang.org/x/tools repository.

Cache the directory that is found. It's slightly more expensive
to look for it, since potentially multiple directories must be
checked for existence.

Updates golang/go#19400.

Change-Id: I16661b7149d52ea6168fffc605c842d7a4da009b
Reviewed-on: https://go-review.googlesource.com/38778
Reviewed-by: Michael Matloob <matloob@golang.org>
2017-04-10 18:12:01 +00:00
Josh Bleecher Snyder
6e29264c4f cmd/compilebench: fix package name in comment
Change-Id: Ie5c413fc9f13cf029d8d8a6cae5754838c834395
Reviewed-on: https://go-review.googlesource.com/40170
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-10 17:39:46 +00:00
Giovanni Bajo
5584fb0720 gotype: fix default importer for Go 1.8.
Importer "source" does not exist in Go 1.8, so this means that
default usage of gotype is broken in that compiler version.

Change-Id: I517520b0cac7c62a3e213d0647a3d621e8ced58c
Reviewed-on: https://go-review.googlesource.com/40091
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-10 16:28:46 +00:00
Josh Bleecher Snyder
24acc66eab cmd/compilebench: put in correct subdirectory
Apparently there was a typo during initial import,
and compilebench was placed at the top level,
rather than in the cmd subdirectory. Oops. Fix that.

Change-Id: Ibea9ed132dca26c022ea02933defec9534105f18
Reviewed-on: https://go-review.googlesource.com/39792
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-06 18:57:16 +00:00
Josh Bleecher Snyder
5054e612af cmd/toolstash: don't build cmd for android
Linking cmd for android requires a cross-compiling toolchain,
which is not standard fare.

Skip it, and trust that the other platforms will pick up the slack.

Change-Id: Ifcf74f77e98489c859805ab7a448d80d019f3d20
Reviewed-on: https://go-review.googlesource.com/39556
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-05 15:47:30 +00:00
Kevin Burke
37a1062ad0 cmd/tip: redirect http://tip.golang.org to https
At some point we switched tip.golang.org to run in GKE, which
terminates TLS directly on port 443. This requires a new technique
for detecting a plain HTTP connection. In addition we may want to run
talks.golang.org on App Engine Flex, which uses an X-Forwarded-Proto
header to indicate HTTP, so let's prepare for that possibility.

Fixes golang/go#19759.

Change-Id: Iddc567214c5d28f61c405db065aa1b3f2c92fd85
Reviewed-on: https://go-review.googlesource.com/38800
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-03 05:32:14 +00:00
Kevin Burke
620ecdb8d7 all: apply new machine-generated doc spec to files
Updates golang/go#13560.

Change-Id: I1664807a065c7982a57d4dc9cee22ce261536c5b
Reviewed-on: https://go-review.googlesource.com/39202
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-01 01:24:29 +00:00
haya14busa
d83db204ce cmd/goimports: flush to disk before diffing
Port of gofmt change at golang.org/cl/36750

Change-Id: Ie0ef6770be6361264ed45a9a9ece950aba24e852
Reviewed-on: https://go-review.googlesource.com/39073
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-31 04:14:08 +00:00
Yasuhiro Matsumoto
d63e2b22b0 cmd/toolstash: use strings.LastIndexAny
Change-Id: I06a4610a5f5c49806a1b151a65c25bbbd881a314
Reviewed-on: https://go-review.googlesource.com/38753
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-28 14:23:59 +00:00
Yasuhiro Matsumoto
474a26d4c8 cmd/guru: Close before Remove a file
Change-Id: Ia12ff7a0f6898f8d140565d255793904ce8585c4
Reviewed-on: https://go-review.googlesource.com/38754
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-28 13:38:24 +00:00
Yasuhiro Matsumoto
963fe939f1 cmd/heapview: remove needless slash
Change-Id: Ie19a60595862c0afff9364ee21dd9598370e6c91
Reviewed-on: https://go-review.googlesource.com/38752
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-28 13:38:09 +00:00
Josh Bleecher Snyder
322b9d710a cmd/toolstash: use 'go tool dist list' to get platforms
This fixes several issues:

* The ls sed hackery generates GOARCH values mipsx and mipsxle,
  instead of mips, mips64, mipsle, and mips64le.
* It removes the dependence on the 9 command.
* It marginally increases readability.

Change-Id: Ie46abc289c2c9923eed693dcf1194f4fd3ea9bd2
Reviewed-on: https://go-review.googlesource.com/38347
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-03-22 14:37:47 +00:00
Matthew Dempsky
81dff79736 cmd/godoc: fix tests for cmd/compile refactorings
In golang.org/cl/38089, I removed all of the prog.go files.

Change-Id: I4d8dd021a62b5d6d8b7cb5cfe0ecd7268812805c
Reviewed-on: https://go-review.googlesource.com/38432
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-21 23:01:40 +00:00
Rob Pike
23ca8a2633 cmd/stringer: tweak "Code generated by" comment to match new standard
See https://golang.org/issue/13560 for the full discussion.

The actual change is just the addition of a final period.

Update golang/go#13560

Change-Id: Icc2f52b67181de344aa5107f94faa0e739ff993c
Reviewed-on: https://go-review.googlesource.com/38415
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-03-21 04:07:08 +00:00
Josh Bleecher Snyder
a5c9681e31 cmd/toolstash: don't pass -N when compiling runtime
The runtime cannot be compiled with optimizations disabled.
This lead to very confusing error messages
when toolstash -cmp failed.

Change-Id: Ie341d633ff9b26693b475957309591ff0757f1ab
Reviewed-on: https://go-review.googlesource.com/38378
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-03-20 21:03:53 +00:00
Tamir Duberstein
6185cb1f31 cmd/goyacc: remove empty branch
Found with honnef.co/go/tools/cmd/staticcheck.

Change-Id: I39e23936e01543db62b7b0919a3b58b65cd40099
Reviewed-on: https://go-review.googlesource.com/38174
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-15 21:33:42 +00:00
Tamir Duberstein
43bc42d6f5 cmd/goyacc: remove unused functions
Found with honnef.co/go/tools/cmd/unused.

Change-Id: Ie7ee9f687bcec1faa40c890a84666ef6c27d9b77
Reviewed-on: https://go-review.googlesource.com/38176
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-15 21:33:35 +00:00
Tamir Duberstein
d332283808 cmd/goyacc: remove ineffective break statement
Found with honnef.co/go/tools/cmd/staticcheck.

Change-Id: I7f765ef1710d151ebda5716c99587acd3a90db1f
Reviewed-on: https://go-review.googlesource.com/38173
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-15 15:30:16 +00:00
Tamir Duberstein
1f5953e340 cmd/goyacc: use a constant instead of zero value
Found with honnef.co/go/tools/cmd/unused.

Change-Id: I373d710e0f5f98dcf591826a26541d1d12696e14
Reviewed-on: https://go-review.googlesource.com/38175
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-15 15:28:09 +00:00
Tamir Duberstein
ab34c5f581 cmd/goyacc: remove unused generated bindings
Found with honnef.co/go/tools/cmd/unused (in CockroachDB).

Change-Id: I0e2f7ac6ad2a0fdc724928f316060f06c3261ece
Reviewed-on: https://go-review.googlesource.com/38178
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2017-03-14 23:14:11 +00:00
Tamir Duberstein
f2e43688df cmd/goyacc: merge variable declaration with assignment
Found with honnef.co/go/tools/cmd/simple.

Change-Id: I04c65394f1c6404f57bb2088353325899f35011f
Reviewed-on: https://go-review.googlesource.com/38177
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2017-03-14 23:13:33 +00:00
Robert Griesemer
2f69a5922b cmd/gotype: make it compile against Go 1.8 and earlier
types.SizesFor was introduced for Go 1.9. Need to provide
a local implementation to have gotype build against earlier
versions.

Fixes golang/go#19545.

Change-Id: I6fdbe414e6574eda00c01295b666230daff2dfdc
Reviewed-on: https://go-review.googlesource.com/38157
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-14 21:50:22 +00:00
Robert Griesemer
381149a2d6 cmd/gotype: re-introduce gotype command at traditional location
Except for the added comment in the beginning and the removal of
the 'ignore' build tag, there is no difference between gotype.go
and the original.

Fixes golang/go#19516.

Change-Id: Ie1ab9aced6e650573c2cdce0c165af1e1094213f
Reviewed-on: https://go-review.googlesource.com/38132
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-13 17:37:17 +00:00
Alan Donovan
7fdb908ead cmd/guru: fix tests now that go1.9 go/types returns fake packages
The go1.9 type checker now returns fake packages in addition to an
error if the package was not found at all.  This changes the behavior
of guru in a release-specific way, requiring the test to be split into
a common part and a go1.9-specific part.

In hindsight, perhaps it would have been better to place the
expectation in a comment alongside the query so that they can be
easily enabled or disabled together.  (The downside of that design is
that you can't batch-update all the expectations to match the actual
behavior.)

Change-Id: I58054adec428fbab7fe3c57097aefc827f89a46e
Reviewed-on: https://go-review.googlesource.com/37865
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-08 23:16:52 +00:00
Brad Fitzpatrick
03d3934baf cmd/tip: move tip.golang.org from App Engine to Kubernetes on GKE
Change-Id: I52ca7eaca98de27bd920ae01086b3f7724819738
Reviewed-on: https://go-review.googlesource.com/37754
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2017-03-07 03:49:08 +00:00
Dmitri Shuralyov
f595fb5c96 cmd/godoc, godoc: implement build.Context.IsDir, update expected error string
Prior to this change, handlerServer.GetPageInfo created a build.Context
starting with build.Default, and provided custom implementations for
its IsAbsPath, ReadDir, and OpenFile funcs. Those funcs would operate
on h.c.fs virtual filesystem.

https://godoc.org/go/build#Context.IsDir is documented as:

	// IsDir reports whether the path names a directory.
	// If IsDir is nil, Import calls os.Stat and uses the result's IsDir method.
	IsDir func(path string) bool

IsDir was left as nil, and so the default implementation was used.
The default implementation uses os.Stat and isn't aware of the h.c.fs
virtual filesystem.

This appears to have been harmless in the past, but after the change to
go/build in https://golang.org/cl/33158, it started to interfere with
the operation of godoc. The command godoc began to fail to resolve
relative import path "." in directories that exist, because the
incorrect IsDir implementation was looking in real filesystem, rather
than the virtual one:

	$ ./godoc fmt
	2017/03/04 18:59:50 cannot find package "." in:
		/target
	$ ./godoc -http=localhost:6060
	2017/03/04 19:00:07 cannot find package "." in:
		/src/fmt

Providing a custom implementation of IsDir that is aware of the h.c.fs
virtual filesystem, and performs a stat operation on the correct path
there resolves that problem. It also fixes the failing tests.

Additionally, because the exact error string returned from
Context.Import has changed after https://golang.org/cl/33158,
and now contains the text "package not found" rather than the
underlying error text from filesystem caused by a failed ReadDir
operation, the expected error message from "./godoc nonexistingpkg"
in a test needed to be updated to "cannot find package". It's no longer
dependent on the operating system.

It might be desirable to provide more relevant detail in the error
message from cmd/godoc when a package is not found, but that should be
determined and done in a followup CL. The scope of this one is to fix
normal functionality.

This change follows update to go/build in https://golang.org/cl/33158.

Helps golang/go#19401.

Change-Id: I00e2f746ec4a2fe7e640218adce75f15bdf29aaf
Reviewed-on: https://go-review.googlesource.com/37768
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-05 21:32:12 +00:00
David R. Jenni
8ffd8eda92 x/tools/cmd/guru: fix golden files for what query
CL golang.org/cl/37349 broke the tests, because the
golden files were not updated appropriately.

Change-Id: I9a2a56d1ca74b8bc77935aff26ed6297fbacf232
Reviewed-on: https://go-review.googlesource.com/37770
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Run-TryBot: Dominik Honnef <dominik@honnef.co>
2017-03-04 20:46:07 +00:00
Alan Donovan
3537037b0b cmd/guru: report 'whicherrs' in modes of 'what' query
A 'what' query reports which other query modes are applicable to the
selected syntax.  A 'whicherrs' query is similar to a 'pointsto'
query, so we enable it using the same criteria.

Fixes issue golang/go#18938

Change-Id: Iae062e0c933c7764bc335488adabf816d63ac837
Reviewed-on: https://go-review.googlesource.com/37349
Reviewed-by: Dominik Honnef <dominik@honnef.co>
2017-03-04 02:31:33 +00:00
Dmitri Shuralyov
a663d825ff cmd/godoc: Fix package comment inconsistencies.
Remove inadvertent and unwanted spaces in the middle of an
indented block.

Insert blank lines before indented sections for consistency.

Insert colon after "pointer" for consistency with "type".

Fixes golang/go#19356.

Change-Id: Iaae12f69d17adb51a27b516727c13132cb8df8e8
Reviewed-on: https://go-review.googlesource.com/37660
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Run-TryBot: Dominik Honnef <dominik@honnef.co>
2017-03-04 00:53:44 +00:00
Robert Griesemer
f5a6ee1ea9 cmd/gotype: delete this command in favor of go/types/gotype.go in the std lib
Change-Id: Ifd03e5ec607ff127ab11c307d99877de81aeacf2
Reviewed-on: https://go-review.googlesource.com/37657
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-02 22:45:06 +00:00
David R. Jenni
fd9cb7c10f x/tools/cmd/html2article: remove unused functions
Found with honnef.co/go/tools/cmd/unused.

Change-Id: Ifd1ed4005eec55cebfd5c0d0519b8af328fcc470
Reviewed-on: https://go-review.googlesource.com/37601
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:53:04 +00:00
David R. Jenni
8211efe185 x/tools/cmd/guru: remove unused method.
Found with honnef.co/go/tools/cmd/unused.

Change-Id: Ied3a906269ca7782071428eeb1764b3b863576a2
Reviewed-on: https://go-review.googlesource.com/37600
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:52:51 +00:00
David R. Jenni
e06694fefd x/tools/cmd/godoc: remove unused variable
Found with honnef.co/go/tools/cmd/unused.

Change-Id: I3db2aad14de33f0be69569cd355e453173098358
Reviewed-on: https://go-review.googlesource.com/37599
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:52:40 +00:00
David R. Jenni
43de7a390a x/tools/cmd/goyacc: remove unused function.
Found with honnef.co/go/tools/cmd/unused.

Change-Id: Iad26e1ae1dbeb29a3223279eccc4ba6f6bb48bd6
Reviewed-on: https://go-review.googlesource.com/37631
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:38:58 +00:00
David R. Jenni
718875e4f9 x/tools: simplify and format code
Semi-mechanical changes using gofmt -s
and honnef.co/go/tools/cmd/gosimple.

Change-Id: I41bcf4bea5b16c4776b7cf6534b76aa59b3c022d
Reviewed-on: https://go-review.googlesource.com/37447
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-28 14:15:42 +00:00
Paul Jolly
8e779ee0a4 x/tools/cmd/gotype: support type checking of xtest packages.
As noted by griesemer in golang/go#18799, this doesn't address the issues
raised in golang/go#11415 because when checking an xtest package the
corresponding package is assumed to have been installed. This
however is similar to the assumptions made by go vet (raised
as an issue in golang/go#16086). So whilst not perfect, it will probably
suffice until golang/go#11415 is resolved.

Fixes golang/go#18799

Change-Id: I1ea005c402e5d6f5abddda68fee6386b0531dfba
Reviewed-on: https://go-review.googlesource.com/36992
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-02-17 23:47:18 +00:00
David R. Jenni
cc429c273c x/tools/cmd/guru: gofmt -s -w
Change-Id: Idf3d1865b0c349ad45d983fac1c52e7729bf0069
Reviewed-on: https://go-review.googlesource.com/32793
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-02-15 21:41:53 +00:00
Alan Donovan
6e7ee5a9ec x/tools: support Go 1.9 type aliases
For #18130.

Change-Id: Ice695602619dbbf851af970e790f07ff2ac2c141
Reviewed-on: https://go-review.googlesource.com/36623
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-02-13 21:46:59 +00:00
haya14busa
44492e23b4 cmd/goimports: use actual filename in goimports -d output
Port of gofmt change at golang/go#18932 with golang/go#18999 fix

Change-Id: I8999d6a3e04946086dd159201dbc4b09338bf1c0
Reviewed-on: https://go-review.googlesource.com/36644
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-09 17:25:24 +00:00
Ted Kornish
396c176f11 godoc: preserve ?m=... query string
Right now, clicking around packages in the godoc web interface strips
the URL of any query strings it may have, which makes traversing
internal packages a clumsy experience (constantly have to re-add ?m=...).

This revision preserves the ?m=... flag in links between packages by examining
the current PageInfoMode and converting it to a query string.

Change-Id: I4e28279d8cbf221bcc7d5bce8de04c90cc907678
Reviewed-on: https://go-review.googlesource.com/34982
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 21:12:11 +00:00
Alan Donovan
b56ef30191 tools: updates for minimum Go version 1.6
Details:
- remove go1.5 "default version" labels on most files
- remove go1.6 labels on a few files
- go/loader: use conf.Cwd not "." in a couple places; update faulty
  test expectations.  (Not sure why this wasn't caught sooner.)
- go/ssa/interp: add 'mono' result to time.now intrinsic
- go/gcimporter15/bimport.go: make consistent with the version in gc
- go/ssa/interp: update test error message
- go/ssa: update a comment

The go/gcimporter15/bexport.go logic is stale and needs to be brought
up to date.  Needs a separate CL since it's tricky.

Tested on go1.6, go1.7, go1.8.

Change-Id: I841189d30e131b7c49a4e8690ea7c40b55041bae
Reviewed-on: https://go-review.googlesource.com/36540
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-02-07 21:06:19 +00:00
Hsin Tsao
f5bb18ad35 cmd/godoc: add better user error messages
Fixes golang/go#14280

Change-Id: I3151a17ce9553d0a7fe56c2d614e3a6f6a96344c
Reviewed-on: https://go-review.googlesource.com/36472
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-07 01:00:00 +00:00
Koichi Shiraishi
f8ed2e405f cmd/guru: fix typo of 'hyphen' to rename to 'comma'
start|end byte offset separator is not hyphen(-), actually comma(,)

Change-Id: I344ae74d33863e9456e8cdb2f058fd70f1eedf95
Reviewed-on: https://go-review.googlesource.com/35770
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-01-25 19:35:15 +00:00
Robert Griesemer
0d047c8d5a cmd/godex: handle printing of type aliases
Also: remove go1.5 build tags (x/tools requires Go 1.6 or higher).

For golang/go#18130.

Change-Id: I3d9deee9e87d8794b2884281c0bb53caa5ed6221
Reviewed-on: https://go-review.googlesource.com/35106
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-01-11 21:17:45 +00:00
Kevin Burke
cb538dbcf8 godoc: add README
Explain how to make changes to the project's static files and get them compiled
in to the godoc binary.

Change-Id: I12e0c50bf31925b3f211b6d0dd3e5f8cff547f32
Reviewed-on: https://go-review.googlesource.com/34925
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-09 19:14:34 +00:00
Daniel Martí
354f9f8b43 cmd/cover: check os.Create error im html output
The error was being written over by Execute.

Change-Id: Id5965542bf4d414043fdbe70ee3f2f790728c01d
Reviewed-on: https://go-review.googlesource.com/34954
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-01-08 00:00:17 +00:00
Russ Cox
908849c337 cmd/godoc: add perf subrepo
For golang/go#14304.

Change-Id: Ia90193d3a9ad027231f977ffa6b66cf60ea40683
Reviewed-on: https://go-review.googlesource.com/34615
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-20 20:09:41 +00:00
Russ Cox
c6da36ac37 cmd/tip: update tools hash to include CL 33662
Change-Id: Ifab1436d10b5b738a3386969cb41b7353711c3a5
Reviewed-on: https://go-review.googlesource.com/34690
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-12-20 20:09:33 +00:00
Rebecca Stambler
99be5a0b85 go/buildutil, cmd/guru: resolve symlinks in filenames through build.Context
Resolve symlinks in source directories (GOPATH, GOROOT, etc.) and source
files in order to find correct package. All I/O performed through
build.Context. Also add minor fix to guru unit tests in order to pass on
Windows.

Change-Id: Ie6134b9cd74eb7386e1d93603eb37c8e44b083b8
Reviewed-on: https://go-review.googlesource.com/33924
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-12-06 21:45:43 +00:00
Rebecca Stambler
4073e786f5 cmd/guru: avoid testing symlinks on OSes that do not support them
Add condition to prevent unit tests from checking cases with symlinks on
Windows and Plan 9.

Change-Id: Idc41db94a04a0daab556a26390db3f75ded7be73
Reviewed-on: https://go-review.googlesource.com/33923
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-12-06 20:51:22 +00:00
Rebecca Stambler
07e766bf81 Revert "go/buildutil, cmd/guru: fix tests for symlinks in guru and gorename to account for windows."
Reason: ContainingPackage must do all I/O through build.Context.

This reverts commit c945ee3be4.

Change-Id: I625410bc754ea2d150be097bf424de2be42acde4
Reviewed-on: https://go-review.googlesource.com/33921
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-12-05 22:43:53 +00:00
Rebecca Stambler
c945ee3be4 go/buildutil, cmd/guru: fix tests for symlinks in guru and gorename to account for windows
Restructure tests to account for possibility of being run on Windows
(which doesn't handle symlinks).

Change-Id: I428db26c9a1aad337d8972baa2b71468be3a2e58
Reviewed-on: https://go-review.googlesource.com/33920
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-12-05 21:18:37 +00:00
Rebecca Stambler
366e27042d cmd/guru: handle source file aliasing gracefully
Resolve symlinks in GOPATH or source file path in order to find correct package.

Fixes golang/go#17515

Change-Id: Iaf7e85578fce040b329427ce6f51948a69e57a39
Reviewed-on: https://go-review.googlesource.com/33858
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-12-02 22:01:05 +00:00
Brad Fitzpatrick
0f86c627e2 cmd/godoc: optional ACME autocert support
If built with the "autocert" build tag, use
golang.org/x/crypto/autocert and for automatic TLS certs.

This will be used for https://beta.golang.org/ running on GCE.

Change-Id: Id0e385796a25d663708ea9bb65c45cb1471dd526
Reviewed-on: https://go-review.googlesource.com/33751
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-11-30 23:52:24 +00:00
Brad Fitzpatrick
b66e054640 Revert "refactor/eg: remove vendor prefix from imported packages"
This reverts commit c060f04f93.

Reason for revert: breaks the build. Nobody ran tests.

Change-Id: I981101eb503e8cebd6f7b5640299d106ca733b33
Reviewed-on: https://go-review.googlesource.com/33674
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-30 00:13:03 +00:00
Russ Cox
955e2aeb12 cmd/present: fix indentation in template
No semantic change.
Pointed out by Dmitri Shuralyov on CL 33578.

Change-Id: Ic67f41e8dde8fc9bf624c98307a89bbe1f10e7f7
Reviewed-on: https://go-review.googlesource.com/33659
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-11-29 18:43:27 +00:00
Russ Cox
76b6c242fb cmd/tip: update talks rev to pick up CL 33578
Change-Id: I5161f7ee490391a71a3c9a00017b2449705fcb7a
Reviewed-on: https://go-review.googlesource.com/33655
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-11-29 03:26:09 +00:00
Russ Cox
f19f04f549 cmd/present: adjust article presentation
* Give the article title a larger, heavier font than any heading.
  It was strange that the title was 20px regular while the
  h1 section headings were 24px.

* Move the author attribution to the top of the page.
  Author at the bottom, like a signature, may make sense for blog posts,
  but I think it makes less sense for articles.

* Fix the spacing around author lines. Each author line is a <p>
  and the intent seemed to be to cut the vertical space between them
  but that wasn't working.

* Give the table of contents a title, to make clearer what it is.
  Do not show table of contents in printouts.

Change-Id: Iee940ca7697015281fc057750f5db56f70393836
Reviewed-on: https://go-review.googlesource.com/33578
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-11-29 02:21:02 +00:00
Rhys Hiltner
c060f04f93 refactor/eg: remove vendor prefix from imported packages
For package paths that include a "vendor" segment, use only the
portion of the path that comes after the final "vendor" segment, as
is done by the imports package.

Fixes golang/go#17247

Change-Id: Ic83c4662cfddd1a696c206494b3a869e8c7dff5c
Reviewed-on: https://go-review.googlesource.com/29851
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-28 19:57:48 +00:00
Jordan Lewis
ebf631f917 cmd/goyacc: quadruple the max states and actions
This commit quadruples the maximum number of states and the size of the
action table to allow for larger grammars.

Fixes golang/go#11517

Change-Id: Ieb64efa8e3402ae1a5a9190710f98a44195ecd1b
Reviewed-on: https://go-review.googlesource.com/33585
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-28 18:37:26 +00:00
Rebecca Stambler
e64f1a4c63 cmd/guru: add workaround to handle inconsistency between go/types and gc
Add identical workaround from gorename to guru. Only affects queries
that typecheck the code first.

Fixes golang/go#16530

Change-Id: I718cfceb8d26868eea9128c8873b164333c50f53
Reviewed-on: https://go-review.googlesource.com/33359
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-23 20:09:00 +00:00
Josh Bleecher Snyder
44b4c5d044 cmd/toolstash: fix format string arguments
Found by vet.

Follow-up to comments on CL 32682.

Change-Id: I76391e02b9991bc480404f634ea809e75645e9dc
Reviewed-on: https://go-review.googlesource.com/32918
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-08 20:54:22 +00:00
Alan Donovan
701d657347 tools: remove go1.8-tagged files
Change-Id: Ib52b85e1c981b6fca55c472120371a0cd37d2dc9
Reviewed-on: https://go-review.googlesource.com/32816
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-04 21:29:52 +00:00
Alan Donovan
0e041570eb cmd/guru: revert support for Go 1.8 aliases
Change-Id: I8ba368d5036be47b6d64e3576f366eb0301d2d5b
Reviewed-on: https://go-review.googlesource.com/32831
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-04 21:18:07 +00:00
Alan Donovan
8cbea6846d cmd/bundle: revert support for Go 1.8 aliases
Change-Id: I2b3bcc7653507e392b243dbe0610adc6be6967bd
Reviewed-on: https://go-review.googlesource.com/32833
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-04 21:17:06 +00:00
Josh Bleecher Snyder
c74ac01963 cmd/toolstash: adapt to golang.org/x/tools
This repo already contains an identical LICENSE.
The README adds little, particularly in golang.org/x.
Update the custom import path comment.

Change-Id: I23fb5e31df6ff4828d298d44dc30dca901b0627b
Reviewed-on: https://go-review.googlesource.com/32682
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-11-04 00:31:34 +00:00
Josh Bleecher Snyder
133d2e05a6 cmd/toolstash: import from rsc.io
This CL copies rsc.io/toolstash verbatim at commit
7508e1dd47d11b2fc45f544415e014e4f25d3f95
to golang.org/x/tools/cmd/toolstash.
There are no code changes to adapt it
to its new home; those will happen in a follow-up CL.

rsc.io/toolstash will be updated to contain only
a README and a doc.go redirecting readers.

Change-Id: Icbef4d72215a8b124f857587905b45902d6cdece
Reviewed-on: https://go-review.googlesource.com/32681
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-11-04 00:31:11 +00:00
Alan Donovan
55f54c0061 Revert "cmd/stringer: reject Go 1.8 type aliases"
This reverts commit 9a286cdc33.

Reason for revert: go1.8 code in a go1.7 file.

Change-Id: I5465820c60197f4288243d1b15b1be20531b923d
Reviewed-on: https://go-review.googlesource.com/32733
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-11-03 22:16:55 +00:00
Alan Donovan
242b5dc780 godoc: changes to support aliases
Fixes golang.org/go#17763

Change-Id: I18012dcfd878db916cbb940c3a361a89341b9209
Reviewed-on: https://go-review.googlesource.com/32711
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-03 21:57:37 +00:00
Alan Donovan
d15da3015c cmd/guru: describe Go 1.8 aliases
Also:
- always display the value of a constant expr, whether query expr is a
  definition, a reference, or an alias.
- eliminate some go1.5 portability code.
- remove go1.8 fork of referrers; no changes are necessary
  since I decided not to treat aliases specially.
- add tests.

Tested with Go 1.6, Go 1.7, and tip (Go 1.8).

Change-Id: I94624cff82f4d8c0dcbf12d11c8ce16e8168a7fe
Reviewed-on: https://go-review.googlesource.com/32730
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-03 21:55:02 +00:00
Alan Donovan
9a286cdc33 cmd/stringer: reject Go 1.8 type aliases
Change-Id: I56e615bf202ca2018602c93e66ecdbc2577335e2
Reviewed-on: https://go-review.googlesource.com/32731
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-03 21:54:35 +00:00
Alan Donovan
4d145add37 cmd/ssadump: fix typo that broke -run
Change-Id: I6cc618a3cf1036f4dffb2acad766d86c14d658cd
Reviewed-on: https://go-review.googlesource.com/32645
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-03 16:19:08 +00:00
Alan Donovan
4549178751 x/tools: clone some files in preparation for alias changes
This CL only copies files and updates build tags.
Substantive changes will come in follow-ups.
This is a workaround for git's lack of rename/copy tracking.

Tested with go1.6, go1.7, and tip (go1.8).

Change-Id: Id88a05273fb963586b228d5e5dfacab32133a960
Reviewed-on: https://go-review.googlesource.com/32630
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-02 16:57:37 +00:00
Alan Donovan
1529f889eb cmd/guru: report start and end positions for non-PkgName Objects
Most objects are declared by an identifier, so the end position is
start+len(name).  However, this heuristic doesn't work for PkgName
objects because a (non-renaming) import creates an object without an
identifier.

Fixes issue github.com/Microsoft/vscode-go#562

Change-Id: I0eb44ca33a643c910d97abbf700ea4c3cd23bb41
Reviewed-on: https://go-review.googlesource.com/32440
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-31 16:37:29 +00:00
Alex Carol
c6efba04dd present: add speaker notes to the title page
Change-Id: I68f17f933e2526c6419e1463acfcb3c838aeecf4
Reviewed-on: https://go-review.googlesource.com/31396
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
2016-10-19 22:19:41 +00:00
Alan Donovan
8e53eb937b go/ssa: support custom TestMain functions in test packages
Supporting user-defined TestMain functions requires that we generate a
"testmain" package for each testable package, rather than a single one
for the entire program.  This entails these API changes:

1. (*ssa.Program).{CreateTestMainPackage,FindTests} both now
   accept only a single package.  Existing clients that pass them
   multiple packages must call them from a loop.

2. (*ssa.Program).FindTests returns an additional result, the the
   optional TestMain *ssa.Function.  Existing clients may discard it.

Also:
- Test the new logic using the SSA interpreter
- add ssautil.MainPackages helper
- callgraph: allow multiple main packages, and analyze them all
- ssadump -run: allow multiple main/test packages, and run each in a new interpreter
- minor simplifications to some callers (e.g. guru)

Fixes golang/go#9553

Change-Id: Ia7de9bd27448fb08b8d172ba5cdbcf37a762b7a0
Reviewed-on: https://go-review.googlesource.com/25102
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-19 17:50:59 +00:00
Alan Donovan
69f6f5b782 cmd/guru: remove Emacs support, now at github.com/dominikh/go-mode.el
Change-Id: I4350331b4f047b7388c274157ecbd49a582cf091
Reviewed-on: https://go-review.googlesource.com/30991
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-13 18:55:30 +00:00
Alan Donovan
ab8f7d902d cmd/guru: remove Vim support, now at github.com/fatih/vim-go
Change-Id: I94f478e32f358fd23dc187fcfbca9c05bf7da576
Reviewed-on: https://go-review.googlesource.com/30990
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-13 18:54:40 +00:00
Alan Donovan
d9f9484612 cmd/oracle: oracle is dead, long live guru
Change-Id: I0f729b1477d8b14f255538414087d25f99b20c1e
Reviewed-on: https://go-review.googlesource.com/30982
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-13 18:53:55 +00:00
Brad Fitzpatrick
a2b1312ca0 cmd/godoc: increase test timeout
Darwin was flaking. Its HFS filesystem is probably too slow.

Change-Id: I44ea6de8dae8054d41c94c0c36e703e62fbdfcd9
Reviewed-on: https://go-review.googlesource.com/30954
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-10-12 16:04:38 +00:00
Brad Fitzpatrick
41f4ee4e59 cmd/godoc, cmd/fiximports: fix or skip failing tests at tip
Fix godoc test failure.

Skip fiximports test failure for now, to not hide other
failures. (tracking bug to fix properly in golang/go#17417)

x/tools being broken is preventing use of trybots for unrelated CLs.

Change-Id: I3a1deee4036096e0377cf8b63fabe444c58dd86e
Reviewed-on: https://go-review.googlesource.com/30953
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-10-12 15:24:30 +00:00
Syohei YOSHIDA
5e567c6dff cmd/guru: emacs: Use cl-lib.el instead of cl.el
This package requires cl-lib.el in package header but it is not loaded
and cl.el functions are used instead of cl-lib functions. Using cl.el
functions causes byte-compile warnings.

Change-Id: I6d9400f9ced6a5cc0592d83da2ab1c1cf34e20b8
Reviewed-on: https://go-review.googlesource.com/27031
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-10-12 14:21:26 +00:00
Francesc Campoy
8453f27cc7 present: make code in slides editable only with -edit
Also added a suite of tests and fixed a minor bug that
caused a panic when the .code command specified HL with
no text after.

Fixes golang/go#17379.

Change-Id: I3c246523c3d4010bf76a467ee648475255090e1b
Reviewed-on: https://go-review.googlesource.com/30691
Reviewed-by: Rob Pike <r@golang.org>
2016-10-07 20:29:58 +00:00
Tamir Duberstein
4c4edc0bec cmd/goyacc: remove hardcoded NTYPES
Updates #16144.

Change-Id: I196dd4e871c88792ea95c02b31c54f269fdc505f
Reviewed-on: https://go-review.googlesource.com/27350
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-10-07 17:45:45 +00:00
Alan Donovan
27f88d9b7a cmd/guru: if query file is not beneath GOPATH, treat it as a package
This allows type-based guru queries to work on arbitrary files at the
root or even outside of a GOPATH workspace (as "go run foo.go" does).

Fixes golang/go#15797

Change-Id: I2be28f7259448e6398aae84d6ae7e71d8649967a
Reviewed-on: https://go-review.googlesource.com/30451
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-05 18:29:27 +00:00
Mohit Agarwal
73d2e795b8 cmd/godoc: fix command for creating the zip file
The `-r` option (to recurse into directories) need to be specified
else the created file consists only of the specified directory and
nothing else.

Change-Id: I624184fc2e88998a3119c12f8c328603588c123c
Reviewed-on: https://go-review.googlesource.com/17283
Reviewed-by: Russ Cox <rsc@golang.org>
2016-10-04 20:51:58 +00:00
Brad Fitzpatrick
f1a397bba5 cmd/bundle: add flag to rewrite golang.org/ to golang_org/ in imports
I've been doing this by hand since Go 1.7rc2.

Updates golang/go#16333

Change-Id: Ib12c013b14210123d48d6ad78922caf1286c20cc
Reviewed-on: https://go-review.googlesource.com/29086
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-09-13 16:37:30 +00:00
Dmitri Shuralyov
5cb1c80a83 cmd/bundle: Support renaming imports.
Document a risk of generating invalid code due to shadowing between
identifiers in code files and the imported package names.

This risk was present before for any package with more than 1 .go file,
but it's increased when some files have renamed imports (since they're
typically used to resolve shadowing conflicts).

Resolves TODO(adonovan): support renaming imports.

Change-Id: Ie0e702345790fd2059c229623fb99fe645d688a4
Reviewed-on: https://go-review.googlesource.com/23785
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-08-24 17:03:01 +00:00
David R. Jenni
6e2a0ce36e cmd/guru: show correct definition for embedded type.
Fixes golang/go#16263.

Change-Id: I081a12306ac5415d2223e3509a29a1b47700e1ff
Reviewed-on: https://go-review.googlesource.com/27001
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-08-24 12:03:13 +00:00
Tamir Duberstein
df703d6484 cmd/goyacc: remove unused constants
Change-Id: I48002d39de6d32ee9410fd4271f623b5661f0081
Reviewed-on: https://go-review.googlesource.com/27328
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-18 16:45:58 +00:00
Brad Fitzpatrick
f1ba7e38e5 cmd/goyacc: move go tool yacc from the go repo
This moves the 'go tool yacc' command from the main Go repo
to x/tools.

Copied from go rev 795ad07b3 + doc changes from "go tool yacc" to "goyacc".

Updates golang/go#11229

Change-Id: I6d17911a3bf64724c090c4fe4903238e3bce3b8c
Reviewed-on: https://go-review.googlesource.com/27324
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-08-18 15:37:45 +00:00
Michael Matloob
08b1e0510c x/tools/cmd/heapview: add a sidebar to hold navigation
This change also puts more structure into the viewer.
Adds an enum for events that we'll issue and a few more elements
to organize things.

Change-Id: I39c7c53422779348ca05f051c6b0b07d22ad6a00
Reviewed-on: https://go-review.googlesource.com/26656
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-08-16 17:33:40 +00:00
Tamir Duberstein
0e9f43fcb6 cmd/goimports: work around lack of runtime/trace in gccgo
Moves runtime/trace support (including its command line flag) behind
a "gc" build tag to allow goimports to build under gccgo, which does
not support runtime/trace.

Updates golang/go#15544.

Change-Id: I017a44089c0a4f3d3ba98815d57a141e25b3fe56
Reviewed-on: https://go-review.googlesource.com/26998
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-13 05:07:58 +00:00
Michael Matloob
68cf18548e x/tools/cmd/heapview/internal/core: stub mmapfile for !darwin,!linux
mmapfile.go uses symbols in the syscall package that are not defined
on windows and some other operating systems. Temporarily
buildtag-restrict mmapfile to darwin and linux (the platforms easiest
for me to test) to fix the build.

Change-Id: Ib056608a655b6d32170cd86deac785811e7bc0d1
Reviewed-on: https://go-review.googlesource.com/26830
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-11 13:58:04 +00:00
Michael Matloob
855bbc50ad cmd/heapview: add an internal core package for reading cores
This is based on github.com/tombergan/goheapdump/heapdump.

This CL mostly just copies over the 'raw' data structures based
on the profiler records' data structures. Many of them may need
to be changed, but I think it will be good to have these definitions
here to provide a base.

Change-Id: I609202b6b87d980b0835c8087b3d78e11bd6dfe3
Reviewed-on: https://go-review.googlesource.com/25584
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-08-09 19:00:08 +00:00
Michael Matloob
29462195f2 x/tools/cmd/goimports: define verbose flag in parseFlags
This will allow users to use a different flag name.

Change-Id: I252871b8efb6867e61ca507f59a9663cb7140b7d
Reviewed-on: https://go-review.googlesource.com/26632
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-09 18:14:46 +00:00