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

774 Commits

Author SHA1 Message Date
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
Michael Matloob
72064bd647 cmd/heapview: dowgrade to customelements v0
I've had too many issues with customelements v1. The interface for v0
isn't as nice, and v0 will eventually be deprecated. But v1's polyfill
library is better supported, and it will be easy to upgrade later.

Change-Id: I87b376376b750167a0464c6c249930edecbd59db
Reviewed-on: https://go-review.googlesource.com/25545
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2016-08-05 20:49:36 +00:00
Michael Matloob
337c0124d7 x/tools/cmd/heapview: add a heading to the page
This CL's purpose is to introduce the dependency on the HTML Custom
Elements polyfill. Like we've done so far, I'm trying to keep
dependencies light by using current or polyfilling future webcomponents
standards.

Change-Id: I11d14db367b697cdd527fb66b9d7d160ac244b78
Reviewed-on: https://go-review.googlesource.com/25494
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-05 01:00:25 +00:00
Michael Matloob
7ef02fdb22 cmd/heapview: add karma+jasmine TS unit testing config
Add a configuration that allows unit testing of client Typescript
code using Karma and Jasmine. Add a basic test to exercise this.

Change-Id: I88af82b68547423efeaafb0fab8214ed39573ee9
Reviewed-on: https://go-review.googlesource.com/25411
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Evan Martin <evanm@google.com>
2016-08-03 18:16:31 +00:00
Miroslav Genov
bf0c35b6b6 tip/doc: update doc to match latest gcloud syntax
gcloud command no longer requires preview for deployment and is showing
warning when command is executed:

```
WARNING: The `gcloud preview app` command group is deprecated; please
use the `gcloud app` commands instead.
```

This change is removing "preview" text from README to make deploy
command up to date with gcloud.

Change-Id: I64d390ab4891f82fe608c64be20fae01a80d00fc
Reviewed-on: https://go-review.googlesource.com/25430
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-03 14:42:34 +00:00
Michael Matloob
9e7459099f x/tools/cmd/heapview: break out init code
This change breaks out the code that adds handler funcs and
starts the HTTP server into separate functions, so that they
can be overridden in other environments, such as Google's.

For instance, listenAndServe can be overridden in an init method
in a different file to use a HTTP2 server.

Updates golang/go#16410

Change-Id: I074242af10486c60c374e9ac7ebe9d0e61a8fa22
Reviewed-on: https://go-review.googlesource.com/25273
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-07-27 17:11:33 +00:00
Michael Matloob
053ddb97bf x/tools/cmd/heapview: add basic client serving
This change primarily exists to import Typescript and the
ES6 module loader polyfill as dependencies for this project.
Both dependencies are relatively lightweight and can be easily
removed if we decide we don't need them.

The module loader polyfill implements support for an upcoming
browser feature in ES6 (the next version of JavaScript). This
feature helps modularize Javascript code and conveniently split it
into multiple files. It should be supported by the stable versions
of the four major browsers (Chrome, Firefox, Safari and Edge)
by the end of the year. Once that happens, we can remove the polyfill.

The Typescript compiler provides two things: First, it compiles
new, but not-yet-supported ES6 Javascript features into ES5. It
also provides a typechecker similar to what Closure does, but types
are indicated in syntax rather than JSDoc comments. If we decide
we don't want this dependency, we can compile the Typescript code
into human-readable JavaScript code. (The compiler basically
strips out types and replaces ES6 language features with more
well-supported JavaScript equivalents). The Typescript compiler
is not required for development. typescript.js and a feature in
the module loader will be used to compile Typescript into JavaScript
at serving time. (We might want to do something different for the
production version, but we can get to that later).

The change also adds code to serve the HTML and Javascript files.

Updates golang/go#16410

Change-Id: I42c669d1de636d8b221fc03ed22aa7ac60554610
Reviewed-on: https://go-review.googlesource.com/25240
Reviewed-by: Austin Clements <austin@google.com>
2016-07-26 20:51:39 +00:00
Keith Rarick
ed69e84b15 cmd/goimports, imports: add -local flag
This allows the caller to indicate they want certain
import paths to sort into another group after 3rd-party
imports when added by goimports. For example, running
'goimports -local example.com/' might produce

    import (
        "database/sql"
        "io"
        "strconv"

        "golang.org/x/net/context"

        "example.com/foo/bar"
        "example.com/foo/baz"
    )

Resolves golang/go#12420

Change-Id: If6d88599f6cca2f102313bce95ba6ac46ffec1fe
Reviewed-on: https://go-review.googlesource.com/25145
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-07-23 01:23:54 +00:00
Brad Fitzpatrick
f3284303b6 cmd/goimports: permit complete filename for -srcdir
Updates dominikh/go-mode.el#146
Updates golang/go#7463 (for https://golang.org/cl/23444)

Change-Id: Ieb769329531050b803528acce0c50d02786533b6
Reviewed-on: https://go-review.googlesource.com/25140
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-07-21 20:15:52 +00:00
Dmitri Shuralyov
5b59ce8b5f cmd/bundle: More idiomatic flag.Usage.
The responsibility of flag.Usage is to print usage to stderr:

> Usage prints to standard error a usage message documenting all
> defined command-line flags.

Calling os.Exit(2) is outside of its scope, flag package does that.

Change-Id: I3eef2b796e5ddedff6d5927dbcdbfff3a6082270
Reviewed-on: https://go-review.googlesource.com/23788
Reviewed-by: Joseph Holsten <joseph@josephholsten.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-07-21 15:33:57 +00:00
Michael Matloob
55296b3beb x/tools/cmd/heapview: rename heapdump to heapview
Updates golang/go#16410

Change-Id: I0133971f9a1149da6d88180fc2e378003f189cc8
Reviewed-on: https://go-review.googlesource.com/25101
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-20 19:02:34 +00:00
Michael Matloob
5dbb806c12 x/tools/cmd/heapdump: add empty heapdump command
This change creates a place where we can start building
the 'heapdump' heap viewer and analyzer

Updates golang/go#16410

Change-Id: I216e13f1ceb6790bf492cfc8cbcc4f19f12b0b9e
Reviewed-on: https://go-review.googlesource.com/25085
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-20 16:50:05 +00:00
Brad Fitzpatrick
edf8e6fef8 cmd/goimports, imports: optimize directory scanning and other things
This brings goimports from 160ms to 100ms on my laptop, and under 50ms
on my Linux machine.

Using cmd/trace, I noticed that filepath.Walk is inherently slow.
See https://golang.org/issue/16399 for details.

Instead, this CL introduces a new (private) filepath.Walk
implementation, optimized for speed and avoiding unnecessary work.

In addition to avoid an Lstat per file, it also reads directories
concurrently. The old goimports code did that too, but now that logic
is removed from goimports and the code is simplified.

This also adds some profiling command line flags to goimports that I
found useful.

Updates golang/go#16367 (goimports is slow)
Updates golang/go#16399 (filepath.Walk is slow)

Change-Id: I708d570cbaad3fa9ad75a12054f5a932ee159b84
Reviewed-on: https://go-review.googlesource.com/25001
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-07-19 03:21:45 +00:00
Alan Donovan
b825d2868c cmd/oracle: announce planned deletion in 2.5 months
Change-Id: Id3e1dd598707c04be883b168add0a7049dc45874
Reviewed-on: https://go-review.googlesource.com/25031
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-07-18 23:21:13 +00:00
Alan Donovan
f2932db7c0 cmd/guru: suppress failing test on plan9
The test expectation includes the text of a UNIX ENOENT message.

Also, make the same change for (deprecated) oracle tool.

Fixes golang/go#16397

Change-Id: I8c3c6a300ff2366bfeb97cf41d34097c41aab680
Reviewed-on: https://go-review.googlesource.com/24968
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-07-18 14:28:24 +00:00
Brad Fitzpatrick
ffe4e61c64 imports: add configuration mechanism to exclude directories
Each $GOPATH entry may have a file $GOPATH/src/.goimportsignore which
may contain blank lines, #comment lines, or lines naming a directory
relative to the configuration file to ignore when scanning.  No
globbing or regex patterns are allowed.

Updates golang/go#16367 (goimports speed)
Fixes golang/go#16386 (add mechanism to ignore directories)

Change-Id: I8f1a88ae6c4d0ed3075444d70aec3e2228c5ce6a
Reviewed-on: https://go-review.googlesource.com/24971
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-07-15 19:48:34 +00:00
Alan Donovan
ef6b6ebf3b cmd/guru: what: include imported package names in sameids
+ Test.

Change-Id: Ib7ef99786f5b60bb3e56ced9588d2ba5725576e1
Reviewed-on: https://go-review.googlesource.com/24949
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-07-15 18:55:24 +00:00
Alan Donovan
92480e4760 cmd/guru: update Emacs installation documentation
I was going to add a hook to enable go-guru-hl-identifier-mode
as a side effect of go-mode, but a person I consulted said that
was bad form; instead I merely documented it.

Change-Id: I48b00b71c7ba485b3d632211923509a74281acbe
Reviewed-on: https://go-review.googlesource.com/24834
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-15 15:54:54 +00:00
Brad Fitzpatrick
e047ae774b cmd/goimports, imports: make goimports great again
I felt the burn of my laptop on my legs, spinning away while processing
goimports, and felt that it was time to make goimports great again.

Over the past few years goimports fell into a slow state of disrepair
with too many feature additions and no attention to the performance
death by a thousand cuts. This was particularly terrible on OS X with
its lackluster filesystem buffering.

This CL makes goimports stronger, together with various optimizations
and more visibility into what goimports is doing.

* adds more internal documentation

* avoids scanning $GOPATH for answers when running goimports on a file
  under $GOROOT (for Go core hackers)

* don't read all $GOROOT & $GOPATH directories' Go code looking for
  their package names until much later. Require the package name of
  missing imports to be present in the last two directory path
  components.  Then only try importing them in order from best to
  worst (shortest to longest, as before), so we can stop early.

* when adding imports, add names to imports when the imported package name
  doesn't match the baes of its import path. For example:
        import foo "example.net/foo/v1"

* don't read all *.go files in a package directory once the first file
  in a directory has revealed itself to be a package we're not looking
  for. For example, if we're looking for the right "client" for "client.Foo",
  we used to consider a directory "bar/client" as a candidate and read
  all 50 of its *.go files instead of stopping after its first *.go
  file had a "package main" line.

* add some fast paths to remove allocations

* add some fast paths to remove disk I/O when looking up the base
  package name of a standard library import (of existing imports in a
  file, which are very common)

* adds a special case for import "C", to avoid some disk I/O.

* add a -verbose flag to goimports for debugging

On my Mac laptop with a huge $GOPATH, with a test file like:

	package foo
	import (
	       "fmt"
	       "net/http"
	)

	/*

	*/
	import "C"

	var _ = cloudbilling.New
	var _ = http.NewRequest
	var _ = client.New

... this took like 10 seconds before, and now 1.3 seconds. (Still
slow; disk-based caching can come later)

Updates golang/go#16367 (goimports is slow)
Updates golang/go#16384 (refactor TestRename is broken on Windows)

