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

356 Commits

Author SHA1 Message Date
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
Rob Pike
575b88be8f stringer: avoid if's in the generated code
Suggestion by dsymonds: Save code not data.
Add an extra element to the index array and an if can be eliminated.

Old generated code:
const _Day_name = "MondayTuesdayWednesdayThursdayFridaySaturdaySunday"

var _Day_index = [...]uint8{6, 13, 22, 30, 36, 44, 50}

func (i Day) String() string {
	if i < 0 || i >= Day(len(_Day_index)) {
		return fmt.Sprintf("Day(%d)", i)
	}
	hi := _Day_index[i]
	lo := uint8(0)
	if i > 0 {
		lo = _Day_index[i-1]
	}
	return _Day_name[lo:hi]
}

New generated code:
const _Day_name = "MondayTuesdayWednesdayThursdayFridaySaturdaySunday"

var _Day_index = [...]uint8{0, 6, 13, 22, 30, 36, 44, 50}

func (i Day) String() string {
	if i < 0 || i+1 >= Day(len(_Day_index)) {
		return fmt.Sprintf("Day(%d)", i)
	}
	return _Day_name[_Day_index[i]:_Day_index[i+1]]
}

Change-Id: I6f46a4892d5813a12ec1ad01738c6a21c7e45172
Reviewed-on: https://go-review.googlesource.com/1990
Reviewed-by: David Symonds <dsymonds@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2014-12-22 20:58:05 +00:00
Emil Hessman
864e280a1d cmd/godoc: add missing space to flag description
Change-Id: I8f4dada13353065475baf33c71e6e1a28f889e71
Reviewed-on: https://go-review.googlesource.com/1892
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2014-12-19 19:42:26 +00:00
Oling Cat
65b875be27 cmd/godoc: update GAE setup script
Change-Id: Ief2c49a03cbd3251d62d854be4f51dcb27a42458
Reviewed-on: https://go-review.googlesource.com/1522
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-19 02:48:01 +00:00
Shenghou Ma
458cff5230 cmd/tipgodoc: add appenginevm build tag
Fixes golang/go#9381.

Change-Id: Ied5fd00475dde2b781cedff398dc9ee8d7f642a4
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1801
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-18 22:13:11 +00:00
Shenghou Ma
a47975eda8 cmd/eg, godoc/redirect: update remaining code.google.com links
Change-Id: I67da9e0c0c511c19e5b5296fbcf46f641273a7bb
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1515
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-18 07:48:40 +00:00
Brad Fitzpatrick
f56df04f2d cmd/tipgodoc: make tipgodoc run on App Engine Managed VMs
At least in theory. We don't totally have it working yet. It does
run locally in the dev environment, though, which should be the same
as production, since it builds the Docker container locally.
But we're getting problems when pushing it to production.

Also some minor tweaks to the code with Andrew.

Change-Id: Id192669dbc8d3f86d9c8dad79764abd66e983895
Reviewed-on: https://go-review.googlesource.com/1761
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-18 06:10:19 +00:00
Andrew Gerrand
5bf57d6426 cmd/tipgodoc: new tip.golang.org server
Rough work in progress. Don't hate.

