Robert Griesemer [Wed, 21 Dec 2011 16:45:00 +0000 (08:45 -0800)]
go/doc: steps towards collecting methods of embedded types
No visible external changes yet. The current approach is
a stop-gap approach: For methods of anonymous fields to be
seen, the anonymous field's types must be exported.
Missing: computing the actual MethodDocs and displaying them.
(Depending on the operation mode of godoc, the input to go/doc
is a pre-filtered AST with all non-exported nodes removed. Non-
exported anonymous fields are not even seen by go/doc in this
case, and it is impossible to collect associated (even exported)
methods. A correct fix will require some more significant re-
engineering; AST filtering will have to happen later, possibly
inside go/doc.)
Russ Cox [Wed, 21 Dec 2011 12:47:12 +0000 (07:47 -0500)]
cmd/go: many improvements
* correct dependency calculations
* comment meaning of action fields
* new alias "std" like "all" but standard packages only
* add -o flag to 'go build'
* set up for parallel build (still serial)
* understand that import "C" depends on cgo, runtime/cgo
Mikio Hara [Wed, 21 Dec 2011 12:39:00 +0000 (21:39 +0900)]
net, syscall: interface address and mask
This CL makes both InterfaceAddrs and Addrs method on Interface
return IPNet struct for representing interface address and mask
like below:
interface "lo0": flags "up|loopback|multicast", ifindex 1, mtu 16384
interface address "fe80::1/64"
interface address "127.0.0.1/8"
interface address "::1/128"
joined group address "ff02::fb"
joined group address "224.0.0.251"
joined group address "ff02::2:65d0:d71e"
joined group address "224.0.0.1"
joined group address "ff01::1"
joined group address "ff02::1"
joined group address "ff02::1:ff00:1"
Russ Cox [Tue, 20 Dec 2011 21:42:44 +0000 (16:42 -0500)]
cmd/go: work toward build script
The commands in the standard tree are now named
by the pseudo-import paths cmd/gofmt etc.
This avoids ambiguity between cmd/go's directory
and go/token's parent directory.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5503050
Russ Cox [Tue, 20 Dec 2011 21:25:57 +0000 (16:25 -0500)]
gc: allow use of unsafe.Pointer in generated code
The functions we generate to implement == on structs
or arrays may need to refer to unsafe.Pointer even in
safe mode, in order to handle unexported fields contained
in other packages' structs.
Rob Pike [Tue, 20 Dec 2011 20:58:23 +0000 (12:58 -0800)]
template: better error message for empty templates
New("x").ParseFiles("y") can result in an empty "x" template.
Make the message clearer that this is the problem. The error
returns from both template packages in this case were
confusing.
I considered making the method use "x" instead of "y" in
this case, but that just made other situations confusing
and harder to explain.
Fixes #2594.
R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/5498048
Russ Cox [Tue, 20 Dec 2011 19:25:23 +0000 (14:25 -0500)]
go: build runtime/cgo
Also rename -v to -x in the build and install commands,
to match the flag in go test (which we can't change
because -v is taken). Matches sh -x anyway.
Robert Griesemer [Tue, 20 Dec 2011 17:59:09 +0000 (09:59 -0800)]
go/ast, parser: remember short variable decls. w/ correspoding ident objects
The ast.Object's Decl field pointed back to the corresponding declaration for
all but short variable declarations. Now remember corresponding assignment
statement in the Decl field.
Also: simplified some code for parsing select statements.
Rob Pike [Tue, 20 Dec 2011 17:51:39 +0000 (09:51 -0800)]
testing: allow benchmarks to print and fail
Refactors the benchmarks and test code.
Now benchmarks can call Errorf, Fail, etc.,
and the runner will act accordingly.
Because functionality has been folded into an
embedded type, a number of methods' docs
no longer appear in godoc output. A fix is
underway; if it doesn't happen fast enough,
I'll add wrapper methods to restore the
documentation.
Roger Peppe [Tue, 20 Dec 2011 17:25:47 +0000 (09:25 -0800)]
encoding/binary: add more benchmarks
Also add a byte count to the varint benchmarks - this
isn't accurate, of course, but it allows a rough comparison to
the other benchmarks.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5496070
Rémy Oudompheng [Mon, 19 Dec 2011 21:45:51 +0000 (16:45 -0500)]
strconv: implement faster parsing of decimal numbers.
The algorithm is the same as in the double-conversion library
which also implements Florian Loitsch's fast printing algorithm.
It uses extended floats with a 64-bit mantissa, but cannot give
an answer for all cases.
Russ Cox [Mon, 19 Dec 2011 20:51:13 +0000 (15:51 -0500)]
runtime: separate out auto-generated files, take 2
This is like the ill-fated CL 5493063 except that
I have written a shell script (autogen.sh) instead of
thinking I could possibly write a correct Makefile.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5496075
Rémy Oudompheng [Mon, 19 Dec 2011 20:32:06 +0000 (15:32 -0500)]
encoding/json: cleanup leftover variables in array decoding.
An old update for API changes in reflect package left several
helper variables that do not have a meaning anymore, and
the type checking of arrays vs slices was broken.
Fixes #2513.
Rémy Oudompheng [Mon, 19 Dec 2011 20:03:53 +0000 (15:03 -0500)]
strconv: reduce buffer size for multi-precision decimals.
The longest numbers we have to represent are the smallest denormals.
Their decimal mantissa is not longer than 5^1100. Taking into
account some extra size for in-place operations, 800 digits are
enough. This saves time used for zero intiialization of extra
bytes.
Christopher Nielsen [Mon, 19 Dec 2011 16:57:58 +0000 (03:57 +1100)]
syscall: Changes to the syscall package to support NetBSD.
Not all syscalls are implemented, but many are. On the suggestion
of Joel Sing <jsing@google.com>, the generated files were added
with hg add instead of hg cp, since they are generated on an OS
dependant basis.
Paul Sbarra [Sun, 18 Dec 2011 23:42:32 +0000 (10:42 +1100)]
vim: fix go filetype detection
The filetype needs to be set during BufRead in order for the did_filetype() check to prevent the file being detected as a conf file. One example where this can occur is if a cgo file has a #include at the top of the file. The # is detected in vim's generic configuration (conf file) toward the bottom of filetype.vim
Robert Griesemer [Fri, 16 Dec 2011 23:43:06 +0000 (15:43 -0800)]
go/printer, gofmt: fine tuning of line spacing
- no empty lines inside empty structs and interfaces
- top-level declarations are separated by a blank line if
a) they are of different kind (e.g. const vs type); or
b) there are documentation comments associated with a
declaration (this is new)
- applied gofmt -w misc src
The actual changes are in go/printer/nodes.go:397-400 (empty structs/interfaces),
and go/printer/printer.go:307-309 (extra line break). The remaining
changes are cleanups w/o changing the existing functionality.
Russ Cox [Fri, 16 Dec 2011 22:58:53 +0000 (17:58 -0500)]
runtime: fix build
I am looking forward to not supporting two build
systems simultaneously. Make complains about
a circular dependency still, but I don't understand it
and it's probably not worth the time to figure out.
Russ Cox [Fri, 16 Dec 2011 20:33:58 +0000 (15:33 -0500)]
runtime: make more build-friendly
Collapse the arch,os-specific directories into the main directory
by renaming xxx/foo.c to foo_xxx.c, and so on.
There are no substantial edits here, except to the Makefile.
The assumption is that the Go tool will #define GOOS_darwin
and GOARCH_amd64 and will make any file named something
like signals_darwin.h available as signals_GOOS.h during the
build. This replaces what used to be done with -I$(GOOS).
There is still work to be done to make runtime build with
standard tools, but this is a big step. After this we will have
to write a script to generate all the generated files so they
can be checked in (instead of generated during the build).