1
0
mirror of https://github.com/golang/go synced 2024-10-01 07:28:35 -06:00
Commit Graph

177 Commits

Author SHA1 Message Date
Robert Griesemer
49904d9a2c go.tools/cmd/gotype: use go/types identifier resolution
R=adonovan
CC=golang-dev
https://golang.org/cl/14146043
2013-09-30 12:59:02 -07:00
Andrew Gerrand
0ebdd2c316 go.tools/cmd/html2article: move command from go.blog repository
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/14009043
2013-09-27 10:40:53 +10:00
Nathan John Youngman
cb07517a77 go.tools/cover: validate flags with appropriate error messages
Fixes golang/go#6444.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13956043
2013-09-26 18:11:03 +10:00
Alan Donovan
3a4c0462d8 go.tools/oracle: change -mode argument into subcommand.
e.g. "oracle callgraph <package>"

Also: simplified error handling.
Eliminated oracle.errorf because it prepends "file:line:col: "
to the error message so the main function can't safely prepend "Error: ".
The position wasn't interesting though: it was just -pos, more or less.

R=crawshaw, dominik.honnef, r
CC=golang-dev
https://golang.org/cl/13864044
2013-09-25 14:34:39 -04:00
Alan Donovan
37f76edde8 go.tools/oracle: support -format=xml (for Eclipse)
This CL is mostly a renaming s/json/serial/, abstracting the
oracle package away from any particular data syntax.  (The
encoding/* machinery is very clean; clearly I should have
structured it this way from the outset.)

Supporting XML then becomes a one-liner in cmd/oracle/main.go.

Also: call MarshalIndent(), not Marshall() then Indent().

R=crawshaw
CC=golang-dev
https://golang.org/cl/13858046
2013-09-24 15:08:14 -04:00
Nathan John Youngman
84cae5a52d go.tools/cover: clean up usage information
R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/13532052
2013-09-24 17:27:26 +10:00
Alan Donovan
3371b79a96 go.tools/pointer: reflect, part 2: channels.
(reflect.Value).Send
        (reflect.Value).TrySend
        (reflect.Value).Recv
        (reflect.Value).TryRecv
        (reflect.Type).ChanOf
        (reflect.Type).In
        (reflect.Type).Out
        reflect.Indirect
        reflect.MakeChan

Also:
- specialize genInvoke when the receiver is a reflect.Type under the
  assumption that there's only one possible concrete type.  This
  makes all reflect.Type operations context-sensitive since the calls
  are no longer dynamic.
- Rename all variables to match the actual parameter names used in
  the reflect API.
- Add pointer.Config.Reflection flag
  (exposed in oracle as --reflect, default false) to enable reflection.
  It currently adds about 20% running time.  I'll make it true after
  the presolver is implemented.
- Simplified worklist datatype and solver main loop slightly
  (~10% speed improvement).
- Use addLabel() utility to add a label to a PTS.

(Working on my 3 yr old 2x2GHz+4GB Mac vs 8x4GHz+24GB workstation,
one really notices the cost of pointer analysis.
Note to self: time to implement presolver.)

R=crawshaw
CC=golang-dev
https://golang.org/cl/13242062
2013-09-23 16:13:01 -04:00
Andrew Gerrand
eb130cb481 go.tools/cmd/cover: add content-type meta tag to HTML output
Fixes golang/go#6435.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13822045
2013-09-23 13:57:03 +10:00
Alan Donovan
0c4a02a8c4 go.tools/oracle: improve usage messages.
Full help is only displayed when -help is requested;
CLI usage errors just remind the the user of this flag.

R=r, crawshaw
CC=golang-dev
https://golang.org/cl/13523048
2013-09-20 11:35:00 -04:00
Yasuhiro Matsumoto
7959c09b86 go.tools/cmd/oracle: Encoding issue, Possible to describe modified file
line2byte doesn't handle non utf-8 fileencoding. So added s:getpos().
        And also, changing errorformat is not right way on go filetype.
        Added range operations.

R=golang-dev, kamil.kisiel, dsymonds, dominik.honnef
CC=golang-dev
https://golang.org/cl/13656045
2013-09-20 11:09:27 +10:00
Rob Pike
34fbb29ae0 go.tools/gotype: move to go.tools/cmd/gotype
Commands in the go.tools repo should be under the cmd subdirectory.

R=gri, adg
CC=golang-dev
https://golang.org/cl/13768044
2013-09-19 11:38:07 +10:00
Andrew Gerrand
f54bd1aebf go.tools/cmd/godoc: update import paths
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13770043
2013-09-19 10:59:21 +10:00
Andrew Gerrand
072133c61b go.tools/cmd/godoc: include the blog server
Defer parsing of blog content until accessed for faster startup.
Fall back on redirect if blog content unavailable locally.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13335052
2013-09-18 15:20:41 +10:00
Rob Pike
6ad0d283e1 go.tools/cmd/vet: handle recursive structs and slices.
Fixes golang/go#6309

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13386046
2013-09-18 12:57:59 +10:00
Andrew Gerrand
dceff279d0 go.tools/cmd/godoc: add redirects for godoc, vet, and gotest
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13709046
2013-09-18 11:15:12 +10:00
Andrew Gerrand
b9b578154e go.tools/godoc: some content re-organization
Remove References section heading.
Add redirects from old paths to new content.
Add a link to the SubRepositories wiki page from package list.
Add styles for "pop-out" link.

R=r
CC=golang-dev
https://golang.org/cl/13356047
2013-09-16 15:46:38 +10:00
Andrew Gerrand
4709d08a36 go.toos/cmd/cover: "add" package comment
R=r
CC=golang-dev
https://golang.org/cl/13463046
2013-09-16 14:39:12 +10:00
Andrew Gerrand
334d56a124 go.tools/cmd/godoc: permit dash and capitals in redirect paths
This was causing some /blog/foo-bar-baz paths to 404.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13640044
2013-09-16 13:02:15 +10:00
Andrew Gerrand
1564988897 go.tools/cmd/godoc: add redirect helpers
Previously these helpers were added by a private deployment script.
There's no reason why they shouldn't be part of godoc proper now
that it's in the go.tools repository.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13722043
2013-09-16 11:41:03 +10:00
Rob Pike
ece05f910e go.tools/cmd/vet: update for fmt handling %b for complex numbers
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13490048
2013-09-16 08:18:27 +10:00
Dominik Honnef
59968caad5 go.tools/oracle: turn emacs integration into minor-mode
Define a minor mode called go-oracle-mode. Right now its sole
purpose is to define a keymap but it might later be used to add
hooks or add other features to go-mode.

R=adonovan
CC=golang-dev
https://golang.org/cl/13412048
2013-09-12 22:34:38 -04:00
Alan Donovan
0725e5a5b3 go.tools/oracle: new query 'referrers' returns all references to an identifier.
+ test.

Also:
- provide non-nil map to Importer.doImport0() to avoid a crash.
- reorganize oracle "needs" bits.
- reduce "needs" of 'freevars' and 'implements' queries by avoiding
  ssa.Packages when types.Package suffices.

R=crawshaw
CC=golang-dev
https://golang.org/cl/13421046
2013-09-10 14:11:42 -04:00
Alan Donovan
5eb0d4d152 go.tools/oracle: restore edits lost in rev aa9b649bccd9 (botched merge)
R=crawshaw
TBR=crawshaw
CC=golang-dev
https://golang.org/cl/13604044
2013-09-09 21:31:33 -04:00
Alan Donovan
c6e88b1b2a go.tools/cmd/oracle: use -pos=file:#start,#end syntax to indicate half-open [start,end) extent of byte offsets.
Also: improve help message.

R=r, crawshaw, rsc
CC=golang-dev
https://golang.org/cl/13593043
2013-09-08 22:10:11 -04:00
Alan Donovan
3f2f9a7e70 go.tools/importer: generalize command-line syntax.
Motivation: pointer analysis tools (like the oracle) want the
user to specify a set of initial packages, like 'go test'.
This change enables the user to specify a set of packages on
the command line using importer.LoadInitialPackages(args).

Each argument is interpreted as either:
- a comma-separated list of *.go source files together
  comprising one non-importable ad-hoc package.
  e.g. "src/pkg/net/http/triv.go" gives us [main].
- an import path, denoting both the imported package
  and its non-importable external test package, if any.
  e.g. "fmt" gives us [fmt, fmt_test].

Current type-checker limitations mean that only the first
import path may contribute tests: multiple packages augmented
by *_test.go files could create import cycles, which 'go test'
avoids by building a separate executable for each one.
That approach is less attractive for static analysis.

Details:  (many files touched, but importer.go is the crux)

importer:
- PackageInfo.Importable boolean indicates whether
  package is importable.
- un-expose Importer.Packages; expose AllPackages() instead.
- CreatePackageFromArgs has become LoadInitialPackages.
- imports() moved to util.go, renamed importsOf().
- InitialPackagesUsage usage message exported to clients.
- the package name for ad-hoc packages now comes from the
  'package' decl, not "main".

ssa.Program:
- added CreatePackages() method
- PackagesByPath un-exposed, renamed 'imported'.
- expose AllPackages and ImportedPackage accessors.

oracle:
- describe: explain and workaround a go/types bug.

Misc:
- Removed various unnecessary error.Error() calls in Printf args.

R=crawshaw
CC=golang-dev
https://golang.org/cl/13579043
2013-09-06 18:13:57 -04:00
Alan Donovan
b21b4e8c88 go.tools/importer: negate "cgo" build tag to avoid native code in "net".
This removes the need for the caller to specify CGO_ENABLED=0
in the environment.

R=crawshaw
CC=golang-dev
https://golang.org/cl/13464045
2013-09-04 15:20:38 -04:00
Alan Donovan
f9e325b575 go.tools/oracle: change notation for byte offsets to "-pos=file.go:#123-#456"
The previous notation (sans '#') now yields an error but is
"reserved for future use", e.g. to denote line/column offsets.
Will implement as needed.

R=r, crawshaw
CC=golang-dev
https://golang.org/cl/13526043
2013-09-04 14:35:24 -04:00
Alan Donovan
e2921e188a go.tools/importer: make loading/parsing concurrent.
1. ParseFiles (in util.go) parses each file in its own goroutine.

2. (*Importer).LoadPackage asynchronously prefetches the
   import graph by scanning the imports of each loaded package
   and calling LoadPackage on each one.

   LoadPackage is now thread-safe and idempotent: it uses a
   condition variable per package; the first goroutine to
   request a package becomes responsible for loading it and
   broadcasts to the others (waiting) when it becomes ready.

ssadump runs 34% faster when loading the oracle.

Also, refactorings:
- delete SourceLoader mechanism; just expose go/build.Context directly.
- CreateSourcePackage now also returns an error directly,
  rather than via PackageInfo.Err, since every client wants that.

R=crawshaw
CC=golang-dev
https://golang.org/cl/13509045
2013-09-04 13:15:49 -04:00
Alan Donovan
48d14ded32 go.tools/cmd/oracle: cosmetic tweaks to Emacs.
1. call display-buffer after the postprocessing step to avoid display glitch.
2. suppress the postprocessing progress message---it's too verbose.
   (instead I should just make the postprocessing loop faster)

Also: rename channel-peers to just peers for consistency with other commands and documentation.

R=dominik.honnef
CC=golang-dev
https://golang.org/cl/13388044
2013-09-03 15:41:05 -04:00
Alan Donovan
d2cdbefbfc go.tools/oracle: add option to output results in JSON syntax.
See json.go for interface specification.

Example usage:
% oracle -format=json -mode=callgraph code.google.com/p/go.tools/cmd/oracle

+ Tests, based on (small) golden files.

Overview:
  Each <query>Result structure has been "lowered" so that all
  but the most trivial logic in each display() function has
  been moved to the main query.

  Each one now has a toJSON method that populates a json.Result
  struct.  Though the <query>Result structs are similar to the
  correponding JSON protocol, they're not close enough to be
  used directly; for example, the former contain richer
  semantic entities (token.Pos, ast.Expr, ssa.Value,
  pointer.Pointer, etc) whereas JSON contains only their
  printed forms using Go basic types.

  The choices of what levels of abstractions the two sets of
  structs should have is somewhat arbitrary.  We may want
  richer information in the JSON output in future.

Details:
- oracle.Main has been split into oracle.Query() and the
  printing of the oracle.Result.
- the display() method no longer needs an *oracle param, only
  a print function.
- callees: sort the result for determinism.
- callees: compute the union across all contexts.
- callers: sort the results for determinism.
- describe(package): fixed a bug in the predicate for method
  accessibility: an unexported method defined in pkg A may
  belong to a type defined in package B (via
  embedding/promotion) and may thus be accessible to A.  New
  accessibleMethods() utility fixes this.
- describe(type): filter methods by accessibility.
- added tests of 'callgraph'.
- pointer: eliminated the 'caller CallGraphNode' parameter from
  pointer.Context.Call callback since it was redundant w.r.t
  site.Caller().
- added warning if CGO_ENABLED is unset.

R=crawshaw
CC=golang-dev
https://golang.org/cl/13270045
2013-09-03 15:29:02 -04:00
Alan Donovan
0126405cad go.tools/oracle: change -pos flag syntax from "file pos-pos" to file:pos-pos.
Pro: no shell quotation needed.
Con: can't be parsed by (the perpetually useless) Scanf.

R=crawshaw, dgryski
CC=golang-dev
https://golang.org/cl/13441043
2013-09-03 10:58:58 -04:00
Alan Donovan
b43fa6fbda go.tools/cmd/ssadump: move ssa/ssadump.go command to its own package.
(Its former location was based on a misunderstanding of 'go build'.)

Also: set GOMAXPROCS to NumCPU by default.

R=crawshaw
CC=golang-dev
https://golang.org/cl/13354043
2013-08-29 21:34:36 -04:00
Alan Donovan
3184482148 go.tools/oracle: change -ptalog default to "".
Also: add a TODO.

R=crawshaw
CC=golang-dev
https://golang.org/cl/13352043
2013-08-29 21:32:49 -04:00
Rob Pike
bc5f637240 go.tools/cmd/vet: assume implementations of fmt.Formatter print just fine
Update golang/go#6212
See issue 6259.
When that is resolved, we can do a better job. Until then, we just see if the
type has a method called Format and, if so, assume it's a Formatter and so
there's nothing to check.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13267043
2013-08-28 11:24:43 +10:00
Andrew Gerrand
2e6fbd84f8 go.tools/cmd/godoc: don't list factory functions under types in builtin package
Fixes golang/go#6220.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13094049
2013-08-28 09:39:02 +10:00
Alan Donovan
713699d8ad go.tools: add copyright messages to source files.
R=r
CC=golang-dev
https://golang.org/cl/13305043
2013-08-27 18:49:13 -04:00
Brad Fitzpatrick
6f6897428a cmd/godoc: fix indexing
Use the flag.

Thanks to Travis Cline.

Fixes golang/go#6233

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/13284044
2013-08-27 15:16:31 -07:00
Alan Donovan
e08d89f3ed go.tools/oracle: an oracle that answers questions about Go source code.
+ Tests.
+ Emacs integration.
+ Emacs integration test.
+ very rudimentary Vim integration.  Needs some love from a Vim user.

TODO (in follow-ups):
- More tests would be good.
  We'll need to make the output order deterministic in more places.
- Documentation.

R=gri, crawshaw, dominik.honnef
CC=golang-dev
https://golang.org/cl/9502043
2013-08-27 17:58:26 -04:00
Andrew Gerrand
890e4c0731 go.tools/cmd/vet: exclude "%#v" from recursive stringer check
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/13163043
2013-08-22 11:44:39 +10:00
Andrew Gerrand
f6a22edf66 go.tools/cmd/vet: relax recursive stringer check
For the pointer receiver x, fmt.Sprintf(*x) does not invoke x's String
method.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12971045
2013-08-22 11:29:44 +10:00
Andrew Gerrand
373fd88c80 go.tools/cmd: move static files into new package 'static'
Fixes golang/go#6200.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12805046
2013-08-21 13:49:05 +10:00
Andrew Gerrand
de72360261 go.tools/cmd/vet: fix build of testdata package
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13144043
2013-08-21 11:08:25 +10:00
Andrew Gerrand
61d86e98d5 go.tools/cmd/vet: check for recursive stringers
Fixes golang/go#6129.

R=r
CC=golang-dev
https://golang.org/cl/12936046
2013-08-21 11:07:53 +10:00
Brad Fitzpatrick
3e29592dba cmd/vet: move whitelist to its own package
App Engine needs the whitelist file and it's cleaner if it's
in its own package where it can be imported directly, without
pushing composite.go through a pile of sed.

R=dsymonds, r
CC=golang-dev
https://golang.org/cl/12746045
2013-08-20 15:39:49 -07:00
Andrew Gerrand
74ecc2c09b go.tools/cmd/vet: detect useless function comparisons
Also fix bug in types.go discovered by this check.

Fixes golang/go#5347.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/13102043
2013-08-20 16:11:01 +10:00
Brad Fitzpatrick
7c5549876e cmd/godoc: don't parse HTML templates in command-line mode
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/12956044
2013-08-19 22:29:56 -07:00
David Symonds
a7c698b070 undo CL 12811043 / 44387735a77d
Not the right thing to do.
Fixes golang/go#6148.

««« original CL description
cmd/vet: flag redundant invocations of String and Error methods in printf calls.

R=r
CC=golang-dev
https://golang.org/cl/12811043
»»»

R=r
CC=golang-dev
https://golang.org/cl/13034043
2013-08-19 11:12:44 +10:00
Brad Fitzpatrick
1633383a2b cmd/godoc: don't start up indexer in command-line mode
Fixes golang/go#6075

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/12995044
2013-08-16 19:49:24 -07:00
Andrew Gerrand
32acd2b372 go.tools/cmd/godoc: redirect old pkg/cmd paths
fixes golang/go#5317.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12869046
2013-08-16 13:44:52 +10:00
Andrew Gerrand
562e4faeca cmd/godoc: bake templates and scripts into godoc binary
Add godoc/vfs/mapfs package for serving baked files.

Fixes golang/go#6010.

R=golang-dev, bradfitz, r, arnehormann, rsc
CC=golang-dev
https://golang.org/cl/12978043
2013-08-16 11:44:27 +10:00
David Symonds
c0b6badc83 cmd/vet: flag redundant invocations of String and Error methods in printf calls.
R=r
CC=golang-dev
https://golang.org/cl/12811043
2013-08-13 13:47:58 +10:00
Rob Pike
28fe5aa8d3 go.tools/cmd/cover: s/ParseInt/Atoi/
So people stop asking me to do this.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12691044
2013-08-09 13:48:46 +10:00
Rob Pike
4622486b62 go.tools/cmd/cover: add -func mode to print per-function coverage
fmt/format.go:	init			100.0%
fmt/format.go:	clearflags		100.0%
fmt/format.go:	init			100.0%
fmt/format.go:	computePadding		84.6%
fmt/format.go:	writePadding		83.3%
...
total:		(statements)		91.3%

Fixes golang/go#5985.

R=golang-dev, dave, gri
CC=golang-dev
https://golang.org/cl/12454043
2013-08-09 12:55:21 +10:00
Robert Griesemer
45e3d57f32 go.tools/cmd/vet: enable test (fix build)
R=r
TBR=r
CC=golang-dev
https://golang.org/cl/12482043
2013-08-05 14:02:52 -07:00
Rob Pike
c333e7a7b6 go.tools/cmd/vet: fix go.tools build
TBR: gri

I cannot create an issue on the tracker for some reason, so here it is:
go vet contains this snippet:

        if types.IsAssignableTo(typ, errorType) || types.IsAssignableTo(typ, stringerType) {

It's getting the wrong answer: It claims

interface {
        f()
}

or even

interface {
        f() float64
}

matches the Error and Stringer interfaces. Both of them.  This causes a test failure:
$ go test code.google.com/p/go.tools/cmd/vet
BUG: errchk: testdata/print.go:124: missing expected error: '"for printf verb %s of wrong type"'
$
This worked until very recently.

R=gri
CC=golang-dev
https://golang.org/cl/12398043
2013-08-03 15:56:56 +10:00
Rob Pike
aecec2f502 go.tools/cmd/vet: the composite test is about keys, not tags
Fix the confusion.
No semantic change, just some renamings.

Fixes golang/go#6017.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12394043
2013-08-03 12:19:59 +10:00
Rob Pike
797431e1a3 go.tools/cmd/vet: fix printf analysis for structs.
The old code only got it right for Stringers (etc.) and a few other simple cases.
But the rule used by fmt.Printf for non-Stringers is that pointers to structs
print as pointers, the rest must satisfy the format verb element-wise.
Thus for example
        struct {a int, b []byte}
prints with %d and %q (sic) but not %g.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/12340043
2013-08-02 22:52:38 +10:00
Andrew Gerrand
8d55039560 go.tools/cmd/godoc: fix typo
R=golang-dev
CC=golang-dev
https://golang.org/cl/12238043
2013-08-01 17:43:31 +10:00
Andrew Gerrand
37c18cdcf3 go.tools/cmd/godoc: start indexer in app engine mode
R=golang-dev
CC=golang-dev
https://golang.org/cl/12237044
2013-08-01 17:37:20 +10:00
Andrew Gerrand
0830cbddc9 go.talks/cmd/godoc: add jquery.js and style.css
Somehow missed these.

R=golang-dev
CC=golang-dev
https://golang.org/cl/12233043
2013-08-01 17:36:56 +10:00
Andrew Gerrand
0afeff2d4b go.tools/cmd/godoc: add godocs.js and playground.js from core repo
The originals will be removed.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12219043
2013-08-01 15:08:46 +10:00
Andrew Gerrand
508186a765 go.tools/cmd/godoc: copy templates from $GOROOT/lib/godoc
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12209043
2013-08-01 11:01:10 +10:00
Brad Fitzpatrick
143d18d6c5 cmd/godoc: fix build
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/12127043
2013-07-30 13:42:50 -07:00
Rob Pike
2a8b9debdd go.tools/cmd/vet: don't complain about empty interface values in printf
R=dsymonds
CC=golang-dev
https://golang.org/cl/12005047
2013-07-30 15:51:35 +10:00
Andrew Gerrand
253974207b go.tools/cmd/godoc: update appinit.go to use new godoc packages
Also move some common code from main.go to handlers.go, and
exclude remotesearch.go from the appengine build (it is only
relevant to the command line interface).

R=bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/12001049
2013-07-30 14:23:23 +10:00
Rob Pike
5ba51116ee go.tools/cmd/vet: treat arrays like slices in the printf checks.
The analysis for types.Array was just missing. It's the same as a slice,
but we can't share code easily because the types differ, so we just dup it.

R=dsymonds
CC=golang-dev
https://golang.org/cl/12041045
2013-07-30 14:00:52 +10:00
David Symonds
40baf75587 cmd/vet: Avoid warning on pointer to invalid types.
TBR=r
CC=golang-dev
https://golang.org/cl/12038051
2013-07-30 13:41:07 +10:00
David Symonds
573374c476 cmd/vet: Fix handling of non-Stringer arguments.
First, %v and %T accept any arguments, so they should never warn.
Second, pointer types were not handled in matchArgType.
Third, the default response for matchArgType should be false.

R=r
CC=adonovan, golang-dev
https://golang.org/cl/12038050
2013-07-30 13:15:31 +10:00
Andrew Gerrand
7375911b0e go.tools/cmd/godoc: use playground package from go.tools
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/11507044
2013-07-24 17:25:24 +10:00
Rob Pike
9ac8940d29 all: be more idiomatic when documenting boolean return values.
Phrases like "returns whether or not the image is opaque" could be
describing what the function does (it always returns, regardless of
the opacity) or what it returns (a boolean indicating the opacity).
Even when the "or not" is missing, the phrasing is bizarre.

Go with "reports whether", which is still clunky but at least makes
it clear we're talking about the return value.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/11458046
2013-07-23 10:37:43 +10:00
David Symonds
75919c8eee cmd/vet: avoid panic if no valid inputs are found.
I'd like to make vet work as a filter, but passing /dev/stdin as a
command line argument doesn't work. This at least makes it not panic.

R=r
CC=golang-dev
https://golang.org/cl/11521045
2013-07-22 12:43:11 +10:00
Brad Fitzpatrick
80d38231f7 godoc: move search from cmd to the package
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11540045
2013-07-19 14:02:03 +10:00
David Symonds
0160160d5e cmd/godoc: Fix reg test on Windows.
R=bradfitz, gri
CC=golang-dev
https://golang.org/cl/11551043
2013-07-19 10:31:12 +10:00
Brad Fitzpatrick
705bb7ffce godoc: remove the last of the global variables, unexport Server
The exported Server becomes handlerServer, and part of Presentation
now.  Presentation is also now an http.Handler with its own
internal mux (a detail, which might go away).

main.go becomes ever simpler.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11505043
2013-07-19 10:27:53 +10:00
Robert Griesemer
40a278e5ee go.tools/go/types: rename Context -> Config (more apt name)
Also: Various minor cleanups.

R=adonovan, r
CC=golang-dev
https://golang.org/cl/11445044
2013-07-18 17:07:44 -07:00
Robert Griesemer
9460d02473 go.tools/cmd/vet: fix error message
R=r, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/11552043
2013-07-18 16:56:01 -07:00
Robert Griesemer
6d85cc17dd go.tools/go/types: request type Info via maps instead of callbacks
Allmost all uses of go/types that wanted the type
information computed, installed callback functions
that stored the information in maps. Most of the
time this is the only thing that could be done because
there is no guarantee that types are completely set
up before the end of type-checking.

This CL removes the respective Context callbacks in favor
of corresponding maps that collect the desired information
on demand, grouped together in an optional Info struct.

R=adonovan
CC=golang-dev
https://golang.org/cl/11530044
2013-07-18 13:09:03 -07:00
Brad Fitzpatrick
66f0d6e92e godoc: more cleanup
cmd/godoc/godoc.go is now merged into main.go, which is now
only 530 lines.

App Engine mode is still broken, but should be easy to fix up.
(just needs a global *godoc.Presentation created in init)

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11498044
2013-07-18 13:51:17 +10:00
Brad Fitzpatrick
5395cfe05a godoc: remove more global variables
More moves into Corpus and Presentation.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11492043
2013-07-18 13:14:09 +10:00
Brad Fitzpatrick
4fc6323385 godoc: add a Corpus and Presentation type
Start of moving globals into those types.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11484043
2013-07-18 09:52:45 +10:00
David Symonds
3af65e49c2 cmd/godoc: Add a basic regression test.
R=adg, bradfitz
CC=golang-dev
https://golang.org/cl/11419044
2013-07-17 17:32:45 +10:00
Brad Fitzpatrick
cd835f01af godoc: use httptest.ResponseRecorder instead of reimplementing it
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11428043
2013-07-17 17:25:54 +10:00
Brad Fitzpatrick
e6ff53bcc8 godoc: move bulk of the code to the package
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11424043
2013-07-17 17:09:54 +10:00
Andrew Gerrand
2392be72c2 go.tools/godoc: move Throttle to package godoc/util
R=bradfitz
CC=golang-dev
https://golang.org/cl/11417043
2013-07-17 15:23:31 +10:00
Andrew Gerrand
2822addeae go.tools/cmd/godoc: use go.talks playground package
R=bradfitz
CC=golang-dev
https://golang.org/cl/11416043
2013-07-17 15:17:04 +10:00
Andrew Gerrand
5ff0687cc9 go.tools/godoc: move vfs code to vfs package
R=bradfitz
CC=golang-dev
https://golang.org/cl/11414043
2013-07-17 15:02:27 +10:00
Brad Fitzpatrick
7526441b70 godoc: add util package, add start of vfs package
Move some code out of cmd/godoc.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11413043
2013-07-17 14:44:18 +10:00
Andrew Gerrand
d79f4fe25b go.tools/cmd/godoc: copy godoc from core reposistory
The plan for godoc:
- Copy godoc source from the core repo to go.tools (this CL).
- Break godoc into several packages inside go.tools, leaving a package
  main that merely sets up a local file system, interprets the command
  line, and otherwise delegates the heavy-lifting to the new packages.
- Remove godoc from the core repo.
- Update cmd/go to install this godoc binary in $GOROOT/bin.
- Update misc/dist to include godoc when building binary distributions.

R=bradfitz
CC=golang-dev
https://golang.org/cl/11408043
2013-07-17 14:02:35 +10:00
Alan Donovan
25f3e0fbde go.tools/cmd/vet: improvements to static checking of printf calls.
Details:
- added support for complex numbers as distinct from floats:
  %[efg] allows complex; %b does not.
- %p: only Signature, Map, Chan, Slice, unsafe.Pointer allowed.
- %s: allow []byte.
- allow a verb to match map[K]V and []T if it matches K/V/T,
  e.g. %d now matches []int.  i.e. matching is recursive.
- use go/types' constant folding.  literal() is gone.
- group cases together.

Added tests.

R=gri, r
CC=golang-dev
https://golang.org/cl/10895043
2013-07-15 18:37:49 -04:00
Rob Pike
b042505490 go.tools/cmd/vet: use types.Eval to simplify some checking.
Depends on CL 10748044

R=gri
CC=golang-dev
https://golang.org/cl/11206043
2013-07-13 07:52:00 +10:00
Rob Pike
1c382c95b2 go.tools/cmd/cover: get cover counters on if conditions
This requires a little more tree rewriting to put a block around the if of an "else if".
More tests too.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11042045
2013-07-10 15:20:52 +10:00
Andrew Gerrand
5b27bc1db9 go.talks/cmd/cover: show simpler legend for "set" mode
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10738044
2013-07-10 14:03:35 +10:00
Andrew Gerrand
c659fcb7c8 go.tools/cmd/cover: add floating bar with file selector and legend
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11076043
2013-07-10 13:22:04 +10:00
Andrew Gerrand
2b6515094c go.talks/cmd/cover: better color scheme and fonts
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/11032043
2013-07-09 16:58:15 +10:00
Andrew Gerrand
a82eaff6b7 go.tools/cmd/cover: change color scheme and add legend
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/10991043
2013-07-08 15:24:34 +10:00
Andrew Gerrand
00268482c0 go.tools/cmd/cover: use html/template for html generation
Also includes simple JavaScript dropdown picker.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/10838045
2013-07-06 16:58:50 +10:00
Andrew Gerrand
d9e6cbb135 go.tools/cmd/cover: use a gradient to colorize "count" profiles
R=r
CC=golang-dev
https://golang.org/cl/10858047
2013-07-05 13:53:09 +10:00
Andrew Gerrand
98e8131132 go.tools/cmd/vet: add image.Uniform to untagged literal white list
R=nigeltao
CC=golang-dev
https://golang.org/cl/10817043
2013-07-01 12:42:08 +10:00
Rob Pike
78efac5f33 go.tools/cmd/cover: yet another attempt at a usage message (YAAAAUM) for go tool cover
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10710044
2013-06-27 14:48:27 -07:00
Rob Pike
b52f745c3a go.tools/cmd/cover: delete TODO that is NOWDONE
R=adg
CC=golang-dev
https://golang.org/cl/10505044
2013-06-27 09:20:34 -07:00