Change-Id: I9d8247005724a21bdb5d4760cc6135bceb49f2d4
Reviewed-on: https://go-review.googlesource.com/1704
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-17 04:51:07 +00:00
Brad Fitzpatrick
88d370fb93 cmd/godoc: add debug subrepo meta to x handler
Change-Id: I0ba56b32dd9b53d06817f9f7e2dafff04e6a86d2
Reviewed-on: https://go-review.googlesource.com/1565
Reviewed-by: David Symonds <dsymonds@golang.org>
2014-12-15 04:44:49 +00:00
Shenghou Ma
14ecce811f cmd/present: skip the "golang.org" directory
Change-Id: I732194c22062c77c431dcec57f9ef832f1dc1afe
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1512
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-14 23:37:49 +00:00
Brad Fitzpatrick
802ec582a3 all: update links from code.google.com to new homes
Change-Id: Id3c5b2480c8499ab712265a421ffba125fb913db
Reviewed-on: https://go-review.googlesource.com/1401
Reviewed-by: David Symonds <dsymonds@golang.org>
2014-12-12 03:10:55 +00:00
David Symonds
24257c8cd2 tools: add import comments.
Change-Id: Idda6e64580432cb9a731e4ebf4005ee4ceb4202d
Reviewed-on: https://go-review.googlesource.com/1244
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-09 22:42:16 +00:00
Andrew Gerrand
9e66c59fb1 x/tools/cmd/godoc: update golang.org/x/ redirects to point to git repos
LGTM=dsymonds
R=dsymonds
CC=golang-codereviews
https://golang.org/cl/182620043
2014-12-08 10:30:52 +11:00
Daniel Morsing
25f58f97ce x/tools/oracle: add whicherrs query mode
The whicherrs query mode takes the position of an error and returns the set of constants, globals and types visible from within the scope of the error being queried.
It is meant to be used as a shortcut to find out which errors should be handled for a given functions call.

LGTM=adonovan
R=golang-codereviews, dominik.honnef, adonovan
CC=golang-codereviews
https://golang.org/cl/167420043
2014-12-05 15:51:34 +00:00
Alan Donovan
c6ec5ea66d cmd/gorename: support renaming of methods with consequences for other types, iff initiated at an abstract method.
Previously, gorename rejected all method renamings if it would
change the assignability relation.

Now, so long as the renaming was initiated at an abstract
method, the renaming proceeds, changing concrete methods (and
possibly other abstract methods) as needed.  The user
intention is clear.

The intention of a renaming initiated at a concrete method is
less clear, so we still reject it if it would change the
assignability relation.  The diagnostic advises the user to
rename the abstract method if that was the intention.

Additional safety checks are required: for each
satisfy.Constraint that couples a concrete type C and an
interface type I, we must treat it just like a set of implicit
selections C.f, one per abstract method f of I, and ensure the
selections' meanings are unchanged.

The satisfy package no longer canonicalizes types, since this
substitutes one interface for another (equivalent) one, which
is sound, but makes the type names random and the error
messages confusing.

Also, fixed a bug in 'satisfy' relating to map keys.

+ Lots more tests.

LGTM=sameer
R=sameer
CC=golang-codereviews
https://golang.org/cl/173430043
2014-12-04 09:37:50 -05:00
Rob Pike
0e9050009a tools/cmd/vet: check that cgo is enabled before testing it
Should fix the tools builders.

LGTM=bradfitz
R=rsc, bradfitz
CC=golang-codereviews
https://golang.org/cl/176530043
2014-12-02 08:15:26 +09:00
Nathan John Youngman
806f1dbf43 tools/cmd/stringer: fake import C.
Avoid error "could not import C (can't find import: C)"
Fixes golang/go#9169.

LGTM=adonovan, r
R=golang-codereviews, adonovan, r
CC=golang-codereviews
https://golang.org/cl/184730043
2014-11-27 15:36:14 +11:00
Andrew Gerrand
354b6ccbcc x/tools/cmd/godoc: add golang.org/x/oauth2 import path
LGTM=r
R=jbd, r
CC=golang-codereviews
https://golang.org/cl/175700043
2014-11-26 15:31:30 +11:00
Alan Donovan
a9651d6ad7 cmd/callgraph: add -algo=static and -algo=cha options.
"static" ignores dynamic calls altogether.

"cha" uses Class Hierarchy Analysis, which assumes that a
dynamic call may dispatch to any func or method that satisfies
the type.

Both these algorithms can work on partial programs,
e.g. libraries without a main function or tests.

(This feature was requested after my talk last night.)

+ Tests.

LGTM=sameer
R=sameer, minux
CC=golang-codereviews, gri
https://golang.org/cl/176780043
2014-11-21 11:07:56 -05:00