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

1745 Commits

Author SHA1 Message Date
Josh Bleecher Snyder
3f8aef80c8 go/ast/astutil: set Pos for import name
Failing to set this when adding a named import
to an existing block at the 0th position
caused the Lparen position to be set to zero.
As a result, the specs were printed as if
they were a single spec, not a group.
This made it appear as if imports had
been swallowed.

See CL 8663 for more context
and the original bug report.

CL 2050 fixed most similar cases
but missed this one.

Change-Id: Ic578fbb8040fa3d3d41db5bde2b839e394801608
Reviewed-on: https://go-review.googlesource.com/10252
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-05-19 23:10:16 +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
5df6d9290d go/ssa/interp: remove hash/crc32 from test suite, since it uses Examples
Change-Id: Ia87b7f6d589cd22028b437a94355f499fbedd18a
Reviewed-on: https://go-review.googlesource.com/9928
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-05-12 17:41:59 +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
Alan Donovan
fb47c16287 go/buildutil: fix usage message for -tags flag
Now:

% gorename -h
Usage of ./gorename:
...
  -tags build tags
        a list of build tags to consider...

Change-Id: I46d6906f683407bad6f3dee25c63b139f47e4588
Reviewed-on: https://go-review.googlesource.com/9655
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-05-08 14:48:23 +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
Alan Donovan
6a8dc4ed40 oracle: report a better error if query is outside GOROOT/GOPATH
Change-Id: I2f724b5015021be8bf1fccb518f17cc011d687e8
Reviewed-on: https://go-review.googlesource.com/9546
Reviewed-by: David Chase <drchase@google.com>
2015-04-30 18:55:42 +00:00
David Symonds
863c9c67a8 go/pointer: Remove a mention of the deleted ImportFromBinary option.
Change-Id: I9ca8a5b37afc6ae9603849d233ee6b4976e2b973
Reviewed-on: https://go-review.googlesource.com/9462
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-04-29 01:29:12 +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
a9f55c4fa4 oracle: support "referrers" query on package declaration
Added test.

