1
0
mirror of https://github.com/golang/go synced 2024-09-30 18:18:32 -06:00
Commit Graph

379 Commits

Author SHA1 Message Date
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