Change-Id: I97e85d3016afc9f2ad5501f97babad30c7989183
Reviewed-on: https://go-review.googlesource.com/24941
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-07-15 05:29:07 +00:00
Alan Donovan
cda5280914 cmd/guru: fix quoting bug in Emacs binding
combine-and-quote-strings is buggy.  The value of this expression:
 (split-string-and-unquote (combine-and-quote-strings '("a" "" "b")))
is ("a" "b").  Consequently, if go-guru-scope is "", the following
"-tags" flag is interpreted as the scope.

Change-Id: I2955ffa2b95914e01d44b52690e810f816076d5c
Reviewed-on: https://go-review.googlesource.com/24746
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-07-12 13:22:42 +00:00
Parker Moore
130914b004 tip: update package doc to refer to stable code
This comment was written and has not been changed since this package was
created: https://www.youtube.com/watch?v=1rZ-JorHJEY

It is no longer called 'tipgodoc', and it is no longer all that 'new'. This
change request updates that text to reflect the current state of the 'tip'
command.

Change-Id: I4ce56fb9a3bd617cf92f8d53df5a2d4726085a9a
Reviewed-on: https://go-review.googlesource.com/24860
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-11 22:47:40 +00:00
Alan Donovan
35c6e68a1a cmd/guru: update link to documentation
Change-Id: Ia50c7878b0ba3c6576acf56b033beda122812c76
Reviewed-on: https://go-review.googlesource.com/24835
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-07-08 22:10:47 +00:00
Alan Donovan
2b3249681b cmd/guru: add menu to Emacs
Change-Id: Ife18d22f8f9b81a0e898a2b5da202feb1df23852
Reviewed-on: https://go-review.googlesource.com/24832
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-08 18:46:17 +00:00
glorieux
527b253f58 x/tools/cmd/present: Fix present not working on Safari
As described on https://github.com/golang/go/issues/16216 present is not
currently working on Safari because of the use of ES6 JavaScript let
statements.
The solution is to use var statements instead of let.

Fixes golang/go#16216

Change-Id: I44c84f920aa41dfc8de5997ab50a440de6d57093
Reviewed-on: https://go-review.googlesource.com/24721
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-07-03 04:58:21 +00:00
Alan Donovan
0d2bde8553 go/ast/astutil: describe fewer CallExprs as "conversions"
Only unary CallExprs with no ellipsis, f(x), are ambiguous.

Change-Id: If4f17445ab0725dee916992db133eac5536133a7
Reviewed-on: https://go-review.googlesource.com/24552
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-06-30 18:40:56 +00:00
kortschak
8b3828f1c8 cmd/present: add request address to logged errors
Change-Id: I504d29d7196b8c61cff5e92bb4244a34c9c41fa8
Reviewed-on: https://go-review.googlesource.com/24331
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-22 22:42:38 +00:00
Audrey Lim
3d35e41306 x/tools/present: fix null notes value on initial slide
Change-Id: I370fdf2ef7de33976028f8cd872402a08d8f103c
Reviewed-on: https://go-review.googlesource.com/24050
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-14 00:56:51 +00:00
Audrey Lim
b41cbfc0fa x/tools/present: add presenter notes documentation
Fixes golang/go#14654

Fixes golang/go#12355

Change-Id: I0c05db624170f7bef5883192b47b618ca343a830
Reviewed-on: https://go-review.googlesource.com/21489
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-01 21:14:44 +00:00
Audrey Lim
19c2ab042a x/tools/present: display presenter notes and synchronize browser windows
Change-Id: If7d5cc52f7594c141060d40e8393ac69cb7ba9ad
Reviewed-on: https://go-review.googlesource.com/21488
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-06-01 05:16:27 +00:00
Yasuhiro Matsumoto
ba484b064f cmd/bundle: move down imports of external package
imports should be ordered like

    import (
    	"fmt"

    	"golang.org/x/text"
    )

Change-Id: I000374833de370463d772c2596c7ac6ee5e9725c
Reviewed-on: https://go-review.googlesource.com/23026
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-05-26 02:53:53 +00:00
Francesc Campoy
0b2f4dcf4d tools: fix 'Split called after Scan'
Change-Id: I2dae23440d33fa830107575987805e858e4bf4a7
Reviewed-on: https://go-review.googlesource.com/22749
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-04 16:29:22 +00:00
Andrew Gerrand
c9a2436076 cmd/godoc: set Strict-Transport-Security header in production
This coerces browsers into enforcing HTTPS-only for golang.org.

Change-Id: I91a4cc64b10b9836ef5623314a3cf22a54033dc2
Reviewed-on: https://go-review.googlesource.com/22673
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-02 17:22:30 +00:00
Andrew Gerrand
0238d429c7 cmd/tip: set Strict-Transport-Security header in production
Change-Id: I33db74025785c802a634f324ad110a4ec5381c1f
Reviewed-on: https://go-review.googlesource.com/22674
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-02 17:21:26 +00:00
Alan Donovan
14480f21a0 cmd/guru: for determinism, sort referrers output in test
Previously we were sorting only JSON objects, but we must do the same
for plain output too to avoid sporadic failures.

Tested 20 times.

Change-Id: Ic60363b720c2afc91b57864bc93e298f83e85b99
Reviewed-on: https://go-review.googlesource.com/22555
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-04-28 19:07:35 +00:00
Alan Donovan
50ff896a1c cmd/guru: definition: opt: avoid type checker for qualified identifiers
For a 'definition' query on X in p.X, use special logic to load and
parse package p and find the declaration of package member X, without
using the type checker.  Such queries now typically take under
10ms (faster than godef).

The logic assumes that import "something/p" defines the name p.  If this
assumption is false, p.X could be a selection of a field or method X on
a member p of the same package, defined in another file.
So don't write code like that.

Added missing test of 'definitions'.
JSON tests now sanitize absolute $GOPATH filenames in the output.

Fixes issue #15458

Change-Id: I21e75fcc9372aaedd56851cace444aef205c7a97
Reviewed-on: https://go-review.googlesource.com/22526
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-04-28 17:00:30 +00:00
Alan Donovan
0f5f9fcf9a cmd/guru: implements: if selected expr is a value, use its type
...as the basis of the query, instead of reporting an error.

+ test

Change-Id: Ie5defa98cd8dfc8e200e296c2aa02c88893cf9ac
Reviewed-on: https://go-review.googlesource.com/22117
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-04-28 14:33:14 +00:00
Alan Donovan
9ae7e1769c cmd/guru: Emacs: run guru asynchronously using compilation-mode
We define a derived mode of compilation-mode, so that various
names say "guru" instead of "compilation", and use the hooks it
provides to apply our postprocessing incrementally instead of
all at the end.  It's much faster, and works nicely with the
new streaming referrers query.

Compilation mode requires a shell command, not an execve array,
so go-guru--compile-command joins the arguments with spaces.
go-guru--exec has been specialized for JSON mode,
and renamed to go-guru--json.

go-guru--set-scope-if-empty is now done by each mode, to avoid
the NEED-SCOPE parameter to go-guru--exec.

Change-Id: I692b8b28449b7cc17fd6251a152588f9d8b89ebc
Reviewed-on: https://go-review.googlesource.com/21772
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-28 14:21:22 +00:00
Andrew Gerrand
94f857c7cf cmd/tip: bump verison serving tip.golang.org to HEAD
This picks up a recent change to the playground package.

Change-Id: I9b5f0ef9981373274d707014a2c0e2786e9624c0
Reviewed-on: https://go-review.googlesource.com/22538
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-28 01:23:19 +00:00
Andrew Gerrand
53006ac4c2 cmd/tip: redirect from HTTP to HTTPS; update to Go 1.6
Change-Id: I7b219a991df4f71d068b62a22f69acb123ac31f0
Reviewed-on: https://go-review.googlesource.com/22367
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-27 01:13:02 +00:00
Alan Donovan
5e468032ea cmd/guru: avoid bug when -scope=""
strings.Split is not your friend.

Change-Id: I829f08f113f3340b2dd865aea47f5759a427f7c4
Reviewed-on: https://go-review.googlesource.com/22116
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-04-18 16:46:08 +00:00
Dominik Honnef
3114265539 cmd/guru: emacs: interpret byte offsets correctly
Change-Id: Id506c6c0b3f3c585781bfc38df1b665d507a7c33
Reviewed-on: https://go-review.googlesource.com/22019
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-17 18:15:17 +00:00
Dominik Honnef
837ce23ea3 cmd/guru: emacs: report most specific element in expand-region
Keep the leftmost element when removing duplicates, so that we report
"function call" instead of "expression statement".

Also split go-guru--enclosing into two functions.

Change-Id: Ie325613e292e36dda9558eda54bc7323fbf0bc6d
Reviewed-on: https://go-review.googlesource.com/22132
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-17 13:26:57 +00:00
Hironao OTSUBO
321c6fd171 cmd/stringer: fixed usage line typo
Change-Id: I5852d03c0326d82c13d9e1078f9648ecc695fbbf
Reviewed-on: https://go-review.googlesource.com/22150
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-17 02:19:27 +00:00
Andrew Gerrand
c3291436fa cmd/tip: look for godoc binary under $GOPATH/bin instead of $GOROOT/bin
A recent change to the cmd/go tool made it place godoc in $GOPATH/bin
instead of the special-cased $GOROOT/bin.

Change-Id: If026ff7e3a521ee2aa9b4107585124df108d7124
Reviewed-on: https://go-review.googlesource.com/21951
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-13 03:37:58 +00:00
Dominik Honnef
446a18e709 go/buildutil, cmd/guru: extract overlay context into buildutil
This extracts the overlay context and archive parsing from guru into
buildutil.

At least one tool (gogetdoc) has a vendored copy of this code already,
and more tools implementing the same functionality will follow.

The new code in buildutil is an almost identical copy of the code in
guru (names aside), except for the following changes:

- Instead of reading into a bytes.Buffer, we read directly into a []byte
  of appropriate size

- sameFile first attempts a simple comparison of path.Clean'ed paths.

Change-Id: I97cd978ccc10722e3648e5e10625fa7f1407f202
Reviewed-on: https://go-review.googlesource.com/21805
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-13 01:11:48 +00:00
Dominik Honnef
fb9c7fc43c cmd/guru: emacs: add function for expandiong region
The go-guru-expand-region function uses the "what" query to determine
the enclosing regions. Consecutive calls to go-guru-expand-region will
reuse a cached version of the list.

Change-Id: Ice9ac5540c1b639c6cbdc505866bbab347be1e98
Reviewed-on: https://go-review.googlesource.com/21754
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-13 01:08:39 +00:00
Alan Donovan
2da0720e4f cmd/guru: support streaming plain and -json output
Visible changes:
- "referrers" queries now emit a stream of results,
  so they start appearing quickly even in large queries.
  We no longer report the total number of matches.
- packageReferrers now also uses AfterTypeCheck hook and streaming.
- XML support has been dropped.
- The -format flag has been replaced by -json.

JSON protocol changes:
- The enclosing Result struct has been removed.
- Likewise the 'mode' field (since the caller knows it already)
- "freevars" and "referrers" now emit a stream of objects
  In the case of referrers, the first object has a different from the rest.
- The "referrers" results include the text of the matching line
  (parity with -json=false)

Implementation details:
- the concurrency-safe q.Output function can be called
  many times, each with a queryResult to print.
- fset is no longer saved in Query (cleaner)
- queryResult methods renamed PrintPlain, JSON

Change-Id: I41a4e3f57f266fcf043ece4045bca82c6f6a356f
Reviewed-on: https://go-review.googlesource.com/21397
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-04-11 19:51:55 +00:00
Audrey Lim
b75b3f5cd5 x/tools/present: add command line flag to enable presenter notes
Change-Id: I9d4414ce8bafcb13f53361b45774f379bacd886b
Reviewed-on: https://go-review.googlesource.com/21486
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-07 00:38:29 +00:00
Robert Griesemer
adaaa07486 x/tools: delete x/tools/go/types and dependent packages/client files
Per https://groups.google.com/forum/#!topic/golang-announce/qu_rAphYdxY
this change deletes the packages

  go/exact
  go/gccgoimporter
  go/gcimporter
  go/importer
  go/types
  cmd/vet

from the x/tools repo and any files depending on those packages
building against Go 1.4.

x/tools packages depending on any of these libraries must use the
respective versions from the std lib or use vendored versions if
building against 1.4.

Remaining packages may or may not build against Go 1.4 anymore
and will not be supported against 1.4.

Change-Id: I1c655fc30aee49b6c7326ebd4eb1bb0836ac97e0
Reviewed-on: https://go-review.googlesource.com/20810
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-04-06 21:52:49 +00:00
Andrew Gerrand
e77df0732c cmd/tip: use manual scaling for tip.golang.org
Always serve from four instances to avoid flakiness.

Change-Id: I11684f93bb27a377f54ddbe4fb3d95894d393a48
Reviewed-on: https://go-review.googlesource.com/21528
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-04-06 00:03:48 +00:00
Andrew Gerrand
f2e4f834ec cmd/present/static: remove unused function
Change-Id: I2d5db20ffb2ae59818b69d33d91256bc829ee6d8
Reviewed-on: https://go-review.googlesource.com/21445
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-04 05:09:31 +00:00
Dominik Honnef
74b98c2c7a cmd/guru: emacs: only check modified buffers with file names
We cannot determine the extension of buffers with no file names (not
without throwing an error, anyway.)

Change-Id: I2b10390da738d71b6f95a6f668d3b92b54db29ed
Reviewed-on: https://go-review.googlesource.com/20470
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-28 14:50:23 +00:00
Dominik Honnef
fc3ceb1825 cmd/guru: emacs: update default-directory
That way, running guru on /a/foo.go, followed by /b/bar.go won't leave
the user with a display buffer that still defaults to /a/

Change-Id: I3f9b085c6d206ac2adc269fc2009799c624c371a
Reviewed-on: https://go-review.googlesource.com/20475
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-28 14:50:15 +00:00
Dominik Honnef
999f507100 cmd/guru: emacs: store output in separate buffer
Now that we have both interactive and non-interactive uses of the guru,
we should separate the command output buffer from the display buffer.

Change-Id: I50082fdc3847c7b12869e204509141e906df3852
Reviewed-on: https://go-review.googlesource.com/20473
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-28 14:50:08 +00:00
Dominik Honnef
5c5d833208 cmd/guru: emacs: support running on nameless buffers
By using guru's -modified flag and making up a file name, we can run
guru on a buffer that has no file attached to it. This feature will only
be useful for queries that operate on single files, as otherwise our made
up name could cause conflicts.

This will be useful for the "what" query and features using it.

Change-Id: I3d199bc0548245d59ba7b492f57beb9422d7f43d
Reviewed-on: https://go-review.googlesource.com/20431
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-28 14:50:02 +00:00
Alan Donovan
35cacb533e cmd/guru: change "Method set:" to less formal "Methods:"
Change-Id: I7a43f3e9ed7e88f4f8f09d4d112c81aa037b7d8d
Reviewed-on: https://go-review.googlesource.com/21111
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-03-28 14:29:15 +00:00
Dominik Honnef
361bcb2be3 all: address vet issues, fix print calls
This fixes some print calls with wrong format directives. Additionally,
struct initialisers were changed to use keyed fields, purely to reduce
the amount of noise generated by go vet.

Change-Id: Ib9f6fd8f2dff7ce84826478de0ba83dda9746270
Reviewed-on: https://go-review.googlesource.com/21180
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-27 20:36:34 +00:00
Dominik Honnef
47218d24f2 cmd/guru: whicherrs: don't crash on dead code
Change-Id: I5e80613ec27a4edb45516ff1ff3a88d5f9cb3a67
Reviewed-on: https://go-review.googlesource.com/21130
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-25 16:35:34 +00:00
Dominik Honnef
824b504fc7 cmd/guru: emacs: highlight all instances of an identifier
Implement the "what" query and use it to get all uses of an
identifier (the "sameids" attribute). The user can either manually call
go-guru-hl-identifier, which will highlight all instances of the
identifier under point, or they can enable the
go-guru-hl-identifier-mode minor mode. The minor mode sets up an idle
timer, which will highlight the current identifier after a configurable
timeout. If the user modifies the buffer, or moves point off of an
identifier, we clear the highlight.

Change-Id: Iac870f3bcd17e0002eafcba0b73f07adaa03cd76
Reviewed-on: https://go-review.googlesource.com/20433
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-25 02:11:11 +00:00
David R. Jenni
21cc49bd03 cmd/guru: fix assignment to entry in nil map.
Fixes golang/go#14746.

Change-Id: Id79c43c7d3700b98c010aa7dc0aac2463164be09
Reviewed-on: https://go-review.googlesource.com/20988
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-21 19:52:00 +00:00
Andrew Gerrand
d8da78068e cmd/tip: add context to error values and log prints
To help track down some flakiness.

Change-Id: I2dd21abdc0f05c58857da580d962b0ab72cf52b3
Reviewed-on: https://go-review.googlesource.com/20728
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-16 04:48:27 +00:00
Robert Griesemer
1431634c56 cmd/guru: fix for prior submission (fix build)
Accidentally submitted wrong file version in
https://go-review.googlesource.com/20719.

TBR: adonovan

Change-Id: I362ded51cf9cef8cb22faf6a2334ce01678d9f4e
Reviewed-on: https://go-review.googlesource.com/20742
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-15 22:17:46 +00:00
Robert Griesemer
ce9c53141f cmd/guru: adjust test output for go1.5 (fix build)
In go1.5, go/constant (floating-point) numeric values are printed
as fractions. Correct output as necessary so that they always
appear as floating-point numbers to match golden files.

Change-Id: If63a14d8d87bb664bf6272b16345e38e8d638ead
Reviewed-on: https://go-review.googlesource.com/20719
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-15 21:51:11 +00:00
Dominik Honnef
c5b51756ce cmd/guru: emacs: add go-guru-debug variable
Don't print debug messages unless go-guru-debug is set.

Change-Id: I1332a0b10eba1d1107ef987734b2b787ae28d9c2
Reviewed-on: https://go-review.googlesource.com/20432
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-09 20:00:51 +00:00
Dominik Honnef
b023cf6107 cmd/guru: emacs: update scope documentation
Also fix a typo in the tool's help string.

Change-Id: I54a9ed4a5515b137b0fbf1b2391dd6fa84b2d2d8
Reviewed-on: https://go-review.googlesource.com/20474
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-09 15:55:45 +00:00
Andrew Gerrand
498e5ca207 cmd/tip: kill godoc when it fails to be ready on time
If godoc didn't come up quickly enough, we would leave it running and
then try to start another one on the same port.
The new one would fail to start, being unable to bind to the address,
causing cascading failures.

Also increase the timeout to 10 minutes.

Change-Id: I7008a39f649021ea213902d557f26bf78567026d
Reviewed-on: https://go-review.googlesource.com/20420
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-08 22:55:24 +00:00
Alan Donovan
3d26f6847a go/ssa: make *BuilderMode satisfy flag.Value
The BuilderModeFlag function does not work with flag packages (such as
Google's) that define their own FlagSet.  This change exposes a type
that satisifies flag.Value insted of a function.  That type
is *BuilderMode; there's no need for a separate wrapper type.

Change-Id: I8095b80de499e3c52a29a5c1996d1b1fe3799358
Reviewed-on: https://go-review.googlesource.com/20330
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-03-07 22:18:09 +00:00
Konstantin Shaposhnikov
53f5cdeed1 cmd/present: fix displaying line numbers for .code and .play
Line numbers match line numbers from the included file,
not the lines in the segment selected by the
.code or .play START/STOP regexps.

Fixes golang/go#5248

Change-Id: I374e7b665e98db5032446ae49e6fae00d9d2b975
Reviewed-on: https://go-review.googlesource.com/20311
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-07 22:14:29 +00:00
Konstantin Shaposhnikov
1074774aec cmd/present: fix slides movement when -play=false
Fix by removing jQuery usage from slides.js as jquery.js is only
available when play.js is included.

Fixes golang/go#9878

Change-Id: I5793350105b138d7b7645f11d814e1d2f573a73e
Reviewed-on: https://go-review.googlesource.com/20288
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-07 22:13:35 +00:00
Konstantin Shaposhnikov
7a73fe1b6c cmd/guru: emacs: add default key binding for whicherrs
Bind go-guru-whicherrs to `C-C C-o e'

Also remove go-guru-callgraph as callgraph mode is not supported
by guru.

Change-Id: Id233d178629a3cafc00e4f9640191c3d3c673cf1
Reviewed-on: https://go-review.googlesource.com/20310
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-07 15:54:09 +00:00
Alan Donovan
d2abdd5413 cmd/guru: fix nil deref when position is not in Go source
+ test

Fixes issue golang/go#14684

Change-Id: I56023bf36c307d02c71b4ddf08aee9c229fc66c1
Reviewed-on: https://go-review.googlesource.com/20247
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
2016-03-07 15:53:42 +00:00
Dominik Honnef
adda3a6894 cmd/guru: emacs: push mark in go-guru-definition
This allows users to swap point and mark to jump between use and
definition in the same buffer, or pop-tag-mark (M-*) to jump back to the
use even between multiple buffers.

This mirrors the behaviour of godef-jump from go-mode.

Also remove an obosolete TODO and fix a typo.

Change-Id: I614090493b565acadf359ebb4c7092f4c673fd56
Reviewed-on: https://go-review.googlesource.com/20303
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-07 15:33:11 +00:00
Dominik Honnef
459f0c0f73 cmd/guru: emacs: allow passing tags to guru
Change-Id: I2e49d050add1f764a0e41300b2cca8da699f418a
Reviewed-on: https://go-review.googlesource.com/20302
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-03-07 02:38:31 +00:00
Alan Donovan
2336c53cf0 cmd/guru: compute referrers as packages are type checked
This CL makes little observable difference to the behavior but paves the
way for streaming 'referrers' and (later) 'implements' queries which
scan the entire workspace, but print each result as soon as it is found.

The go/loader package now exposes a hook, AfterTypeCheck, that lets
clients inspect each package as soon as it is type-checked, and also
modify it, for instance to release unneeded data structures.

A 'referrers' query applied to an exported object must scan the entire
workspace.  It uses this hook so to gather uses of the query object in
streaming fashion.  However, for now, it still accumulates the results
and prints them all at the end, though I propose to change that in a
follow-up.

Code details:
- The referrers logic had a 2-iteration loop to load first the query
  package and then if necessary the enlarged program.  The second
  iteration has now been unrolled and split into globalReferrers.
- Queries for package names (whether in a package declaration or
  a qualified identifier) have been split off into packageReferrers.
  It now loads all direct importers of the query package,
  which catches some references that were missing before.
  (It used to inspect only the forward dependencies of the query
  package.)

Also:
- Referrers.Pos (the position of query identifier) was removed from the
  JSON output.  It's a nuisance to compute now, and it's already
  absent from the plain output.
  (In a follow-up, I plan to simplify the information content of the
  JSON output exactly what is currently printed in the plain output.)

Change-Id: Ia5677636dc7b0fe4461a5d393107665757fb9a97
Reviewed-on: https://go-review.googlesource.com/19794
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
2016-03-04 21:13:08 +00:00
Alan Donovan
3dafbd1ba4 go/types/typeutil: make IntuitiveMethodSet(*C) nonempty for concrete types C
This fixes a bug in guru describe.

Also, add a test of IntuitiveMethodSet.

Change-Id: Ied3780807afd88e664fdb186619499670529fe33
Reviewed-on: https://go-review.googlesource.com/20166
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
2016-03-03 19:43:35 +00:00
Alan Donovan
6c84e9e3e0 cmd/guru: make fastQueryPos indirect through the -modified map
This fixes a bug in which guru reports a "query position beyond end of
file" error when making a query from an unsaved editor buffer at an
offset greater than the length of the file on disk.

Change-Id: I908c024d8dd14baa657b4227e3231fa760443732
Reviewed-on: https://go-review.googlesource.com/20167
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
2016-03-03 19:00:43 +00:00
Alan Donovan
6f233b96df cmd/guru: fix nil dereference in describe
+ test

Fixes issue golang/go#14579

Change-Id: I6fd56f10c170027f06917935ccbc28490d413d8a
Reviewed-on: https://go-review.googlesource.com/20100
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-03-01 22:59:02 +00:00
Konstantin Shaposhnikov
a917fb9d7b cmd/guru: emacs: package.el compatibility changes
Make go-guru compatible with package.el prior to uploading this pacakge to
MELPA.

Also add ;;;###autoload magic comments, so that the go-guru-xxx commands can
be used without need to explicitly (require 'go-guru) first.

Change-Id: I21c7f5f354fb7b39877a05c2a9ffecd02ab022f6
Reviewed-on: https://go-review.googlesource.com/19789
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-02-26 04:34:18 +00:00
Alan Donovan
2327a65811 cmd/guru: fix tests
A consequence of CL 19747 was that ad hoc packages of a single filename
are no longer valid -scope arguments, which broke most of the tests.

This CL fixes the tests by extracting the import path from the filename.
The test output now includes the import path, not the package
name, of each of these packages, so the output was updated too.

Also, the -scope argument caused the main package to be imported twice,
once as main.go and once under its import path, causing duplicate
'implements' results.

I'm not sure how I failed to notice this.

Change-Id: I6fb3ae3e1497f0eb8cf88f453660b9e2fd9718d8
Reviewed-on: https://go-review.googlesource.com/19886
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-25 22:51:33 +00:00
Alan Donovan
f7268ab39b cmd/bundle: fix broken test
Change-Id: I95bd6cd1b63a1d1b5bd255546fbf571010a67266
Reviewed-on: https://go-review.googlesource.com/19745
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-02-22 20:47:44 +00:00
Alan Donovan
3f95c66345 cmd/guru: allow foo/... and -foo patterns in scope argument
Also, document -scope argument.

Depends on CL 19746 (buildutil.ExpandPatterns)

Change-Id: I3c9000e94d87cca5c2c49fe8de12a77fc43f7257
Reviewed-on: https://go-review.googlesource.com/19747
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-22 20:17:58 +00:00
Alan Donovan
a69e659f44 cmd/guru: fix mode map, again
Change-Id: Ic1fef2e237205ed392912601324415af625417b0
Reviewed-on: https://go-review.googlesource.com/19749
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-02-22 20:17:02 +00:00
Konstantin Shaposhnikov
54fa7477e2 cmd/guru: emacs: do not shrink results window
This fixes the following usability issues:

- when go-guru is called twice in a row and the output from the second invocation
  is bigger then this output is not fully visible
- output window could be re-used by other packages (such as helm) that are not
  usable with the shrank window

Change-Id: I86d522006d29e945a71b96c9d13a1a39572bdb3b
Reviewed-on: https://go-review.googlesource.com/19780
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-02-22 15:47:11 +00:00
Alan Donovan
86372b3255 cmd/guru: use byte (not rune) count in -modified archive
Change-Id: I7fc575c8ec7a8170e64719419079d6742f47b119
Reviewed-on: https://go-review.googlesource.com/19744
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-21 19:51:54 +00:00
Alan Donovan
b0452eeec4 cmd/guru: fix bug in mode map caused by bad merge
Change-Id: I2c4ff577f744e168a7914d15269636092ceef5a9
Reviewed-on: https://go-review.googlesource.com/19748
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-02-21 01:08:56 +00:00
Alan Donovan
4828f5cb61 cmd/guru: emacs: minor changes to keybindings
Major modes should use the C-c prefix followed by C-something.  We'll
stick with C-o (oracle) since C-g is taken by go-jump-xxx (and in any
case C-g should be reserved for keyboard-quit.)

Change-Id: I18f41d7cbd5bf83aa53909554501e7f76543f033
Reviewed-on: https://go-review.googlesource.com/19510
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-21 00:47:43 +00:00
Alan Donovan
ee8cb08bfe cmd/guru: what: report identifiers equivalent to the selected one
This information is useful for editor UIs that highlight all
uses of the local variable under the cursor.

Change-Id: I718d648d407468509e6d12f932ae6cdef368830a
Reviewed-on: https://go-review.googlesource.com/19512
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-20 21:18:35 +00:00
Russ Cox
bf084ef758 imports: add support for vendor directories
Editor modes that invoke the goimports command on temporary copies
of actual source files will need to invoke goimports -srcdir now to say
where the real source directory is. Otherwise goimports will not consider
vendored or internal packages when looking for new imports.

In lieu of a test for cmd/goimports (because it has no tests),
a command transcript:

	$ cd /tmp
	$ cat x.go
	package p
	var _ = hpack.HuffmanDecode
	$

	$ GOPATH= goimports < x.go
	package p

	var _ = hpack.HuffmanDecode
	$ GOPATH= goimports x.go
	package p

	var _ = hpack.HuffmanDecode
	$

But with the new flag:

	$ GOPATH= goimports -srcdir $GOROOT/src/math < x.go
	package p

	import "golang.org/x/net/http2/hpack"

	var _ = hpack.HuffmanDecode
	$ GOPATH= goimports -srcdir $GOROOT/src/math x.go
	package p

	import "golang.org/x/net/http2/hpack"

	var _ = hpack.HuffmanDecode
	$

The tests in this CL and the above transcript assume that
$GOROOT/src/vendor/golang.org/x/net/http2/hpack exists.
It did in 40a26c9, but it does not today.
It will again soon (once Go 1.7 opens).

For golang/go#12278 (original request).

Change-Id: I27b136041f54edcde4bf474215b48ebb0417f34d
Reviewed-on: https://go-review.googlesource.com/17728
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-02-18 16:47:46 +00:00
Russ Cox
d0c9d43af1 bundle: new docs, command-line interface
Before, "bundle -help" printed only one not particularly useful line:

	Usage of bundle:

and "bundle" printed a bit more but not a standard usage message:

	bundle: Usage: bundle package dest prefix

	Arguments:
	 package is the import path of the package to concatenate.
	 dest is the import path of the package in which the resulting file will reside.
	 prefix is the string to attach to all renamed identifiers.

And most of that output belonged in (but was missing from) the doc comment,
which leaned heavily on the reader inferring usage from one example.

While fixing all this, I ended up dropping "dest" and "prefix" as required
arguments: perfectly good defaults can be inferred in the common case
where the bundle is intended for the current directory. The defaults can be
overridden with the new -dst and -prefix option.

I corrected a TODO about not assuming the package name could be
derived from the destination import path. Like -dst and -prefix, the
default package name can be inferred from the current directory,
but there is also a new -pkg option to override the default if needed.

I added a -o option to specify the destination output file (standard output
is still the default output). One benefit of -o is that it makes the bundle
commands self-contained in the sense of not needing a shell.
That in turn makes them suitable for use with "go generate", so when -o
is specified the bundle output now includes a "//go:generate" comment
for updating the bundle mechanically.

To keep bundle working for net/http's use case, I added a -importmap
option to specify additional import rewrites (net/http needs the http2
import of golang.org/x/net/http2/hpack rewritten to begin with internal/golang.org).

The net effect of all of this is that the first two lines at the top of
net/http/h2_bundle.go will change from:

	// Code generated by golang.org/x/tools/cmd/bundle command:
	//   $ bundle golang.org/x/net/http2 net/http http2

to

	// Code generated by golang.org/x/tools/cmd/bundle.
	//go:generate bundle -o h2_bundle.go -prefix http2 -import golang.org/x/net/http2/hpack=internal/golang.org/x/net/http2/hpack golang.org/x/net/http2

and net/http's copy of http2 can now be updated by "go generate"
instead of by copying and pasting commands from source code to shell.

For an experiment I am doing with cmd/dist bundling archive/zip,
the header is even shorter and makes a better demonstration of the
power of the defaults:

	// Code generated by golang.org/x/tools/cmd/bundle.
	//go:generate bundle -o zip.go archive/zip

New usage message, printed by "bundle -help" and "bundle":

	Usage: bundle [options] <src>
	  -dst path
	    	set destination import path (default taken from current directory)
	  -import map
	    	rewrite import using map, of form old=new (can be repeated)
	  -o file
	    	write output to file (default standard output)
	  -pkg name
	    	set destination package name (default taken from current directory)
	  -prefix p
	    	set bundled identifier prefix to p (default source package name + "_")

See CL for new doc comment.

Following this CL I will send a CL updating the two-line header in net/http/h2_bundle.go
to match the new usage of the bundle, whatever that ends up being.

Change-Id: I83a65b6a500897854027cefdefb8f62f1d4448b4
Reviewed-on: https://go-review.googlesource.com/19428
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-02-17 15:40:24 +00:00
Alan Donovan
cd3cb7be66 cmd/guru: fix build breakage due to unneeded log import
I think this resulted from git automerging.

Change-Id: Icc285601846bd0a2a2bb2316ae4575395744c44b
Reviewed-on: https://go-review.googlesource.com/19511
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-02-16 02:42:20 +00:00
Alan Donovan
fb3df4a89d cmd/guru: definition: try parser-based resolution first
The parser does intra-file resolution.  It's only a best-effort but
it's extremely fast, so we try it first and fall back to the loader-based
implementation if it fails.

Also:
- factor definitionResult so it doesn't depend on either go/types.Object
  or go/ast.Object.
- guessImportPath: make importPath=="" result an error,
  since you can't import the empty string.  Simplify importQueryPackage.
- Make fastQueryPos continue in face of minor parse errors.
- describe: eliminate old TODO; suppress log statement.

Change-Id: I30a32487e9fd9d5308b1580ec12220cad2c16299
Reviewed-on: https://go-review.googlesource.com/19507
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
2016-02-16 00:29:23 +00:00
Alan Donovan
d7762ee5c0 cmd/guru: emacs: report an error when the guru command fails
Don't just display the output buffer or, worse, parse it as JSON.

Change-Id: I1125ff235a5073b07f45f587ef8844b8a12f05ac
Reviewed-on: https://go-review.googlesource.com/19508
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-15 21:39:43 +00:00
Alan Donovan
19c83edf02 cmd/guru: in Emacs, change 'definition' to jump directly
go-guru--run has been split up to separate running the tool
from turning its output into compilation-mode form.
The definition command uses only the first part,
and parses its output in JSON form.

Added test, factoring the test script.

Change-Id: I4c3e4a51a1346551a3703a5e3137c878d7b2d95f
Reviewed-on: https://go-review.googlesource.com/19499
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-15 17:57:16 +00:00
Alan Donovan
e08a7ae6bc cmd/guru: add support for loading modified files
The -modified flag causes guru to read a simple archive file from stdin.
This archive specifies alternative contents for one or more file names.
The build.Context checks this table before delegating to the usual
behavior.

This will not work for files that import "C" since cgo accesses the
file system directly.

Added end-to-end test via Emacs.

Simplify findQueryPos (now: fileOffsetToPos)

Credit: Daniel Morsing, for the prototype of this feature.

Change-Id: I5ae818ed5e8bb81001781893dded2d085e9cf8d6
Reviewed-on: https://go-review.googlesource.com/19498
Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
2016-02-15 15:04:13 +00:00
Alan Donovan
93ea01aea0 cmd/guru: describe: show methods and fields of an expression
Previously you had to describe a type to get this information,
which required two queries, and the need for this query is
extremely common.

Change-Id: I1d1d5b45fead60ca8719ddc302eee47d9f10a375
Reviewed-on: https://go-review.googlesource.com/19501
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-15 03:46:17 +00:00
Alan Donovan
608d57b3ae cmd/guru: call{ers,stack}: avoid pointer analysis where possible
As an optimization, the callers and callstack queries now avoid the
relatively costly pointer analysis in some common cases:

The callers of a function that is never address-taken can be enumerated
directly from the SSA representation.

Similarly, the callstack can be computed initially by ignoring dynamic
call edges; we run the pointer analysis only if no path is found in this
partial callgraph.  As a bonus, this also causes the tool to
preferentially report all-static callpaths.

A callers query on fmt.Errorf now completes in 3 seconds instead of 8,
and a callstack query completes in 2 seconds instead of 8.

The new code is covered by the existing tests.

Change-Id: I777ea07a1cdb6cadcc2a94952f553b6b036e7382
Reviewed-on: https://go-review.googlesource.com/19496
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-12 23:38:00 +00:00
Alan Donovan
8da9f8bbd7 cmd/guru: describe: show selectable fields when describing a type
Also, qualify field and method types relative to the defining package,
not the query package.

Change-Id: If65d2a4c2fd60e51d0d34e44000954e95106972e
Reviewed-on: https://go-review.googlesource.com/19495
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-12 23:35:49 +00:00
Alan Donovan
1d6b8698af cmd/guru: remove vestiges of -pos flag
It's a positional parameter now.

Also, update -help message to address
https://go-review.googlesource.com/#/c/19474 comments

Change-Id: Ie5947aa3c37180961e780747ca02be54f7030c21
Reviewed-on: https://go-review.googlesource.com/19493
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-02-12 22:00:14 +00:00
Alan Donovan
00b8b1eb95 cmd/guru: clean ups to command-line interface
-pos is now a positional argument; -scope is now a flag.
Tidy up usage message.
Update Vim and Emacs scripts and test
Remove call to GOMAXPROCS.
Use log.{SetPrefix,SetFlags} and Fatalf

Change-Id: I3786ed83aecb17d622b29d2a538a374f813f0adc
Reviewed-on: https://go-review.googlesource.com/19438
Reviewed-by: Michael Matloob <matloob@golang.org>
2016-02-12 21:50:49 +00:00
Alan Donovan
789265387f cmd/guru: freevars: reenable test of labels (and improve output)
Change-Id: Icb7747d0856a4be2de52e143b793b52a725d297c
Reviewed-on: https://go-review.googlesource.com/19437
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-02-12 03:59:51 +00:00
Alan Donovan
37bb37ec1c cmd/guru: fix bad import, and run gofmt
Change-Id: Ieb5c732bad494942f7b45ac5a1b605e810436e87
Reviewed-on: https://go-review.googlesource.com/19478
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-02-12 03:58:01 +00:00
Alan Donovan
7347379304 cmd/guru: rename oracle to guru, copying it to a single package
See plans at:
https://docs.google.com/document/d/1UErU12vR7jTedYvKHVNRzGPmXqdMASZ6PfE7B-p6sIg/edit#heading=h.t5rbcuy7di7j

Change-Id: I369747e0ce8cd42a2975eb0f651a2e5fba47cf9e
Reviewed-on: https://go-review.googlesource.com/19475
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-02-12 03:38:58 +00:00
Alan Donovan
78e666a894 cmd/oracle: add pointsto, whicherrs to help message
Also, remove stale example.

Change-Id: Ifa1123b9dca49c991a16ef35eb7227847878c657
Reviewed-on: https://go-review.googlesource.com/19474
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-02-11 22:30:21 +00:00
Larz Conwell
9a6ae37d4e cmd/godoc: accept GOOS and GOARCH URL parameters in -http mode
This allows users to change the GOOS/GOARCH without running their own
godoc server (or restarting with appropriate env vars).

Change-Id: I0b54ef1b2dd93cf2c965ca584d8df74119ed1be6
Reviewed-on: https://go-review.googlesource.com/1371
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-02-04 22:11:53 +00:00
Brad Fitzpatrick
b47dfd93e5 all: fix plan9 failures
Updates golang/go#11811

Change-Id: I6ed252eb3272354fce8084ec99f4777e41c3daa3
Reviewed-on: https://go-review.googlesource.com/18993
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-01-28 00:31:03 +00:00
Chris Broadfoot
e7cdd7bb9f cmd/tip: update deploy instructions
Change-Id: I5c26a2fc8ef7c0ad99c3d176b866f221cb39c9e2
Reviewed-on: https://go-review.googlesource.com/18980
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-27 02:50:12 +00:00
Chris Broadfoot
ce967854d3 cmd/tip: move side health check to main health check. Use 503.
500 is considered to be healthy. Use 503 instead, so the instance is
considered unhealthy while the side is coming up.

Add some extra log statements that help debug instances from
application logs.

Fixes golang/go#13682.

Change-Id: I713c8c2fa75de4e275f632b999edc98cedd257bd
Reviewed-on: https://go-review.googlesource.com/18547
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-25 21:17:16 +00:00
Timothy Studd
b57d82def5 x/tools/present: add video element for slides
Change-Id: I19f7c181d9bd8148f7791925f04207a34c95ac1e
Reviewed-on: https://go-review.googlesource.com/18484
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-13 03:34:37 +00:00
Alan Donovan
f8ecfdb6b6 cmd/stringer: fork and tag for go1.4
The previous change updated the import of golang.org/x/tools/go/types
to the standard go/types package, causing 1.4 builds to fail.

Fixes #13874.

Change-Id: Idf0b4ac5e4e01dd5cd7cc9b89d017fbffb7a29df
Reviewed-on: https://go-review.googlesource.com/18430
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-11 14:24:22 +00:00
Alan Donovan
da91609d88 cmd/vet: roll back update of go/types import
(from importing golang.org/x/tools/go/types to std lib go/types)

The cmd/vet package should never have been included in this change.

Tested with 1.4.1, 1.5 and ~1.6 (tip).

Change-Id: I6d915619cbfa0297dbb9aa9ba033c1320a08c367
Reviewed-on: https://go-review.googlesource.com/18385
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-01-07 20:27:05 +00:00
Timothy Studd
1e63c6ac3b present: add background image element for slides
Fixes golang/go#11470

Change-Id: I665622197bea48b95adc839be8de7d03bf812f37
Reviewed-on: https://go-review.googlesource.com/18360
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-07 03:28:50 +00:00
Alan Donovan
542ffc7e75 tools: switch to standard go/types at tip
A few files have been forked and tagged "go1.5,!go1.6" to work around
minor API changes between the two types packages:
- constant.Value.String() in oracle/describe.go and its tests;
- constant.ToInt must now be called before constant.Int64Val.
- types.Config{Importer: importer.Default()} in a number of places
- go/types/typeutil/import_test.go uses lowercase names to avoid 'import "C"'.

Files in go/types/typesutil, missing from my previous CL, have been
tagged !go1.5; these files will be deleted in February.

All affected packages were tested using 1.4.1, 1.5, and ~1.6 (tip).

Change-Id: Iec7fd370e1434508149b378438fb37f65b8d2ba8
Reviewed-on: https://go-review.googlesource.com/18207
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-06 22:15:26 +00:00
Alan Donovan
2477c0d578 x/tools/...: fork and tag !1.5 all files that use go/types et al
This change will ensure that the tree continues to work with go1.4.1.

All files continue to depend on golang.org/x/tools/go/types, but in a
follow-up change, I will switch the primary files to depend on the
standard go/types package.  Another (smaller) set of files will be
forked and tagged, this time !1.6, due to API differences between the
two packages.

All tests pass using 1.4.1, 1.5, and ~1.6 (tip).

Change-Id: Ifd75a6330e120957d646be91693daaba1ce0e8c9
Reviewed-on: https://go-review.googlesource.com/18333
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-01-06 20:40:09 +00:00
Alan Donovan
108b52ee61 cmd/gorename: -d flag prints diffs instead of rewriting files
The user may specify the diff tool using the -diffcmd flag.

+ test.

Also:
- eliminate redundant DryRun flag
- simplify Verbose messages using log.SetPrefix

Fixes issue #13355

Change-Id: I917edc73e31ddf0f5d5b9b30c43f826465529da1
Reviewed-on: https://go-review.googlesource.com/18208
Reviewed-by: Michael Matloob <matloob@golang.org>
2015-12-30 15:25:00 +00:00
Alan Donovan
99c318c742 cmd/bundle: add blank line before package declaration
so that the bundled package doesn't clobber the package declaration
of the host package.

Also: minor comment tweaks.

Change-Id: I28ab3aca2b02213edc95c6b12c0d1a2514453cfe
Reviewed-on: https://go-review.googlesource.com/18040
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-18 13:56:53 +00:00
Chris Broadfoot
4a5fb9938b cmd/tip: add App Engine Managed VM health check handler
Change-Id: I67826efaa3cb2883771837581dd95aa9ec3e6d2b
Reviewed-on: https://go-review.googlesource.com/18025
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-18 02:25:12 +00:00
Alan Donovan
c0008c5889 x/tools/cmd/callgraph: add -ptalog flag
Since this tool is a handy way to run the pointer analysis during debugging.

Change-Id: If9a62f71dd8651ad6c782ead85bb84f09c703cba
Reviewed-on: https://go-review.googlesource.com/17382
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-12-04 17:49:28 +00:00
Andrew Gerrand
9cd799205e cmd/godoc: add redirect for x/term repo
Update golang/go#13104

Change-Id: I76102038d8dc87503c9a8994f9008b1a9fdb19d4
Reviewed-on: https://go-review.googlesource.com/17020
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-11-18 05:08:28 +00:00
Tamir Duberstein
4b07c5ce8a cmd/stringer: prepend "Code" to codegen warning
This allows Github to hide diffs in generated files. See:
https://github.com/github/linguist/blob/473282d/lib/linguist/generated.rb#L241

Change-Id: Ic0a9ed80ecc6130d81fd0ba10e2df48217eb14cc
Reviewed-on: https://go-review.googlesource.com/15073
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-11-08 08:43:00 +00:00
Andrew Gerrand
dec63b8e98 cmd/godoc: add x/time and x/sync redirects
Fixes golang/go#13133

Change-Id: I45031352d4d7c040889134310ad5721dd9dcc1ee
Reviewed-on: https://go-review.googlesource.com/16640
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-04 02:28:00 +00:00
Alan Donovan
199b70b426 x/tools/cmd/bundle: a tool to concatenate source files, preserving reference integrity
+ Test.

For background, see "http -> http2 -> http import cycle" thread on golang-dev.

Change-Id: Idc422247e5935ef7615cd5e8b7e2c489f7f2bc31
Reviewed-on: https://go-review.googlesource.com/15850
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-10-29 19:10:01 +00:00
Tw
6a71ab8780 cmd/present: only include play.js in article when necessary
There is no need to add play.js in article page when
playground is disabled.

Signed-off-by: Tw <tw19881113@gmail.com>

Change-Id: If40d256c89d7bd37efff9e08bb176bd3ea2d6f88
Reviewed-on: https://go-review.googlesource.com/16415
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-10-29 04:57:28 +00:00
David du Colombier
81e6679d08 x/tools/cmd/stress: build on Plan 9
Fixes golang/go#11975.

Change-Id: Icfbf3015031824481b351ac78be5917ee5d20e8e
Reviewed-on: https://go-review.googlesource.com/16306
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
2015-10-26 22:13:12 +00:00
Matt T. Proud
f53a5581bc cmd/present: update the instructions for App Engine
The command's documentation mistakingly said that the instructions for
testing and deployment to App Engine were contained in the top-level
README for the tools repository.  As best as I can tell, the top-level
README never contained this information.

This commit adds a configuration fragment and provides sample
instructions for the App Engine workflow.

Change-Id: If89c099e254ef91ca224742aebd81f7d1206d9b8
Reviewed-on: https://go-review.googlesource.com/15685
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-10-12 09:20:14 +00:00
Robert Griesemer
fe3445e822 x/tools/cmd/godex: prepare sources for switch to 1.5 go/types
- copied all affected xxx.go files to a respective xxx14.go file
- added build tags
- no other source changes

Change-Id: Ic150a097e537ee29a0e0616ab8e1e74b21e3066d
Reviewed-on: https://go-review.googlesource.com/15702
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-10-09 20:47:08 +00:00
Nathan VanBenschoten
78a4eef087 cmd/oracle: Fix help message for Go Oracle usage.
Change-Id: Iba2c49c380ca81cd76b84c384ff468b8779f80e4
Reviewed-on: https://go-review.googlesource.com/15382
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-10-06 05:09:09 +00:00
Andrew Gerrand
10179a7e86 cmd/godoc: set Content-Type in fmt handler
Change-Id: I51b12838c65d67d4323e07d70f7c1e66fce23251
Reviewed-on: https://go-review.googlesource.com/14938
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-28 02:55:19 +00:00
Mhd Sulhan
2b5f3dc0de cmd/godoc: make setup-godoc-app.bash more portable
Unlike in BSD, in GNU/Linux find option for -depth is without an
argument. To make the command compatible in both system, use
-mindepth and -maxdepth arguments.

Change-Id: Ie82736fd2c28b6fe0f64dbfc7272f0e0f0d8e8df
Reviewed-on: https://go-review.googlesource.com/15014
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-27 06:24:22 +00:00
Andrew Gerrand
6b41c776c8 cmd/godoc: always serve fmt handler, HTTPS fix redirection
Change-Id: Ib00a54f40b3c52c9bc6a07623259c5c82f9d28d9
Reviewed-on: https://go-review.googlesource.com/14933
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-25 02:10:07 +00:00
Andrew Gerrand
c206e42859 cmd/godoc: serve proxy paths without host enforcer
Change-Id: I4647c1e18df3ea441c5220cd03fe6163794b7e84
Reviewed-on: https://go-review.googlesource.com/14862
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-09-23 05:23:18 +00:00
Andrew Gerrand
e83bc56334 godoc/{dl,proxy,short}: move packages out of Google's internal repo
These were built inside Google but have been in production for years.
Move them into the public tools repository so that they can be more
easily maintained.

This is step one to moving the entire golang.org deployment process out
of Google's internal source repository.

Change-Id: I72f875c5020b3f58f1c0cea1d19268e0f991833f
Reviewed-on: https://go-review.googlesource.com/14842
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-09-23 03:53:05 +00:00
Andrew Gerrand
40b1b219de cmd/godoc: restrict requests to HTTPS and canonical host names
Fixes golang/go#12684

Change-Id: Ibb49e604bfd92c902c9fd2bf9506ded60b2a9d8d
Reviewed-on: https://go-review.googlesource.com/14814
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-22 23:49:55 +00:00
Rob Pike
5a90b2958f vet: put a notice in main that this version of vet is not the place to update
Change-Id: I295d1e902626a3f5edd09a3b594a2059530ca821
Reviewed-on: https://go-review.googlesource.com/14820
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-21 17:48:06 +00:00
Ford Hurley
0ced849c61 tools/cmd/vet: check only first rune of example suffix
The documentation for the testing package states only that "The suffix
must start with a lower-case letter."

Fixes golang/go#12663

Change-Id: I9b079b105a7c9680325fed442c42adcf3b75055e
Reviewed-on: https://go-review.googlesource.com/14760
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-21 00:24:47 +00:00
Andrew Gerrand
1d593709ec cmd/tip: serve talks.golang.org
Also make health check test the backup process.

Change-Id: I9d2ed2780c07bb08683d231fccad4674c2ac22a1
Reviewed-on: https://go-review.googlesource.com/14668
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-18 04:55:56 +00:00
Andrew Gerrand
ac6d9c1d84 cmd/present: include Google Analytics tracking code for talks.golang.org
This was formerly inserted by some deployment scripts. Putting it in
the code here simplifies deployment at little cost to other users.

Change-Id: Ic092bb560c4c90e0e5bc6f9f33426b35214d613d
Reviewed-on: https://go-review.googlesource.com/14741
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-18 04:43:10 +00:00
Andrew Gerrand
51ebb3f1be cmd/present: move critical _ import to another file
This was preventing the playground /compile and /share handlers
from being registered under Managed VMs.

Change-Id: I690bd50abc2f42b30956e734903d09487f712d4a
Reviewed-on: https://go-review.googlesource.com/14665
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-17 03:09:26 +00:00
Andrew Gerrand
ffb6076c75 playground: recognize managed vm's as being "on app engine"
Change-Id: I117b113e2782cab1180e6f56e1869525564ab18f
Reviewed-on: https://go-review.googlesource.com/14663
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-17 02:42:04 +00:00
Andrew Gerrand
25693e10e1 cmd/tip: refactor tipgodoc into general-purpose tip server
This will allow us to serve blog.golang.org and talks.golang.org from
the latest sources without re-deploying.

Change-Id: I2399a8a7eb60a0c6648916052f5f129cb826d546
Reviewed-on: https://go-review.googlesource.com/14662
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-17 02:04:37 +00:00
Andrew Gerrand
6c387a1d07 cmd/tipgodoc: implement health checking and enable auto-scaling
Change-Id: I860d0913d051616d7958a88a3c7b11a26ec1d4d6
Reviewed-on: https://go-review.googlesource.com/14661
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-09-17 01:18:34 +00:00
Andrew Gerrand
374b14e99b cmd/tipgodoc: fix deployment instructions
Change-Id: Iaa8e1e61f5c6966a66fc613173853846408584b5
Reviewed-on: https://go-review.googlesource.com/14636
Reviewed-by: Chris Broadfoot <cbro@google.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-17 00:09:34 +00:00
Matt T. Proud
c262de870b tools/cmd/vet: Sort checks list alphabetically.
The existing list of checks in doc.go has become somewhat unwieldy.
This commit is purely cosmetic and sorts the list alphabetically keyed
by the flag name.

Change-Id: Ibb56357f9d4667d199acc6637dc28f6e17903046
Reviewed-on: https://go-review.googlesource.com/14558
Reviewed-by: Rob Pike <r@golang.org>
2015-09-15 17:18:38 +00:00
Matt T. Proud
871b75fbfc tools/cmd/vet: Incorporate comments from r@.
This commit fixes a few defects from a25a8d567b:

(1.) Making the top-level vars in main consistent w.r.t. documentation
     formatting, and the-like.

(2.) Removing of one-use top-level is-test predicate.

(3.) Including documentation of what the validation does and when.

Change-Id: I19b34d25836bb2af865219d18600e1add78c3fd7
Reviewed-on: https://go-review.googlesource.com/14557
Reviewed-by: Rob Pike <r@golang.org>
2015-09-15 16:08:13 +00:00
Matt T. Proud
a25a8d567b tools/cmd/vet: Create vet checks for examples.
In spite of https://blog.golang.org/examples and
http://golang.org/pkg/testing/#pkg-examples, a number of internal Go
authors have found writing documentation examples to be problematic in
the sense that the syntax is error-prone due to loose coupling with
identifiers found in the source corpus.

This commit introduces a suite of validations for documentation
examples:

    Overall:
    - Correct suffices, if present
    - Niladic function argument and return signatures

    func Example() {}
    func ExampleF() {}
    - F exists
    func ExampleT() {}
    - T exists
    func ExampleT_M() {}
    - T exists
    - M exists within T

Further, if the example is in `package foo_test`, vet attempts to
resolve the respective lookups in `package foo`, if `package foo`
exists (cf., `package stringutil_test`).

Change-Id: Ifa13906363541ebf28325681b749b14b7f8b103d
Reviewed-on: https://go-review.googlesource.com/11982
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-15 07:54:34 +00:00
Andrew Gerrand
31971b7521 godoc: fix source links for cmd/*
Fixes golang/go#12159

Change-Id: Id498443171cbdf0fe9808745a79edc863d836db1
Reviewed-on: https://go-review.googlesource.com/14001
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-11 00:20:26 +00:00
Alan Donovan
b9fbbb8e31 refactor/eg: refactor to break dependency on go/loader
Change-Id: I0a865a694b911437944743f60bfaa2a937d85c9a
Reviewed-on: https://go-review.googlesource.com/14133
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-01 14:26:06 +00:00
Alan Donovan
af0fde4393 cmd/fiximports: -replace flag specifies canonical packages in absence of import comments
+ Tests.

Change-Id: I0544546dda93d24aedbbfe1ffdc6882e76bfb3f8
Reviewed-on: https://go-review.googlesource.com/12940
Reviewed-by: Jason Buberel <jbuberel@google.com>
2015-09-01 14:23:39 +00:00
Andrew Gerrand
513c731aab cmd/godoc: add x/arch repo to list
Fixes golang/go#12393

Change-Id: I0b56c36dec11a6c2fddcc092867f24701815dce3
Reviewed-on: https://go-review.googlesource.com/14145
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-01 03:09:27 +00:00
Alan Donovan
afcda55b39 go/ssa: rename some API features (incompatible change)
Rename the following exported names:
	(*Program).BuildAll → Build
	(*Program).Method   → MethodValue
	Package.Object      → Pkg
Also:
	(*Function).pkgobj  → pkg

Change-Id: Iff7e6c240ebe6786ba759278ac0daa3d66698013
Reviewed-on: https://go-review.googlesource.com/14134
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-08-31 22:20:12 +00:00
Robert Griesemer
b48dc8da98 cmd/gotype: keep gotype working with Go1.4
Fixes #12305.

Change-Id: Ib9e36621708ab35fd0e685aaca37d8640f265366
Reviewed-on: https://go-review.googlesource.com/13899
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-08-25 03:53:50 +00:00
Robert Griesemer
12c48ced94 cmd/gotype: use std lib go/types instead of x/tools version
Change-Id: I89ba20512129d0557f3f606d8242472d78ea37a9
Reviewed-on: https://go-review.googlesource.com/13898
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-08-24 21:28:19 +00:00
Andrew Gerrand
9f2124fb70 cmd/tipgodoc: change capitalization of 'Authors' to be consistent
Change-Id: I040007a2b9bfa3388f3fbed839b2e5c6853925b3
Reviewed-on: https://go-review.googlesource.com/13596
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-08-16 08:15:44 +00:00
Robert Griesemer
d02228d185 cmd/callgraph: exclude test for Android
For golang/go#11811.

Change-Id: I4cec398a0a6d43f3297c205f73193522928a5b31
Reviewed-on: https://go-review.googlesource.com/13280
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-06 01:46:44 +00:00
Robert Griesemer
958ab4f550 x/tools: disable tests not supported on Android
For golang/go#11811.

Change-Id: Icf16a2d47fcf2fe0d79dd825ccb851a3d63a660f
Reviewed-on: https://go-review.googlesource.com/13268
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-06 00:36:03 +00:00
Robert Griesemer
63f996ec75 cmd/stringer: exclude end-to-end test for Android
Change-Id: I37224abb3d9ca902ed23d520493f3b2794ef0471
Reviewed-on: https://go-review.googlesource.com/13261
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-08-05 22:44:14 +00:00
Robert Griesemer
5a6a7b4d40 x/tools/cmd/stress: don't build for Plan 9 (syscall.SIGABRT not defined)
See golang/go#11975.
For golang/go#11811.

Change-Id: I56ee20cd798bf963afdf3c81c4745f07850f6dcc
Reviewed-on: https://go-review.googlesource.com/13034
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-31 22:56:17 +00:00
Robert Griesemer
32dcbb4ccc cmd/godoc: exclude TestTypeAnalysis on Plan 9 for now
Attempt to make build work on Plan 9.

For golang/go#11811.

Change-Id: I37a5eaef441262342994a8f77c86aa5e120deea7
Reviewed-on: https://go-review.googlesource.com/13033
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-31 22:39:36 +00:00
Alan Donovan
680b4cd5a8 cmd/fiximports: added package-level documentation
Change-Id: I612229e5d9e80a25cd77296c0abb6bdcf62bcf8a
Reviewed-on: https://go-review.googlesource.com/12924
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-31 13:54:42 +00:00
Andrew Gerrand
d1eaf38956 cmd/godoc: don't run indexer test in -short mode
It takes too long for the builders.
Also remove GOPATH from the environment when indexing.

Change-Id: I9a3f2628f248bdbf9dce97119c2fbb7cbd63f3fe
Reviewed-on: https://go-review.googlesource.com/12917
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-31 05:12:20 +00:00
Alex Brainman
0cac9d87b7 cmd/fiximports: make tests pass on windows
Update golang/go#11811

Change-Id: I1f8977cf8eed84936c7c2b568f87abe88f5723f9
Reviewed-on: https://go-review.googlesource.com/12788
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-29 07:14:17 +00:00
Alex Brainman
7ba2a8c9a9 cmd/vet: make TestTags pass on windows
Update golang/go#11811

Change-Id: I3d875acf58a015fa4cae16473a118ac8196b9b44
Reviewed-on: https://go-review.googlesource.com/12789
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-29 05:48:44 +00:00
Austin Clements
69f53eb622 cmd/stress: add "-ignore regexp" flag
This adds a flag for specifying a regular expression for failures that
should be ignored. This is useful for filtering out known issues and
provides a logical mirror to the existing -failure flag.

Change-Id: Ibbacdd2125aa23fe819896e5a17664b703c4ee35
Reviewed-on: https://go-review.googlesource.com/12676
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-07-26 16:09:35 +00:00
David Crawshaw
5c915edf62 cmd/godoc: redirect /x to subrepo page
Fixes golang/go#9061.

Change-Id: Ibe5764932bb8e223e7f838415f84bc330eb5d818
Reviewed-on: https://go-review.googlesource.com/12082
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-13 18:17:26 +00:00
Andrew Gerrand
7e09e07243 cmd/present: fix mixed content warnings when served by HTTPS
Fixes golang/go#11392

Change-Id: Ic7ecf19d88c5a7f1d0ef9bd21476074b242854f0
Reviewed-on: https://go-review.googlesource.com/11534
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-29 01:10:50 +00:00
Josh Bleecher Snyder
85ad76014a cmd/vet: fix build
Broken by CLs 10994 and 10800.

Fixes golang/go#11194.

Change-Id: Ic071fae6bf7e8ac9518d84c74c98d1d7233c2025
Reviewed-on: https://go-review.googlesource.com/11004
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-06-12 23:48:11 +00:00
Robert Griesemer
a6d2a4254e cmd/vet: backport of https://go-review.googlesource.com/#/c/10777/3
Change-Id: I8d63575f2053eda2d7f0a63f3ff862bf0de88d31
Reviewed-on: https://go-review.googlesource.com/10807
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-06-09 16:33:12 +00:00
Robert Griesemer
f0b0213b21 cmd/vet: remove dependency on types.New
In preparation for removal of types.New.

Change-Id: Ieff0c41cf03351124cea32e9b96075a4801c051f
Reviewed-on: https://go-review.googlesource.com/10775
Reviewed-by: Rob Pike <r@golang.org>
2015-06-05 20:06:37 +00:00
Rob Pike
cc54cd6553 cmd/vet: don't use filepath.Join to build binary name in test
It cleans the string and removes the initial ./, which will cause the
test to fail if . is not in $PATH

Change-Id: Icc216f7ab4887c39ccda93d1c4093ccd03de44bc
Reviewed-on: https://go-review.googlesource.com/10696
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-06-04 21:29:42 +00:00
Rob Pike
3caa6cfbd2 cmd/vet: add -tags flag
This is needed to control which files to test in the usual manner.
A followup CL on the main repo will add the flag to the go vet command.

Updates golang/go#10228

Change-Id: I820d3c74657b58de5e92276627368dedf4e2096c
Reviewed-on: https://go-review.googlesource.com/10692
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-04 19:20:34 +00:00
Nick Craig-Wood
578c521fc2 cmd/stringer: fix panic caused by integer overflow
When String() was called on the maximum value of an integer type (eg
255 for uint8) this would cause an integer overflow, which would cause
an index error later in the code.

Fixed by re-arranging the code slightly.

Fixes golang/go#10563

Change-Id: I9fd016afc5eea22adbc3843f6081091fd50deccf
Reviewed-on: https://go-review.googlesource.com/9255
Reviewed-by: Rob Pike <r@golang.org>
2015-06-02 19:44:20 +00:00
Rob Pike
27e692e6ec cmd/cover: check error
The variable was assigned but not used, as caught by a tool
written by gorden.klaus@gmail.com.

Change-Id: I84ca3d00896287a35561bd122a0cf64212854a86
Reviewed-on: https://go-review.googlesource.com/10610
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-02 04:29:08 +00:00
Alan Donovan
8ccf558e8a cmd/callgraph: update flag docstring
And add a TODO.

Change-Id: I51c63b32e9ac4309cdfb8228348a5d528f36a919
Reviewed-on: https://go-review.googlesource.com/10489
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-05-29 17:21:31 +00:00
Austin Clements
45716cd4c6 cmd/stress: print number of failed runs
Currently at the end of a long stress run you may not know from the
end of the output whether there were any failures. Add a failure count
to the periodic status message to make this obvious.

Change-Id: I5ad19b9e6f462369fb32be6efbfb6f21568e98e4
Reviewed-on: https://go-review.googlesource.com/10187
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-05-19 12:13:22 +00:00
Alan Donovan
7d75e8b219 cmd/fiximports: a tool to rewrite import paths to match import comments.
fiximports enumerates the set of packages identified by the
command-line arguments, using "go list" notation.  Within each
package, it replaces all imports of non-canonical packages by their
canonical name, introducing an import renaming if (heuristically)
necessary.

If a package comes from one of the -baddomains, and it has no import
comment, fiximports reports an error.  The error message includes the
list of packages that import the errant package, directly or
indirectly.  This flag is used to indicate "sinking ship" package
hosting domains like code.google.com.

Caveat: this process is not trivially reversible.  Consider a package A
to which we add an import comment "B", and run the tool.  Package C,
which imported A, now imports B.  ('go get -u' would fetch package B).
But changing the import comment in directory A and re-running the tool
will not cause C to be changed because it no longer imports A; it
imports B.

+ Tests.

Change-Id: I3d3d9663d3c084356fffc7e55407709ebc6d9a39
Reviewed-on: https://go-review.googlesource.com/8562
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-05-13 15:07:09 +00:00
Alan Donovan
d1b42377f9 cmd/oracle: improve error messages
Also, in Emacs, make 'referrers' query not prompt for a scope.

Change-Id: I5c0f034d4fa8b653311f1b7d8ff58b699d168b79
Reviewed-on: https://go-review.googlesource.com/9927
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-05-13 15:02:11 +00:00
Alan Donovan
d00f0cb57d cmd/oracle: emacs: look for oracle on $PATH and nowhere else
Change-Id: Ifbc8e3ff6fe22a56e29fe7ba8004510cb0cee343
Reviewed-on: https://go-review.googlesource.com/9687
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-05-08 16:30:11 +00:00
Rob Pike
96f6cfbb92 cmd/cover: document that it is moving to the standard repository
Change-Id: I876afaa2c468f0f6f5d30bff8bc884e3beb33c7f
Reviewed-on: https://go-review.googlesource.com/9539
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-05-01 00:38:25 +00:00
Alan Donovan
8ff1f51a5b cmd/oracle: expect oracle binary beneath $GOBIN, $GOPATH/bin, or $GOROOT/bin
in that order, so that "go get golang.org/x/tools/cmd/oracle" installs
it and no copy is needed.  We keep the old location for compatibility.

Why is if/else control flow so hard in basic Lisp?  Sometimes you just need 'return'.

Change-Id: Iae231a761d707daaa1316161cfad0365111eff0e
Reviewed-on: https://go-review.googlesource.com/9547
Reviewed-by: David Chase <drchase@google.com>
2015-04-30 19:31:40 +00:00
Dmitry Vyukov
7534f4943d x/tools/cmd/stress: add utility for stress testing
The stress utility is intended for catching of episodic failures.
It runs a given process in parallel in a loop and collects any failures.
Usage:
 	$ stress ./fmt.test -test.run=TestSometing -test.cpu=10
You can also specify a number of parallel processes with -p flag;
instruct the utility to not kill hanged processes for gdb attach;
or specify the failure output you are looking for (if you want to
ignore some other episodic failures).

Do you find it useful?
I use it for several years for all kinds of episodic failures (not just Go btw).

Change-Id: I06553345b76768a819412acb45f9bdfb3bababf7
Reviewed-on: https://go-review.googlesource.com/9373
Reviewed-by: Keith Randall <khr@golang.org>
2015-04-28 09:34:05 +00:00
Alan Donovan
ee9a07d373 go/buildutil: TagsFlag provides a flag.Value for setting build.Context.BuildTags from -tags flag.
Add -tags flag to oracle, ssadump, callgraph, gomvpkg, gorename, eg.

Change-Id: I4a818501b2331c4ea589caca37a3ad9d381dc8af
Reviewed-on: https://go-review.googlesource.com/9172
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-23 14:10:21 +00:00
Josh Bleecher Snyder
b1aed1a596 cmd/vet: add arm64 asmdecl support
Change-Id: I5ab54616488bc9bc41aefb27b45d72c36fc4fbde
Reviewed-on: https://go-review.googlesource.com/9211
Reviewed-by: Rob Pike <r@golang.org>
2015-04-22 01:25:24 +00:00
Alan Donovan
9c57c19a58 go/loader: eliminate ImportFromBinary option and PackageCreated hook
The loader package now loads, parses, and type-checks a whole program
from source, and that is all.

Also:
- simplified loader logic
- ssa.Create is gone; use ssautil.CreateProgram.
- ssautil.LoadPackage renamed to BuildPackage.
  It is now independent of go/types' Import hook and the Packages map.
- ssadump: -importbin flag removed.
  The value of this flag was that it caused the tool to print IR
  for only a single package; this is now the normal behaviour.

Fixes #9955

Change-Id: I4571118258ab1a46dccece3241b7dc51401a3acc
Reviewed-on: https://go-review.googlesource.com/8953
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-04-17 18:58:17 +00:00
Robert Griesemer
14c815ee28 cmd/vet: remove (another) dependency on go/astutil
Missed this in a prior change.

Change-Id: I7358c17b73a1221cb8f9dff6b808fdea8b13ec06
Reviewed-on: https://go-review.googlesource.com/8916
Reviewed-by: Rob Pike <r@golang.org>
2015-04-14 16:22:22 +00:00
Robert Griesemer
850ba653f7 Revert "cmd/vet: switch to go/types from std repo"
This reverts commit 5b72e8e9bb.

Change-Id: I75270045022d69444b7812f290cdd5861af13feb
Reviewed-on: https://go-review.googlesource.com/8915
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-04-14 03:54:48 +00:00
Robert Griesemer
5b72e8e9bb cmd/vet: switch to go/types from std repo
Depends on https://golang.org/cl/8767/.

With this change, cmd/vet does not depend on x/tools anymore
and could be moved into the std repo if so desired.

Change-Id: Ia205c6e1a6a63eebb27776064e5c24491043b683
Reviewed-on: https://go-review.googlesource.com/8791
Reviewed-by: Rob Pike <r@golang.org>
2015-04-14 00:30:21 +00:00
Robert Griesemer
48e2a5be44 cmd/vet: remove dependency on go/ast/astutil
This package was only imported for the trivial Unparen function.

Change-Id: I0ead916a7fdb469a26b4fe99c6964a8ed1438c49
Reviewed-on: https://go-review.googlesource.com/8566
Reviewed-by: Rob Pike <r@golang.org>
2015-04-08 15:52:25 +00:00
Tommy Schaefer
0770aced4f cmd/tipgodoc: Kill godoc process if http.ListenAndServe fails
Currently, if for some reason http.ListenAndServe fails, any running
running godoc processes don't get killed. I don't think this would ever
actually happen because, with godoc being set up in a separate go
routine, http.ListenAndServe would always(?) fail before the godoc
server started.

This change ensures that, if a Proxy has a cmd, it is closed when
http.ListenAndServe fails.

Change-Id: I0d3bfae0c16bc583248c2052a4d7a84c95127e76
Reviewed-on: https://go-review.googlesource.com/8570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-08 14:14:19 +00:00
Alan Donovan
4a08fb6fc3 cmd/vet: -unusedresult: report calls of pure functions in expression statements
Change-Id: Ib8b6eaecd56ae15c44fb8ac11c781244964428f1
Reviewed-on: https://go-review.googlesource.com/6661
Reviewed-by: David Symonds <dsymonds@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-04-06 21:44:23 +00:00
Alan Donovan
c6a14e550a cmd/ssadump: fix usage message
Change-Id: I95fee5042e39156462a5c21ade29d7216474be02
Reviewed-on: https://go-review.googlesource.com/8384
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-04-02 16:54:45 +00:00
Rob Pike
65b5a8eca7 cmd/cover: cover funcs in if, for, switch clauses
This peculiar case arose in range statements but there are other contexts
and one turned up in the auto-generated translation of the compiler.
Take care of it always.

	for i := 0; i < 0; func() {i++; q=q.Link}() { ... }

That code has been given the obvious rewrite but we should still handle it.

Odd but easy to fix (tricky to test).

Fixes #10269.

Change-Id: I66e1404eb24da15a24be7f67403e19ed66fba0a7
Reviewed-on: https://go-review.googlesource.com/8284
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-03-31 19:20:52 +00:00
Alan Donovan
a27f5b3448 oracle: factor part of the initial setup for PTA queries
The check for len(argv)==0 now only applies to these modes.

Also, more consistent variable naming.

Change-Id: I9adb6bebc819eb43d54ddf63c42d952671ce9236
Reviewed-on: https://go-review.googlesource.com/8244
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-30 21:02:07 +00:00
Alan Donovan
b28839e4bd oracle: several major improvements
Features:

  More robust: silently ignore type errors in modes that don't need
  SSA form: describe, referrers, implements, freevars, description.
  This makes the tool much more robust for everyday queries.

  Less configuration: don't require a scope argument for all queries.
  Only queries that do pointer analysis need it.
  For the rest, the initial position is enough for
  importQueryPackage to deduce the scope.
  It now works for queries in GoFiles, TestGoFiles, or XTestGoFiles.
  (It no longer works for ad-hoc main packages like
  $GOROOT/src/net/http/triv.go)

  More complete: "referrers" computes the scope automatically by
  scanning the import graph of the entire workspace, using gorename's
  refactor/importgraph package.  This requires two passes at loading.

  Faster: simplified start-up logic avoids unnecessary package loading
  and SSA construction (a consequence of bad abstraction) in many
  cases.

  "callgraph": remove it.  Unlike all the other commands it isn't
  related to the current selection, and we have
  golang.org/x/tools/cmdcallgraph now.

Internals:

  Drop support for long-running clients (i.e., Pythia), since
  godoc -analysis supports all the same features except "pointsto",
  and precomputes all the results so latency is much lower.

  Get rid of various unhelpful abstractions introduced to support
  long-running clients.  Expand out the set-up logic for each
  subcommand.  This is simpler, easier to read, and gives us more
  control, at a small cost in duplication---the familiar story of
  abstractions.

  Discard PTA warnings.  We weren't showing them (nor should we).

  Split tests into separate directories (so that importgraph works).

Change-Id: I55d46b3ab33cdf7ac22436fcc2148fe04c901237
Reviewed-on: https://go-review.googlesource.com/8243
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-30 19:21:37 +00:00
Alan Donovan
68b5f7541d cmd/oracle: usability improvements to "describe", "referrers"
Emacs integration:
- eliminate oracle minor mode
- in go-mode, bind F5, F6 to "describe", "referrers".
  This reverts a previous policy decision but convenience matters too.
- don't insist on an analysis scope for modes that don't do PTA.
- don't hide the filename as "▶"; show the last 20 chars.
  (Especially useful for "referrers" mode.)
- output postprocessing: don't get stuck in a loop if the output
  is not as expected (e.g. when it includes a panic log).

referrers:
- show the matching lines (like grep does).
  We do the I/O in parallel.

Change-Id: I86b18c1d3a4d9fa4242984cba62b314796669d8e
Reviewed-on: https://go-review.googlesource.com/8120
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-30 19:04:01 +00:00
Rob Pike
0c09ff325a cmd/cover: preserve //go: comments
Cover deleted all comments because they can break the simple way that
counters are injected into the rewritten source. But //go: comments have
semantic value, and for instance go test -cover runtime fails during
compilation because of their absence from the annotated source.

We can keep the //go: comments because they are at the beginning of
the line and are not affected by our counter injection.

Fixes #10270.

After this CL, go test -cover runtime works.
A testing strategy that does not involve a golden file would be welcome
but I can't think of one.

Change-Id: I73f7b7a36383a8efed8e33fa2414cd0eac7d015a
Reviewed-on: https://go-review.googlesource.com/8173
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-03-27 21:01:39 +00:00
Sameer Ajmani
1e216dc2e3 goimports: create a var to permit custom implementations of flag parsing and
startup work.

Change-Id: I9e60ec785313295bce614b5735238943af607223
Reviewed-on: https://go-review.googlesource.com/8204
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-27 18:14:11 +00:00
Rob Pike
e77366c32d cmd/cover: do not cover statements after panic
Given
	x()
	panic(1)
	y()

the y should not show as covered.

Fixes #10185

Change-Id: Iec61f1b096a888e6727be5f4526508654f5d3c91
Reviewed-on: https://go-review.googlesource.com/8140
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-03-27 17:59:54 +00:00
Rob Pike
53f3b29c5d cmd/cover: fix race in test
Silly test added yesterday requires that some code in a goroutine executes.
Make sure it does.

Change-Id: I7e852454736e300151473986cc437a70b41dc9b7
Reviewed-on: https://go-review.googlesource.com/7691
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-17 21:45:36 +00:00
Alan Donovan
782516301f cmd/eg: improve usage and help messages
eg with no arguments prints its usage, including a hand-written flag summary.
eg -help shows the detailed help message.

Change-Id: I615d8de3985ced1e86e9d7cafa9ef679079b249c
Reviewed-on: https://go-review.googlesource.com/6951
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-03-17 16:03:11 +00:00
Rob Pike
ed1e7c5cf2 vet: fix documentation about recursive scanning
It used to do packages only when run by the go tool, but it was
fixed a while back to handle packages properly when doing a
directory walk. Remove the incorrect information from the
documentation.

Change-Id: I961340bb84e48474c94ee03bf88f9136492c0226
Reviewed-on: https://go-review.googlesource.com/7642
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-17 00:40:15 +00:00
Rob Pike
26365e4e90 cmd/cover: fix handling of empty type switch
Just missed a case (ha!) in the tree walk. Dup the code for an empty switch, add test.

Fixes #10163.

Change-Id: I3d50ab6cb450ca21e87213291eaab8cbe924fac5
Reviewed-on: https://go-review.googlesource.com/7641
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-16 22:10:38 +00:00
Dave Cheney
0ee0dd6ea8 cmd/godoc: skip tests on arm platforms
Skip tests on arm platforms.

The godoc tests require large amounts of memory, in excess of 700mb in -index mode which none of the arm builders have spare.

Because of their requirements the tests can be killed by the test runner leaving stray godoc processes spinning in swap trying to -index.

Change-Id: I1544d56e9d9aabbbaac21adeebfb9e2690bd2da5
Reviewed-on: https://go-review.googlesource.com/7540
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-16 02:06:44 +00:00
Péter Surányi
8239116d59 cmd/godoc: exclude /pkg from search indexing
On tip, search included redundant source results from /pkg/bootstrap
(with broken links as godoc doesn't support source files under /pkg).
This change excludes all directories under /pkg from indexing.

Fixes golang/go#10024.

Change-Id: I0c69d22ff08d131f9c37c91a7711db6a4ec53fd4
Reviewed-on: https://go-review.googlesource.com/7267
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-12 00:26:38 +00:00
Andrew Gerrand
3b0cd1bf65 cmd/tipgodoc: increase startup 'health check' deadline
Also use a more reliable implementation.

Change-Id: I9e6858c7e9bdb60f1fb4e060e6d4d1b3762b83bc
Reviewed-on: https://go-review.googlesource.com/7260
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-10 03:04:16 +00:00
Péter Surányi
a160d803d7 cmd/tipgodoc: enable indexing
Run godoc indexing just once on startup. Wait for indexing to complete
before switching to new side. Increase startup timeout to accommodate for
indexing.

Updates golang/go#9996.

Change-Id: I1e746a68b7d787e6d7f180c2617ea75f0d3291f8
Reviewed-on: https://go-review.googlesource.com/7120
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-09 23:33:43 +00:00
Paul Smith
92211c448d cmd/stringer: remove os.Exit call from Usage func
The caller of Usage should call os.Exit -- Usage shouldn't call it.

Change-Id: I3decf662883fb2a6b19b7035138ee8a06a02de08
Reviewed-on: https://go-review.googlesource.com/7110
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-09 01:18:24 +00:00
Péter Surányi
c327a7c00b cmd/godoc: add -index_interval
Updates golang/go#9996.

Change-Id: I6112b1c32832aaa6604b096cfe7a8833f092b17a
Reviewed-on: https://go-review.googlesource.com/7031
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-06 23:07:47 +00:00
Alan Donovan
264bffc00c oracle: when 'implements' is invoked on a method, show related methods, not types.
Fixes #9972

Change-Id: I25b65a64dcc4d551be3db8566783a9d23d410a2e
Reviewed-on: https://go-review.googlesource.com/5860
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-25 22:38:52 +00:00
Alan Donovan
69db398fe0 go/loader: rename SourceImports flag to ImportFromBinary and invert sense
...since the zero value is more useful by far.

This is a breaking API change, obviously.  (One or two tests in this
CL have intentional been left using the zero value, i.e., they now
load source.)

Change-Id: I42287bfcdb1afef8ee84e5eac12534dd0a1fd5d2
Reviewed-on: https://go-review.googlesource.com/5653
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-23 23:01:10 +00:00
Alan Donovan
b141c84c2e Fix broken build
Due to copy/paste from Google-internal branch.
I can't explain why I didn't test this; sorry.

Change-Id: I7b5f083a124c7cfb0fa6cb0506465a36bd79e983
Reviewed-on: https://go-review.googlesource.com/5654
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-02-23 22:21:48 +00:00
Russ Cox
c7a00958ec cmd/vet: fix unnamed FP check
While we're here, silence a print about failure to import fmt.
When it prints, it looks like a problem, and in fact the result
is never used in vet.

Change-Id: I76121b335026a2b09637608b997517be94fd167c
Reviewed-on: https://go-review.googlesource.com/5573
Reviewed-by: Rob Pike <r@golang.org>
2015-02-23 19:33:41 +00:00
Alan Donovan
4e75c2682b cmd/oracle: check errors from Flush and Close.
Change-Id: Ia3c61b37140a83769373b322de691362ac919a90
Reviewed-on: https://go-review.googlesource.com/5630
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-23 19:27:14 +00:00
Josh Bleecher Snyder
97b1f37055 cmd/present: do not show help text on localhost
Also allow escape key to hide help text.

Fixes golang/go#9950

Change-Id: Ifcffbafda68d383e529f4ad6119b384a9c5cef6a
Reviewed-on: https://go-review.googlesource.com/5531
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-23 10:31:29 +00:00
Egon Elbre
e0e177e896 cmd/present: Fixed printing of slides.
I moved print.css into styles.css - to make it obvious that it needs to be
considered when modifying the styles.css. I use @media screen for all the
framwork related css, this means the @media print doesn't have to start
overriding each property - also there's less chance of a problem when
something isn't overridden.

Change-Id: Ic58e8c80df3339b55f67140a47866a232e0d30a3
Reviewed-on: https://go-review.googlesource.com/5526
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-02-23 02:47:45 +00:00
Alan Donovan
9bdc591373 go/ssa: standardize parsing of BuilderMode flags.
ssadump's -build=G option is now spelled -import; it was never related to ssa.

Change-Id: Ic21cd8b6990c0ffd25651c17a842a63bfa5019cf
Reviewed-on: https://go-review.googlesource.com/5172
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-18 18:34:24 +00:00
Nigel Tao
10d7cacb91 cmd/vet: add color.CMYK to the whitelist of frozen structs.
Change-Id: I5164ef9a998a0807f80668b9140eac4b2f889049
Reviewed-on: https://go-review.googlesource.com/4997
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-02-17 02:58:17 +00:00
Andrew Gerrand
753a094e8a cmd/present: show navigational help text on page load
Change-Id: I35e7cbec56a0617540316f0205c5a92e7532c491
Reviewed-on: https://go-review.googlesource.com/4910
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-14 23:26:36 +00:00
Andrew Gerrand
88df7a741d cmd/godoc: add golang.org/x/tour meta redirect
Change-Id: I2b855bb166612af391bb99742f6b6d58bc3ec226
Reviewed-on: https://go-review.googlesource.com/4340
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-02-10 05:48:21 +00:00
Alan Donovan
159ae4d163 cmd/callgraph: fix careless quoting bug
Change-Id: I809a2ea711bb1a516dfcf8abf5e4d26061b4daf0
Reviewed-on: https://go-review.googlesource.com/4230
Reviewed-by: Sameer Ajmani <sameer@golang.org>
2015-02-09 17:53:43 +00:00
Nigel Tao
9622599500 cmd/vet: allow spaces in struct tag values.
The validateStructTag code now closely mimics the StructTag.Get code in
package reflect.

This addresses the comment raised on issue #9500:
https://github.com/golang/go/issues/9500#issuecomment-70218780

See also https://go-review.googlesource.com/3953

Change-Id: I583f7447dbc5a2d7ecbb393d9bb6b1515cb10b18
Reviewed-on: https://go-review.googlesource.com/3952
Reviewed-by: Rob Pike <r@golang.org>
2015-02-06 02:26:15 +00:00
Joël Stemmer
913f41fc5f cmd/vet: warn about zero arg index in print format
Argument indexes in a format string are one-based, however vet would not
warn when using a zero-index unless the type of the argument referenced
was not a string. That warning was misleading as it would say the type
was not a string. Vet will now print a correct warning when using a zero
index.

Included are tests for both cases.

Fixes #9752

Change-Id: I285e99990a86a653b4668b0c279d5f5f1c34f7aa
Reviewed-on: https://go-review.googlesource.com/3692
Reviewed-by: Rob Pike <r@golang.org>
2015-02-04 18:31:58 +00:00
Alan Donovan
0dda50d42a go/loader: improve robustness in face of input errors
Before this change, many kinds of error would cause the loader to stop.
    making it brittle when analyzing large codebases, as in "godoc -analysis".

    This change moves operations that used to occur during
    configuration---(*build.Context).Import, loading, and parsing of
    initial packages---into the Load call, and ensures that all failures
    during Loading are reported at the end so that the maximum amount of
    progress is made.

    Also: redesign the tests and add many new cases.

Change-Id: Ia8cd99416af7c5d4a5fe133908adfa83676d401f
Reviewed-on: https://go-review.googlesource.com/3626
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-02-02 20:01:59 +00:00
Andrew Gerrand
39a2d013be cmd/tipgodoc: set GOROOT_BOOTSTRAP environment variable
Change-Id: I7d5dc5f7510641d2976f2ea6acf0d52cb10b94e8
Reviewed-on: https://go-review.googlesource.com/3266
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-24 16:29:45 +00:00
Alan Donovan
e079f6c632 go/ssa: change import path of synthetic test package to "test$main"
...to avoid namespace conflicts.
Also make its name "main", since it defines func main().

And fix 2 typos.

Change-Id: I7cf7894d6bed134907b3d2742255e5a82426071b
Reviewed-on: https://go-review.googlesource.com/3150
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-21 22:21:01 +00:00
Andrew Gerrand
d702aaaabe cmd/godoc: add golang.org/x/build to go-import redirect list
Change-Id: Id372b2da716b31bc016855d2d7f783fd1764e5c0
Reviewed-on: https://go-review.googlesource.com/3110
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-21 06:59:18 +00:00
Jongmin Kim
694e7507fc present: fix References link of talks.golang.org
Change-Id: I797a745dc891483217b732e9bf5413539f8c417e
Reviewed-on: https://go-review.googlesource.com/2954
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-16 16:06:45 +00:00
Nigel Tao
045f02ba9d cmd/stringer: fix ignored error in TestEndToEnd.
Change-Id: Ia139e9da37aecddebe8895c0d3427d7e97d408f8
Reviewed-on: https://go-review.googlesource.com/2931
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-01-15 23:10:50 +00:00
Hyang-Ah Hana Kim
e14d0b6f6b cmd/godoc: godoc test needs clean up tmp dir when buildGodoc fails.
Change-Id: I584ed27d37a85d39294b07febf396f567d4016a5
Reviewed-on: https://go-review.googlesource.com/2901
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-15 18:36:28 +00:00
Dominik Honnef
9f20d8c198 benchmark/parser, cmd/benchcmp: improve names of exported identifiers
Most of the names have been brought in line with the names used in
testing/BenchmarkResult. For example, NsOp becomes NsPerOp.

Additionally, "Bench" becomes "Benchmark" and "BenchSet" becomes "Set".

Change-Id: I7dfca68a804e285a87ab9692b5bb99ccb676da7f
Reviewed-on: https://go-review.googlesource.com/2610
Reviewed-by: Rob Pike <r@golang.org>
2015-01-15 01:28:17 +00:00
Michael Matloob
796e50ba32 cmd/mvpkg: a package moving tool
This change adds a command mvpkg that will move a given package and
update all its imports. It uses similar logic to gorename to update
the imports.

Change-Id: Iebbd0b4c93c2302b0a71c3b99c68f6778106012a
Reviewed-on: https://go-review.googlesource.com/1973
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-14 17:37:29 +00:00
Andrew Gerrand
af97332187 cmd/godoc: send go-source meta tag for golang.org/x repos
This allows godoc.org to link to the source code. I chose to link to
github.com instead of googlesource.com because their file browser is
better.

Details here:
864b1c0aba

Change-Id: I962b3fadc822e753245f52240937be5c7e158dc7
Reviewed-on: https://go-review.googlesource.com/2719
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-14 02:42:10 +00:00
David Crawshaw
e0ba1bf74c cmd/vet: keep processing files after warning
This lets go vet produce useful results for syscall on darwin/amd64,
otherwise it gets caught on asm.s.

Change-Id: I3daa49cf61eeada52eb9d4e94e40c4d21d1d5b2d
Reviewed-on: https://go-review.googlesource.com/2741
Reviewed-by: Rob Pike <r@golang.org>
2015-01-13 19:51:41 +00:00
Peter Collingbourne
4f8578d2c0 astutil: move to go/ast/astutil
Change-Id: I9a45bfc07613eb2210081d306d71f0a4d152eda5
Reviewed-on: https://go-review.googlesource.com/2592
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-13 15:47:47 +00:00
Tw
230eaff9cf cmd/benchcmp: close file when parse done
prevent file descriptor leak

Signed-off-by: Tw <tw19881113@gmail.com>

Change-Id: Ia1cacb3a287477b1f9b50fae248b5c34156c9557
Reviewed-on: https://go-review.googlesource.com/2740
Reviewed-by: Rob Pike <r@golang.org>
2015-01-13 09:03:36 +00:00
Rob Pike
682ca03389 vet: improve validation of struct tags
Actually parse the strings to check them more accurately.
The particular problem it missed was that it didn't check
for control characters in the key. The only valid separator
is a space.

More tests.

Fixes #9500

Change-Id: Ib547e11c7e8d47d81eb8b1e8f1ab9c26174933df
Reviewed-on: https://go-review.googlesource.com/2685
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-12 23:15:16 +00:00
Andrew Gerrand
4ed956ea27 cmd/tipgodoc: kill old process as we switch over
Change-Id: I0d311b479441d1a359f953466e4ff93f3397c52d
Reviewed-on: https://go-review.googlesource.com/2630
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-12 02:54:00 +00:00
Andrew Gerrand
75337c43b3 cmd/tipgodoc: fix some nits
Change-Id: I54a98340ec2e5d54c2ca27b869c7f38b7cbfe2d7
Reviewed-on: https://go-review.googlesource.com/2536
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-09 00:28:10 +00:00
Andrew Gerrand
0e66a62615 cmd/tipgodoc: simplify Dockerfile and fix deployment
Change-Id: Ib2fd1346255467cb790a9e4c37d25f8e8ca136f5
Reviewed-on: https://go-review.googlesource.com/2534
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-09 00:21:14 +00:00
Jongmin Kim
dc0000626d cmd/present: fix unclosed section element
Change-Id: I974ec7a2caccfca3aff18836d6495597e17664e7
Reviewed-on: https://go-review.googlesource.com/2533
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-08 23:27:10 +00:00
Péter Surányi
bd69d2dd34 cmd/godoc: mention examples feature in godoc
Godoc documentation did not mention the feature for showing example code
runnable by the testing package. Add a link to the testing package.

Update golang/go#9471

Change-Id: Ic15794c59732e9b0b42c5b16c60be0a47c41afa5
Reviewed-on: https://go-review.googlesource.com/2490
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-08 02:02:02 +00:00
Andrew Gerrand
af7d92a90f cmd/tipgodoc: record and report errors
Change-Id: I76c04c745367427cd3b474949d213e105f6b47c1
Reviewed-on: https://go-review.googlesource.com/2413
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-07 05:30:47 +00:00
Andrew Gerrand
c836fe615a cmd/godoc: add golang.org/x/playground custom import path
Change-Id: Ic399dbf8a77e7c61ba8be263515b13a6b488b4e9
Reviewed-on: https://go-review.googlesource.com/2309
Reviewed-by: Rob Pike <r@golang.org>
2015-01-06 02:12:10 +00:00
Dominik Honnef
0ff6678340 benchmark/parse, cmd/benchcmp: new package for parsing benchmarks
Move the parser for benchmark output from cmd/benchcmp into its own
package, benchmark/parse.

The majority of the change is just moving code around. Instead of
implementing the '-best' flag in ParseBenchSet, it is now implemented in
its own function 'selectBest' in cmd/benchcmp.

Bench.Ord (the ordinal position of a Bench within a BenchSet) has been
exported.

Change-Id: Id27032a220f9ff2596117b58b86243998695a804
Reviewed-on: https://go-review.googlesource.com/2102
Reviewed-by: Rob Pike <r@golang.org>
2015-01-06 01:34:08 +00:00
Alan Donovan
c1ef9c75bf cmd/gorename: make Usage documentation sensible in godoc
Fixes golang/go#9469

Change-Id: I74e19e3d095e4c2ab62f755a408f58fd5e7ac2f2
Reviewed-on: https://go-review.googlesource.com/2176
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2014-12-30 16:36:43 +00:00
Alan Donovan
4f13714aca astutil: add Unparen utility, eliminating 7 copies.
Change-Id: I824328c275bd6198a57edd64bf72cb2cf0490a68
Reviewed-on: https://go-review.googlesource.com/2172
Reviewed-by: Chris Manghane <cmang@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2014-12-29 22:24:57 +00:00
Emil Hessman
ca3901c3d8 all: address vet reports
Fixes various problems reported by go vet.

Change-Id: I12a6fdba8f911b21805d8e42903f8f6a5033790a
Reviewed-on: https://go-review.googlesource.com/2163
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-29 06:08:34 +00:00
Shenghou Ma
f72c7f7642 cmd/godoc: show the BUG section
This will match the default behavior when running locally.

In fact, our http://blog.golang.org/godoc-documenting-go-code explicitly
documents this feature (see also golang.org/cl/1953).

Change-Id: I581b17b60229ce70900cb51d548d1e2a34df41ba
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/2116
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-28 23:27:51 +00:00
Matt Bostock
79d60d6e2c cmd/present: Fix indentation in styles.css
No functional changes.

Also adds a newline to the end of the file, for compatibility with
`cat(1)` and `vim(1)`. See also:

https://gcc.gnu.org/ml/gcc/2003-11/msg01568.html

Change-Id: I4fc7ac64ad7c4b4d9c2be7296cb8b612e0becef2
Reviewed-on: https://go-review.googlesource.com/2106
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-26 16:52:14 +00:00
Matt Bostock
255341fbe0 cmd/present: Fix HTML to use matching header tag
Close the `<h3>` header tag with a closing `</h3>` tag to fix the HTML
syntax.

Change-Id: Ic86c5f31ec5550d6875aa085eed8da6a75881405
Reviewed-on: https://go-review.googlesource.com/2104
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2014-12-25 00:19:42 +00:00