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>
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>
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>
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>
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>
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>
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>
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
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
Avoid error "could not import C (can't find import: C)"
Fixesgolang/go#9169.
LGTM=adonovan, r
R=golang-codereviews, adonovan, r
CC=golang-codereviews
https://golang.org/cl/184730043
"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
- print "oracle:" not "Error:" in error messages; remove period.
- allocate token.FileSet correctly.
- remove stale TODO (multiple test packages)
- fix typo and omission ('what') in usage message.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/178860043
Such messages are more informative when the error occurs deep within a script.
Also: add tool name to digraph's usage messages.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/173380043
(This functionality is provided by the oracle, but its output
format is inflexible, and the functionality is better suited
to a shell utility. I may remove the oracle 'callgraph' feature.)
See Usage for details.
+ Test.
LGTM=sameer
R=sameer
CC=golang-codereviews, gri
https://golang.org/cl/164460044
Rewrite performed with this command:
sed -i '' 's_code.google.com/p/go\._golang.org/x/_g' \
$(grep -lr 'code.google.com/p/go.' *)
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/170920043
Add tests for recently introduced asm error checks in vet.
This adds tests for the new warnings about functions that
don't store to their return slot before returning or that
store to SP-relative addresses in or beyond the argument
frame. It also adds a test for leaf function handling on arm,
where the link register is not implicitly saved.
LGTM=rsc
R=rsc
CC=adg, golang-codereviews, r
https://golang.org/cl/166040044
vet now includes function names in its error messages about
assembly code. Update the error test patterns to account for
this and expand some patterns to check that go vet discovers
the function name correctly.
Fixesgolang/go#9041
LGTM=r
R=adg, r, rsc
CC=golang-codereviews
https://golang.org/cl/170940044
(They may contain any character, after all.)
Also, allow but don't require parens and stars.
e.g. (*"encoding/json".Decoder).Decode or "encoding/json".Decoder.Decode
but not encoding/json.Decoder.Decode.
Since -from queries are now Go expressions, we use the Go parser.
(Thanks to Rog Peppe for the suggestion.)
LGTM=sameer
R=sameer
CC=golang-codereviews, gri, rogpeppe
https://golang.org/cl/154610043
This adds support for checking moves to the return value stack
slot (from rsc), adds support for checking power64x assembly,
fixes argument offset checking and leaf function support on
platforms with a link register (arm and power64).
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/166920043
Example: show the transitive closure of imports of the digraph tool itself:
% go list -f '{{.ImportPath}}{{.Imports}}' ... | tr '[]' ' ' |
digraph forward code.google.com/p/go.tools/cmd/digraph
+ basic test.
LGTM=gri
R=gri, sameer
CC=golang-codereviews
https://golang.org/cl/161760043
Initializing the unused variable formatterType (it will be used soon) was
panicking if the import couldn't be done, but vet shouldn't be so fragile.
LGTM=gri
R=gri
CC=dsymonds, golang-codereviews
https://golang.org/cl/153480044
Fixesgolang/go#8792.
This is a simple change that fixes the issue. It may be desireable
to opt for a larger code change that makes this problem less likely
to be inadvertedly reintroduced in the future. For instance, a vetMain()
func can be used similar to gofmtMain(), or the os.Exit call can be
deferred.
LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/150850043
See the usage message in main.go for orientation.
To the best of my knowledge, the tool implements all required
soundness checks, except:
- the dynamic behaviour of reflection is obviously undecidable.
- it rejects method renamings that change the "implements" relation.
It should probably be more aggressive.
- actually it only checks the part of the "implements" relation
needed for compilation. Understanding the dynamic behaviour
of interfaces is obviously undecidable.
- a couple of minor gaps are indicated by TODO comments.
Also:
- Emacs integration.
- tests of all safety checks and (some) successful rewrites.
LGTM=dominik.honnef, sameer
R=gri, sameer, dominik.honnef
CC=golang-codereviews
https://golang.org/cl/139150044
To avoid breaking URLs, we redirect /src/pkg/* to /src/*.
The URL /pkg is now the "directory" /src, which triggers the
"Packages" index.
All other references to "src/pkg" are now gone,
except a number in the namespace documentation which are
probably still illustrative.
Tested: go test cmd/godoc godoc
Manual inspection of src and src/pkg pages.
with GOROOT and GOPATH packages
-analysis
/AUTHORS file URL still works
LGTM=bradfitz, adg
R=bradfitz, adg
CC=golang-codereviews
https://golang.org/cl/141770044
Documentation change only. The binary will not be installed
using the "go tool" mechanism.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/133710046
(godoc is excluded from this CL since it will continue to use
/src/pkg in its URL namespace, making the necessary cleanup
more subtle.)
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/141770043
Missed comment from previous code review.
Next up: execution tests so this won't happen again
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/134480043
Improve the generated code by using a const instead of a var for the names string.
This requires some refactoring to get neat const() and var() blocks.
Also change the generate map code go use a single sliced string, to reduce the
size of the compiled representation (only one string value).
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/135450044
Refactor a little to make testing easier.
Add golden tests and a check fo splitIntoRuns, which is the subtlest piece.
Still to come: execution tests.
Also fix a few issues in the generated code.
LGTM=gri
R=gri
CC=golang-codereviews, josharian
https://golang.org/cl/134450044
This tool creates String methods from constant definitions.
It's a time-saver designed to be used from go generate.
The methods generated are efficient, more so than one
is likely to create by hand.
Given
package date
type Day int
const (
Monday Day = iota
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
)
the command
stringer -type Day
will create the file day_string.go containing
package date
import "fmt"
var (
_Day_indexes = []uint8{6, 13, 22, 30, 36, 44, 50}
_Day_names = "MondayTuesdayWednesdayThursdayFridaySaturdaySunday"
)
func (i Day) String() string {
if i < 0 || i >= Day(len(_Day_indexes)) {
return fmt.Sprintf("Day(%d)", i)
}
hi := _Day_indexes[i]
lo := uint8(0)
if i > 0 {
lo = _Day_indexes[i-1]
}
return _Day_names[lo:hi]
}
There are several strategies for the created method chosen according to
the structure of the sequence of constants.
Handles integer types only, both signed and unsigned. That's probably
all that is needed.
Tests to follow, but the test structure will be large so sending this out
separately. The code has been heavily hand-tested but there are
some bugs. Don't depend on this until the tests are installed.
LGTM=gri
R=gri, josharian
CC=golang-codereviews
https://golang.org/cl/136180043
LookupFieldOrMethod now also decides whether a found
method is actually in the method set. Simplifies call
sites. Added corresponding API tests.
TODO (separate CL): Decide what the correct value for
the indirect result should be (as required for code
generation). For now, the result value for indirect
is unchanged from before if a field/method is found.
Fixesgolang/go#8584.
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/132260043
e.g. chmod +w, checkout.
Also: add a TIPS section to the documentation.
LGTM=crawshaw
R=crawshaw, gri
CC=golang-codereviews
https://golang.org/cl/136780044
Be careful not to complain about math.Log and cmplx.Log.
Seems worthwhile since t.Log and t.Logf are often written but
rarely executed.
Nothing new turned up in the standard library.
Fixesgolang/go#8504.
LGTM=josharian, dsymonds
R=golang-codereviews, josharian, dsymonds
CC=golang-codereviews
https://golang.org/cl/130490043
s/enclosed by function/captured by func literal/
Users complained. They often do.
LGTM=josharian, adg
R=golang-codereviews, josharian, nightlyone, minux, adg
CC=golang-codereviews
https://golang.org/cl/132080043
This CL aims to fix the problem described here:
https://groups.google.com/forum/#!topic/golang-nuts/R6ms1n9KjiY
This makes it easier to parse via external tools such as editors. Editors can
show each function in a list and jump directly to each function with this
additional information. This pattern can be seen in other Go tools such as "go
test" in the form of:
--- FAIL: TestCover (0.52 seconds)
cover_test.go:43: example error
LGTM=adg
R=r, adg, josharian, dave
CC=golang-codereviews
https://golang.org/cl/131820043
We want to make an if look like two blocks and have the coverage
report for the else block decorate the "else" keyword with the right
color. To do this, we adjust the apparent starting point of the else
block to include the "else".
The previous code assumed the way to do this was to move the
width of "else " backwards from the else block's opening brace, but
that assumes there is a space there. Instead, we now just start the
else block exactly at the end of the if block. Simpler, cleaner, and
fixes a bug.
Fixesgolang/go#8557.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/127620043
As requested on Stack Overflow: http://goo.gl/ams9fY
(Kudos to sberry for his JavaScript solution, provided there.
This change does the same thing on the server side.)
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/127030043
And serialize the printing of each item with a mutex.
It is the formatted output of this tool, after all.
Also: minor doc tweaks.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/114620044
`go test` takes -run and -bench; the -test.run and -test.bench flags
are only for the test binary itself.
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/113390043
This change allows the directory front page to be more easily configurable.
Templates are now read only at start-up and stored in a map rather than re-parsed for each page rendering.
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/109080044
text/tabwriter cells are tab-terminated, not tab-separated. This creates trailing whitespace. However, with left-aligned columns, it is ok not to treat the final element as a cell. Demo: http://play.golang.org/p/m_ajG8SSZe
LGTM=gri
R=golang-codereviews, gobot, gri
CC=golang-codereviews, r
https://golang.org/cl/103650043
This CL introduces two vet checks. Statistics and code below are from a recent 50mb corpus of public code.
1. Check for redundant conjunctions and disjunctions. This check caught 26 instances, of which 20 were clearly copy/paste bugs and 6 appeared to be mere duplication. A typical example:
if xResolution < 0 || xResolution < 0 {
panic("SetSize(): width < 0 || height < 0")
}
2. Check for expressions of the form 'x != c1 || x != c2' or 'x == c1 && x == c2', with c1 and c2 constant expressions. This check caught 16 instances, of which all were bugs. A typical example:
if rf.uri.Scheme != "http" || rf.uri.Scheme != "ftp" {
rf.uri.Scheme = "file"
}
Fixesgolang/go#7622.
LGTM=rsc, r
R=golang-codereviews, jscrockett01, r, gri, rsc
CC=golang-codereviews
https://golang.org/cl/98120043
Really two fixes: Don't panic on bad instructions and don't complain about commented out instructions.
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/110070044
Clients such as compilers need this information in order
to correctly link against imported packages.
This also adds support for the condensed import data format
where the priority information is stored as a suffix of the
condensed import data, as well as support for archive files.
LGTM=gri
R=gri
CC=golang-codereviews, iant
https://golang.org/cl/78740043
Bare init functions omit calls to dependent init functions and the
use of an init guard. They are useful in cases where the client uses
a different calling convention for init functions, or cases where
it is easier for a client to analyze bare init functions.
LGTM=adonovan
R=adonovan
CC=golang-codereviews, iant
https://golang.org/cl/78780043
This is a common source of bugs, particularly for those new to Go. Running this on a corpus of public code flagged 114 instances.
This check may need to be updated once issue 7363 is resolved.
LGTM=r
R=golang-codereviews, r
CC=bradfitz, golang-codereviews
https://golang.org/cl/91010047
In command godoc, set IndexEnabled when the -write_index flag is set.
Previously you would need to (unintuitively) set the -http flag to
achieve this.
In package godoc, set up the FS tree before loading the index, and
then return before starting the index refresh loop. Previously the
index would be loaded and then immediately refreshed, negating the
benefits of the on-disk index.
TBR=bradfitz
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/103370046
This removes much of the AST logic out of main.go,
and makes it easier to build custom vet binaries
The trade-off in this change is for flexibility.
There's very little change in the per-check files,
a lot less code in main.go (specifically the AST walking
logic has shrunk), and it makes it much easier to build
custom vet binaries simply by dropping new source files
in the directory.
LGTM=josharian, r
R=r, josharian, kamil.kisiel
CC=golang-codereviews
https://golang.org/cl/83400043
This will fix the images in Brad's GoCon presentation.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/100950043
Also fixes the following nits;
- literal IPv6 address handling
- URL host component handling in the case of a wildcard listen
- URL port component handling in the case of no port component in origin
Fixesgolang/go#8096.
LGTM=dan.kortschak, adg
R=adg, golang-codereviews, dan.kortschak
CC=golang-codereviews
https://golang.org/cl/102770046
If you have multiple runs in old.txt and new.txt
the default behavior is to match them up pairwise
and compare successive pairs (and if you have a
different number of runs in each file, benchcmp
refuses to do anything).
The new -best flag changes the behavior to instead
compare the fastest run of each benchmark from
the two files. This makes sense if you believe that
the fastest speed is the 'actual' speed and the slower
results are due to the computer spending time doing
non-benchmark work while the benchmark was
running.
LGTM=josharian
R=golang-codereviews, josharian
CC=golang-codereviews
https://golang.org/cl/102890047
They were disabled by mistake during the move to go.tools.
LGTM=dan.kortschak
R=golang-codereviews, dan.kortschak
CC=golang-codereviews
https://golang.org/cl/98440048
It was very ugly; a little tweaking helps godoc parse it better.
Also make unsafeptr.go not own the package doc (add a blank line)
and put one more sentence about that check into doc.go.
Fixesgolang/go#7925.
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/98370044
Ignore calls to various flavours of atomic.AddInt with a wrong
number of arguments.
LGTM=r
R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/91370045
The old code printed the underlying type; e.g., the type
of time.Millisecond was reported to be int64 rather than
time.Duration.
Testsuite (and corresponding tests) in progress (another CL).
LGTM=adonovan
R=adonovan, dsymonds
CC=golang-codereviews
https://golang.org/cl/94770045
Assuming:
1) package declaration does not exist
2) the Fragment option is set
3) a main function exists
We will assume it is a main package and add the declaration.
This change also sets the Fragment option in goimports.
LGTM=crawshaw, bradfitz
R=bradfitz, crawshaw
CC=golang-codereviews
https://golang.org/cl/96850044
(The test thread is racing with the analysis thread, which
takes around 4ms on this input.)
LGTM=gri
R=gri, bradfitz
CC=golang-codereviews
https://golang.org/cl/89780044
The text and images are "baked in" to the godoc executable's
rodata section (~300KB) and are accessible from the godoc
server itself at /lib/godoc/analysis/help.html.
In due course, the page will become visible at
http://golang.org/lib/godoc/analysis/help.html, which will be
the canonical location for this doc (in announcements, etc).
The page is temporarily visible here, for those on the Google corp network:
http://172.26.104.127:7777/lib/godoc/analysis/help.html
Also:
- add link to new doc from source view pages.
- document -analysis flag in cmd/godoc/doc.go
- fix indentation of -analysis flag's help string
LGTM=gri
R=gri, bgarcia, r
CC=golang-codereviews
https://golang.org/cl/87110045
Details:
- auto-generate prefixes for std lib (e.g., "godex big" works now)
- apply filtering to package-level objects only
- nicer formatting of single-entry const, var, or type declaration
TBR=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/81360046
All of these work now as expected:
godex code.google.com/p/go.tools/go/types
godex go.tools/go/types
godex go/types
godex types
Also improved logging/verbose mode.
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/80930043
1) Split a path.name argument at the last '.' that
is not part of the path.
2) Try various importers always in the same order
for consistent results (use lists instead of maps).
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/80790043
See analysis.go for overview of new features.
See README for known bugs and issues.
Much UI polish, testing and optimization work remains, but
this is a starting point.
Flag: we add a new flag -analysis=type,pointer, default "",
for adventurous users only at this stage.
Type analysis takes ~10s for stdlib + go.tools;
Pointer analysis (currently) takes several minutes.
Dependencies: we now include jquery.treeview.js and its GIF
images among the resources. (bake.go now handles binary.)
LGTM=crawshaw, bgarcia
R=crawshaw, bgarcia
CC=bradfitz, golang-codereviews
https://golang.org/cl/60540044
It's pointless.
Also this fixes a crash, because the blank identifier no longer appears as a
defined object after CL 74190043 so we were getting nil pointer violations.
Even better, we get to re-enable a disabled test.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/75140043
Now we can say
vet -printf=false
to disable the printf test but run all others.
Implemented by creating a tri-state boolean flag that records whether it has been
set explicitly; before this, -printf=false was not distinguishable from not having
mentioned the printf flag at all.
Fixesgolang/go#7422.
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/72330043
Over time, a number of modules were added that used Warn instead of Bad
to report problems with the code, but the documentation states that
if there is a problem, the exit code must be 1, not 0. Warn does not set the
exit code and should be used only for internal errors and messages
triggered by the -v flag.
There's nothing substantive here except calling the other function in a few
places.
Fixesgolang/go#7017.
LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/71860044
The old code was misleading in saying how many args were present.
Change the wording of the message to be unambiguous and change
the presentation of the format to include the full directive, making
it easier to correlate with the input (and fixing a silent bug).
Fixesgolang/go#6248.
LGTM=dsymonds
R=golang-codereviews, dsymonds
CC=golang-codereviews
https://golang.org/cl/69120044
An identifier X in anonymous struct field struct{X} is both a
definition of a field (*Var) and reference to a type
(*TypeName). Now that we have split the map, we can capture
both of these aspects.
Interestingly, every client but one was going to extra effort
to iterate over just the uses or just the defs; this
simplifies them.
Also, fix two bug related to tagless switches:
- An entry was being recorded in the Object map for a piece of
synthetic syntax.
- The "true" identifier was being looked up in the current scope,
which allowed perverse users to locally redefine it. Now
we use the bool (not untyped boolean) constant true, per the
consequent clarification of the spec (issue 7404).
+ tests.
Fixesgolang/go#7276
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/68270044
How it handles packages vs. directories vs. files was not explained.
LGTM=rsc
R=golang-codereviews, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/67150043
benchcmp now preserves benchmark order. This restores the original
misc/benchcmp behavior. This also makes the output of benchcmp stable,
and groups together multiple -cpu results.
Magnitude-based sorting is still available via the -mag flag.
It is useful for surfacing items of note (particularly changes
in allocs) when making compiler changes and running broad
benchmarks.
Fixesgolang/go#7259.
LGTM=dave
R=dave, mtj
CC=bradfitz, dvyukov, golang-codereviews
https://golang.org/cl/60840045
These are the simplest possible descriptions of each command.
They may be fleshed out later.
Fixesgolang/go#7298.
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/61480044
Don't say the word "fork" (not accurate), and remove the
tab/comment flags that were removed from gofmt.
LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/61410052
Previously, each word could be a package import path or a
comma-separated list of *.go file names. Now, if the
first word ends with ".go", all words are assumed to be
Go source files. This makes it impossible to specify
two ad-hoc packages from source files, but no-one needs that.
FromArgs also takes a boolean indicating whether tests
are wanted or not.
Also: ssadump: add -test flag to set that boolean.
For the oracle it's always true.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/61470047
Method-set caching is now performed externally using a MethodSetCache (if desired), not by the Types themselves.
This a minor deoptimization due to the extra maps, but avoids a situation in which method-sets are computed and frozen prematurely. (See b/7114)
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/61430045
This is intended to replace the awk-based misc/benchcmp.
It mostly matches the existing misc/benchcmp.
Notable changes:
* Written in Go.
* Minor whitespace changes in the output; the tabular nature of the
output is preserved, as is most number formatting and verbiage.
* Comparisons within each section are sorted from highest change to lowest.
* Proper handling of multiple benchmarks with the same name (issue 7016).
* Does not omit benchmark comparisons for which the new value is zero.
* Adds -changed flag to only show benchmarks whose value have changed.
Useful for memory-oriented, large-scale benchmark comparisons.
* Has tests.
* Formats small ns measurements with extra precision.
Updates golang/go#7016.
LGTM=r
R=golang-codereviews, dave, dvyukov, oleku.konko, bradfitz, gobot, r
CC=golang-codereviews
https://golang.org/cl/47980043
This results in significant improvement to type-checking time:
it reduces by 4% the entire running time of ssa/stdlib_test
(GOMAXPROCS=8, n=7).
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/57770043
The Importer type has been replaced with Config and Program.
Clients populate a Config, directly or more usually via
convenience functions. They then call its Load() method to do
all of the typechecking and transitive-closure computation.
ssa.NewProgram and ssa.CreatePackages have been fused into
ssa.Create, which now cannot fail, since (*Config).Load()
reports all type errors.
Also:
- The addition of an ssa.GlobalDebug builder mode flag
eliminates a loop-over-packages repeated in many clients.
- PackageInfo.Err flag unexported. Clients never see bad infos now.
- cmd/ssadump: now only looks for func "main" in package "main".
- importsOf deleted, was dead code.
STILL TODO:
- ParseFile seems like API creep (though it's convenient)
and CreateFromFiles is dangerous (w.r.t. FileSet identity).
Need to think more...
- the need for clients to rely on elementwise correspondence
of Config.CreatePkgs and Program.Created is a little sad.
- The command-line interface has not changed.
That will happen in a follow-up.
r recommends using a repeated flag: -package p -package q ...
R=gri
CC=axwalk, frederik.zipp, golang-codereviews
https://golang.org/cl/49530047
Packages were not being created for all types.Packages,
specifically, indirectly imported packages were missing.
(*Program).CreatePackages now iterates over the type-checker's
package map too.
Also: removed all concurrency from importer. I think it was
incorrect (and hard to fix).
Also: change LoadInitialPackages so that all named packages
are loaded from source. This happens regardless of whether
GCImporter is used to satisfy imports.
Details:
- importer.Config.SourceImports flag determines whether to
load all packages from *.go source.
(Before, this was indicated by Config.Build != nil.)
- importer.Config.Build field effectively defaults to
&go/build.Default. A zero importer.Config is now usable.
- importer.Importer.Config field is now exported.
- LoadPackage renamed to ImportPackage since the resulting
packages may come from GCImporter (and be incomplete).
- doImport and ImportPackage fused.
Fixesgolang/go#7028
R=gri, axwalk
CC=golang-codereviews
https://golang.org/cl/48770043
Also report an error for "cross-interpretation": not supported
due to the interpreter's assumption that host and target
{int,uint,uintptr} are the same. (Too tedious and messy to fix.)
Tested manually:
% cat d.go
package main
const m = ^uintptr(0)
const w = m>>8&1 + m>>16&1 + m>>32&1
func main() { println(m, w) }
% ./ssadump -build=P -run d.go
package main:
const m m = 18446744073709551615:uintptr
const w w = 3:uintptr
18446744073709551615 3
% GOARCH=386 ./ssadump -build=P -run d.go
package main:
const m m = 4294967295:uintptr
const w w = 2:uintptr
Error: Cross-interpretation is not yet supported (target has GOARCH 386, interpreter has amd64).
Fixesgolang/go#7080
R=gri
CC=golang-codereviews
https://golang.org/cl/49070043
The display of search results can now be changed. A slice of functions for displaying the results can now be provided. By default, three functions are provided to display documentation, source code, and textual results.
This makes it possible to replace them with equivalents that, say,
obtain search results from alternative source code search engines.
R=bradfitz, adg
CC=golang-codereviews
https://golang.org/cl/43470043
Not for Go 1.2. Still needs a flag.
Linux at least (and likely other OSes) don't like you doing
a few hundred readdirs at once and spawing as many threads.
R=golang-dev, adg, jeremyjackins
CC=golang-dev
https://golang.org/cl/30620043
Command set:
- what: an extremely fast query that parses a single
file and returns the AST stack, package name and the
set of query modes that apply to the current selection.
Intended for GUI tools that need to grey out UI elements.
- definition: shows the definition of an identifier.
- pointsto: the PTA features of 'describe' have been split
out into their own command.
- describe: with PTA stripped out, the cost is now bounded by
type checking.
Performance:
- The importer.Config.TypeCheckFuncBodies predicate supports
setting the 'IgnoreFuncBodies' typechecker flag on a
per-package basis. This means we can load dependencies from
source more quickly if we only need exported types.
(We avoid gcimport data because it may be absent or stale.)
This also means we can run type-based queries on packages
that aren't part of the pointer analysis scope. (Yay.)
- Modes that require only type analysis of the query package
run a "what" query first, and restrict their analysis scope
to just that package and its dependencies (sans func
bodies), making them much faster.
- We call newOracle not oracle.New in Query, so that the
'needs' bitset isn't ignored (oops!). This makes the
non-PTA queries faster.
Also:
- removed vestigial timers junk.
- pos.go: existing position utilties split out into own file.
Added parsePosFlag utility.
- numerous cosmetic tweaks.
+ very basic tests.
To do in follow-ups:
- sophisticated editor integration of "what".
- better tests.
- refactoring of control flow as described in comment.
- changes to "implements", "describe" commands.
- update design doc + user manual.
R=crawshaw, dominik.honnef
CC=golang-dev, gri
https://golang.org/cl/40630043
Using a type containing a sync type directly
in a function call (whether as a receiver,
a param, or a return value) is an easy way
to accidentally copy a lock or other sync primitive.
Check for it.
The test as implemented does not provide 100%
coverage; see the discussion near the bottom of
testdata/copylock.go for shortcomings.
Fixesgolang/go#6729.
R=adg, r, dsymonds
CC=golang-dev
https://golang.org/cl/23420043
Split the profile parsing code out of cmd/cover into
a reusable package, to support third-party coverage
tools.
R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/36050045
Add explicit options to Corpus to control search indexing of documentation, Go source code, and full-text.
R=bradfitz, r
CC=golang-dev
https://golang.org/cl/24190043
- fixed a couple of TODOs
- various cleanups along the way
- adjusted clients
Once submitted, clients of go/types that don't explicitly
specify Config.Import will need to add the extra import:
import _ "code.google.com/p/go.tools/go/gcimporter"
to install the default (gc) importer in go/types.
R=adonovan, gri
CC=golang-dev
https://golang.org/cl/26390043
Performance increase is much smaller than expected;
need to investigate. Possibly, repeatedly (for each
line) accessing file sets from multiple goroutines
(in the scanner) is a bottle neck; or perhaps i/o.
R=adonovan
CC=golang-dev
https://golang.org/cl/23090043
The symbolic names such as NOSPLIT for annotations on the TEXT
directive appeared after vet started checking .s files. This CL tweaks
the regular expression to allow CAPITALS and the symbols | and +
as well as digits in that field, and interprets NOSPLIT as equivalent
to 7 in that field. All magic.
Fixesgolang/go#6695
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/18700044
This CL makes gotype usable again. Removed -r
(recursive) mode; use go/build to determine
the correct set of Go files when processing
a directory. The -v (verbose) mode now prints
some basic stats (duration, number of files,
lines, and lines/s).
Thoroughly restructured the code.
Applying gotype -v -a . to the go/types directory:
128.94141ms (40 files, 12008 lines, 93127 lines/s)
On a 2.8 GHz Quad-Core Intel Xeon, 800 MHz DDR2 FB-DIMM,
with go/types built with the (interal) debug flag set to
false. There's still quite a bit of room for performance
improvement in all parts of the code since no tuning has
been done.
R=golang-dev, adonovan
CC=golang-dev
https://golang.org/cl/19930043
This allows us to run/analyze multiple tests.
Also it causes the production code packages to be properly initialized.
Also:
- cmd/ssadump: improved usage message (add example;
incorporate LoadInitialPackages usage; explain how -run
finds main).
- pointer, oracle, ssa/interp: use CreateTestMainPackage.
- ssa/builder.go: remove 'rundefers' instruction from package init,
which no longer uses 'defer'.
R=gri
CC=golang-dev
https://golang.org/cl/15920047
A function such as this:
func one() (x int) {
defer func() { recover() }()
x = 1
panic("return")
}
that combines named return parameters (NRPs) with deferred calls
that call recover, may return non-zero values despite the
fact it doesn't even contain a return statement. (!)
This requires a change to the SSA API: all functions'
control-flow graphs now have a second entry point, called
Recover, which is the block at which control flow resumes
after a recovered panic. The Recover block simply loads the
NRPs and returns them.
As an optimization, most functions don't need a Recover block,
so it is omitted. In fact it is only needed for functions that
have NRPs and defer a call to another function that _may_ call
recover.
Dataflow analysis of SSA now requires extra work, since every
may-panic instruction has an implicit control-flow edge to
the Recover block. The only dataflow analysis so far implemented
is SSA renaming, for which we make the following simplifying
assumption: the Recover block only loads the NRPs and returns.
This means we don't really need to analyze it, we can just
skip the "lifting" of such NRPs. We also special-case the Recover
block in the dominance computation.
Rejected alternative approaches:
- Specifying a Recover block for every defer instruction (like a
traditional exception handler).
This seemed like excessive generality, since Go programs
only need the same degenerate form of Recover block.
- Adding an instruction to set the Recover block immediately
after the named return values are set up, so that dominance
can be computed without special-casing.
This didn't seem worth the effort.
Interpreter:
- This CL completely reimplements the panic/recover/
defer logic in the interpreter. It's clearer and simpler
and closer to the model in the spec.
- Some runtime panic messages have been changed to be closer
to gc's, since tests depend on it.
- The interpreter now requires that the runtime.runtimeError
type be part of the SSA program. This requires that clients
import this package prior to invoking the interpreter.
This in turn requires (Importer).ImportPackage(path string),
which this CL adds.
- All $GOROOT/test/recover{,1,2,3}.go tests are now passing.
NB, the bug described in coverage.go (defer/recover in a concatenated
init function) remains. Will be fixed in a follow-up.
Fixesgolang/go#6381
R=gri
CC=crawshaw, golang-dev
https://golang.org/cl/13844043
Break the basic block at the function literal. The code to do this analysis
was already there; this CL just factors it out more nicely and uses it in
one new place. Also adds a test.
Fixesgolang/go#6555.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/14601043
- removed support for nil constants from go/exact
- instead define a singleton Nil Object (the nil _value_)
- in assignments, follow more closely spec wording
(pending spec CL 14415043)
- removed use of goto in checker.unary
- cleanup around handling of isRepresentable for
constants, with better error messages
- fix missing checks in checker.convertUntyped
- added isTyped (== !isUntyped) and isInterface predicates
- fixed hasNil predicate: unsafe.Pointer also has nil
- adjusted ssa per adonovan
- implememted types.Implements (wrapper arounfd types.MissingMethod)
- use types.Implements in vet (and fix a bug)
R=adonovan, r
CC=golang-dev
https://golang.org/cl/14438052
Present the files in lexical order so the output is reproducible
and easier to navigate. Do a little type rearrangement to simplify
things while we're there.
R=adg
CC=golang-dev
https://golang.org/cl/14357043
The redirect.PrefixHandler redirects "/foo/" to "/foo", which is what
we want in most cases ("/cl/", "/change/", etc) but not here.
So wrap it with a handler that handles "/blog/" explictly.
R=dsymonds
CC=golang-dev
https://golang.org/cl/14326043
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
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
(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
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
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
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
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
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
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
+ 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
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
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
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
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
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
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
(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
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
+ 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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