Change-Id: Id7d061b0f74959166b5631a3fde8da4000ffb8d2
Reviewed-on: https://go-review.googlesource.com/9326
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-27 13:27:00 +00:00
chai2010
fb59b33999 godoc: add missing copyright
Change-Id: Ic0256b511b4d4346702aeac18298614b1e8d5438
Reviewed-on: https://go-review.googlesource.com/9384
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-27 04:29:37 +00:00
Alan Donovan
837a81a1b2 oracle: referrers: display the selected object relative to the current package
Added test.  (Its previous output was "references to type
referrers.s", with s package-qualified.)

Change-Id: Ifd70246bf5976d5f59ed85e7bbded618286ec6bc
Reviewed-on: https://go-review.googlesource.com/9294
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-23 20:44:32 +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
bc61fa75b3 go/ssa: acquire TestEnclosingFunction from go/loader package.
Not sure how it ended up there...

Change-Id: I0d48025fd6595714b0c52cadf305b3e06e2b9b84
Reviewed-on: https://go-review.googlesource.com/9171
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-21 16:27:33 +00:00
Alan Donovan
41d9a0e7b2 go/loader: rename Example functions to appease godoc
And other minor cosmetic tweaks.

Change-Id: Ic75d405e6eca8f29b7e97de66fb86f1f39bcae1e
Reviewed-on: https://go-review.googlesource.com/9035
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-04-17 19:40:02 +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
Alan Donovan
1b6275a2ec go/loader: API examples
Also: make it easier to find packages.  Hide the importMap field
(never used) and expose a (*Program).Package method which searches
importMap and then Created.

Also: move huge comments into doc.go.

Change-Id: Iad96a12524b7c41ad9acd1e806af23171e71fa7c
Reviewed-on: https://go-review.googlesource.com/9030
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-04-17 18:50:18 +00:00
Alan Donovan
77d380c9e6 go/gcimporter: populate (*types.Package).Imports
All importers should populate the set of imported packages.  In Go 1.5
importer API, there will be no package map from which to compute the
transitive closure of dependencies, and SSA package creation needs
this information.

+ test.

Change-Id: I1c2823b07bf7316aa62c80e2ef2a0755cf6f5384
Reviewed-on: https://go-review.googlesource.com/8924
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-04-15 18:12:10 +00:00
Alan Donovan
20186168d5 go/ssa/ssautil: break ssa->loader dependency
Remove all dependencies from non-test code in go/ssa to go/loader,
except the deprecated Create function which will be eliminated in
favor of ssautil.CreateProgram in a mechnanical followup.

Add Examples of two main use cases of SSA construction:
loading a complete program from source; and
building a single package, loading its dependencies from import data.

Add tests to ssautil of the two load functions.
Suggestions welcome for better names.

Planned follow-ups:
- replace all references to ssa.Create with ssautil.CreateProgram and eliminate it.
- eliminate support in go/loader for the ImportBinary flag, and the
  PackageCreated hook which is no longer needed since clients can
  create the package themselves (see Example).

Step 1 to fixing issue 9955.

Change-Id: I4e64df67fcd5b7f0c0388047e06cea247fddfec5
Reviewed-on: https://go-review.googlesource.com/8669
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-04-14 18:01:36 +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
069d2f3bcb go/types, go/gcimporter: backport changes from std repo
This is a 1:1 backport of the following changes:

https://go-review.googlesource.com/8611
https://go-review.googlesource.com/8621

Change-Id: I4a75d73cb99a7d104d32553f5530408c2b6d81b8
Reviewed-on: https://go-review.googlesource.com/8629
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-04-08 18:15:25 +00:00
Robert Griesemer
bf8b6a5c4c go/types: reenable disabled test (backport from std repo go/types)
Change-Id: I93a914dcfc5bd2cfa8078cec683a46225b665e44
Reviewed-on: https://go-review.googlesource.com/8626
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-04-08 16:31:48 +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
8a634c5831 go/ssa/interp: don't let target calls to runtime.GOMAXPROCS set host state
...otherwise the interpreted program can make the whole test suite
slow.  Just ignore the argument and return the current GOMAXPROCS
value.

Change-Id: Ife2ad6c53e6fdf9feea1d1b231d8d796b3db3a24
Also: add missing intrinsic for os.runtime_beforeExit.
Reviewed-on: https://go-review.googlesource.com/8591
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-04-07 22:31: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
ab1b92fc43 oracle: ignore errors during import graph construction
Such errors include files without package decl, or conflicting package
decls.  We ignore type errors, so we should ignore import errors too.

Fixes #10347

Change-Id: I9011a9099a2804281ea2d989d7263a9ce691be16
Reviewed-on: https://go-review.googlesource.com/8498
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-06 19:51:23 +00:00
Robert Griesemer
5cf8a6b1aa go/types: remove dependency on go/ast/astutil
This package was only imported for the trivial Unparen function.

Change-Id: I14f8d91bc0afaa6ab3aa797a53e42e56b59ffcbe
Reviewed-on: https://go-review.googlesource.com/8499
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-04-06 19:33:09 +00:00
Alan Donovan
f0d8175b3e oracle: skip cgo processing for queries that don't need SSA/PTA
This makes type-based queries faster and more robust because they
needn't invoke a C compiler, at the cost of worse results in/near .go
files that import "C".  It's particularly important for "referrers"
since a refererrs query on a name from the standard library can load
every package in the workspace.

Fixes issue 10347

Change-Id: I2f65474ce963de5c0897ba67eeb26290dd449cf1
Reviewed-on: https://go-review.googlesource.com/8493
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-06 16:52:07 +00:00
Alan Donovan
8a9ac1b806 go/loader: limit concurrency of I/O operations during parsing
This is a putative fix for the file descriptor exhaustion problem
described in https://github.com/golang/go/issues/10306.

Change-Id: If603fb9bbaec1b53f6b44d15b2c202e4670035ce
Reviewed-on: https://go-review.googlesource.com/8421
Reviewed-by: Matt Joiner <anacrolix@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-06 15:15:05 +00:00
Alan Donovan
a18bb1d557 oracle: add TODO
Change-Id: I315af962e43a3ae9c8e5cad13766d2200484fdf9
Reviewed-on: https://go-review.googlesource.com/8386
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-02 18:07:00 +00:00
Alan Donovan
d4e7010150 go/pointer: add TODO comment
Change-Id: Ic383036a6b3aa092aa571694bba86d821428f236
Reviewed-on: https://go-review.googlesource.com/8385
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-02 18:06:43 +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
dce4131cda oracle: referrers: also scan *_test.go files for references.
Added test case.  This required making the result sort order
deterministic when the results are spread across several packages.

Also: implements: print type names relative to query package.
Updated tests.

Change-Id: I9f882cd358a612585a4aac9a117b89d9131a294e
Reviewed-on: https://go-review.googlesource.com/8283
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-03-31 16:25:39 +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
Josh Bleecher Snyder
57d2ff39c7 go/ast/astutil: match prefix segments when adding imports
AddImport and AddNamedImport attempt to place new
imports in roughly the correct place--and thus the
correct group--by matching prefixes. Matching prefixes
byte-by-byte led to "regexp" being grouped with "rsc.io/p".
Instead, match prefixes by segments.

Fixes golang/go#9961.

Change-Id: I52b7c58a9a2fbe85c2b5297e50c87d409364bda3
Reviewed-on: https://go-review.googlesource.com/8090
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-30 17:57:25 +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
Robert Griesemer
af0a4481dd go/types: permit type elision from composite literal map keys
Per pending https://go-review.googlesource.com/2591 .
Depends on: https://go-review.googlesource.com/2621 .

Change-Id: I2aa82916454504b5852518b3ef7fc8637126d0c7
Reviewed-on: https://go-review.googlesource.com/2623
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-03-20 22:18:24 +00:00
Sebastien Binet
473fd854f8 godoc/static: insert newlines in -src mode
Running 'godoc -src' would end up with concatenated sources:

$ godoc -src github.com/bradfitz/http2 Frame
// a frameParser parses a frame given its FrameHeader and payload
// bytes. The length of payload will always equal fh.Length (which
// might be 0).
type frameParser func(fh FrameHeader, payload []byte) (Frame, error)//
A Frame is the base interface implemented by all frame types.
// Callers will generally type-assert the specific frame type:
// *HeadersFrame, *SettingsFrame, *WindowUpdateFrame, etc.
//
// Frames are only valid until the next call to Framer.ReadFrame.
type Frame interface {

Unconditionnally insert two newlines:

$ godoc -src github.com/bradfitz/http2 Frame
// a frameParser parses a frame given its FrameHeader and payload
// bytes. The length of payload will always equal fh.Length (which
// might be 0).
type frameParser func(fh FrameHeader, payload []byte) (Frame, error)

// A Frame is the base interface implemented by all frame types.
// Callers will generally type-assert the specific frame type:
// *HeadersFrame, *SettingsFrame, *WindowUpdateFrame, etc.
//
// Frames are only valid until the next call to Framer.ReadFrame.
type Frame interface {

Fixes #9726.

Change-Id: I51ee04e53d4962c890ea601125eda8fce84d6a46
Reviewed-on: https://go-review.googlesource.com/7681
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-03-18 17:28:59 +00:00