1
0
mirror of https://github.com/golang/go synced 2024-10-05 10:31:22 -06:00
Commit Graph

3187 Commits

Author SHA1 Message Date
Robert Griesemer
3fc327b33b go/scanner: 17% faster scanning
- Changed the Scan API semantics slightly:
The token literal string is only returned
if the token is a literal, comment, semicolon,
or illegal character. In all other cases, the
token literal value is determined by the token
value.

Clients that care about the token literal value
when not present can always use the following
piece of code:

pos, tok, lit := scanner.Scan()
if lit == "" {
   lit = tok.String()
}

- Changed token.Lookup API to use a string instead
of a []byte argument.

- Both these changes were long-standing TODOs.

- Added BenchmarkScan.

This change permits a faster implementation of Scan
with much fewer string creations:

benchmark                old ns/op    new ns/op    delta
scanner.BenchmarkScan        74404        61457  -17.40%

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5532076
2012-01-11 14:20:32 -08:00
Russ Cox
836a517f69 gc: fix inlining bug
Fixes #2682.

R=lvd
CC=golang-dev
https://golang.org/cl/5538043
2012-01-11 13:21:06 -08:00
Russ Cox
f2b51f564f cmd/go: change deadline to 10 minutes
1 minute is not enough for the slower builders.

R=adg
CC=golang-dev
https://golang.org/cl/5533068
2012-01-11 12:44:31 -08:00
Luuk van Dijk
feaa9ed10a gc: export nil literals without inferred type.
Fixes #2678

R=rsc
CC=golang-dev
https://golang.org/cl/5529066
2012-01-11 21:26:54 +01:00
Robert Griesemer
b8f76764cb go test: align "no test files" message
R=rsc
CC=golang-dev
https://golang.org/cl/5533070
2012-01-11 11:15:36 -08:00
Robert Griesemer
276f177b9c go/scanner: remove (exported) InsertSemis mode
This is a relic from the times when we switched
to automatic semicolon insertion. It's still use-
ful to have a non-exported switch for testing.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5528077
2012-01-11 10:06:44 -08:00
Dmitriy Vyukov
c7fdbeb6c1 cmd/go: fix test documentation
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5529067
2012-01-11 09:47:08 -08:00
Russ Cox
0c012af114 cmd/go: kill test.out after 1 minute
Will have to do better but this is enough to
stop the builders from hanging, I hope.

R=golang-dev, dsymonds, adg
CC=golang-dev
https://golang.org/cl/5533066
2012-01-10 21:01:58 -08:00
Russ Cox
091ef25a5e go: rely on exit code to tell if test passed
R=adg, dsymonds
CC=golang-dev
https://golang.org/cl/5532066
2012-01-10 20:13:02 -08:00
Russ Cox
4a6b07f235 gc: enable inlining by default
R=lvd, r
CC=golang-dev
https://golang.org/cl/5531058
2012-01-10 20:08:53 -08:00
Nigel Tao
415f15b667 image: rename image.Tiled to image.Repeated.
What package image currently provides is a larger image consisting
of many copies of a smaller image.

More generally, a tiled image could be a quilt consisting of different
smaller images (like Google Maps), or a technique to view a portion of
enormous images without requiring the whole thing in memory.

This richer construct might not ever belong in the standard library (and
is definitely out of scope for Go 1), but I would like the option for
image.Tiled to be its name.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5530062
2012-01-11 12:35:05 +11:00
Luuk van Dijk
97fd7d5f34 gc: inlining fixes
flag -l means: inlining on, -ll inline with early typecheck
-l lazily typechecks imports on use and re-export, nicer for debugging
-lm produces output suitable for errchk tests, repeated -mm... increases inl.c's verbosity
export processed constants, instead of originals
outparams get ->inlvar too, and initialized to zero
fix shared rlist bug, that lead to typecheck messing up the patched tree
properly handle non-method calls to methods T.meth(t, a...)
removed embryonic code to handle closures in inlined bodies
also inline calls inside closures (todo: move from phase 6b to 4)

Fixes #2579.

R=rsc
CC=golang-dev
https://golang.org/cl/5489106
2012-01-10 21:24:31 +01:00
Maxim Pimenov
800c49820a go: fix typo in comment
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5531060
2012-01-10 07:43:48 -08:00
Luuk van Dijk
a6c49098bc gc: Nicer errors before miscompiling.
This fixes issue 2444.

A big cleanup of all 31/32bit size boundaries i'll leave for another cl though.  (see also issue 1700).

R=rsc
CC=golang-dev
https://golang.org/cl/5484058
2012-01-10 11:19:22 +01:00
Luuk van Dijk
4bcc9c6b5e gc: disallow declaration of variables outside package.
Fixes #2231.

Declaring main.i in package main in the same way already triggers syntax errors.

R=rsc
CC=golang-dev
https://golang.org/cl/5483078
2012-01-10 11:18:56 +01:00
Luuk van Dijk
556258e57b gc: fix stray %#N in error message
Fixes #2639.

R=rsc
CC=bradfitz, golang-dev
https://golang.org/cl/5489140
2012-01-10 11:09:04 +01:00
Luuk van Dijk
ba25778f3f gc: omit runtime.closure wrap for closures without closure variables
Fixes #1894.

test/closure.go's test for newfunc already covers this.

R=rsc, dsymonds, bradfitz
CC=golang-dev
https://golang.org/cl/5516051
2012-01-10 11:07:35 +01:00
Mikio Hara
ad3e82e736 undo CL 5530063 / 1d7295fdf62e
runtime: enable runtime.ncpu on FreeBSD

««« original CL description
cmd/go: fix freebsd build

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5530063
»»»

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5531059
2012-01-10 16:11:31 +09:00
Mikio Hara
8cad9251b3 cmd/go: fix freebsd build
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5530063
2012-01-10 14:47:20 +09:00
Russ Cox
8d8829c671 cmd/go: add -p flag for parallelism (like make -j)
On my MacBookAir4,1:

19.94r 	 go install -a -p 1 std
12.36r 	 go install -a -p 2 std
9.76r 	 go install -a -p 3 std
10.77r 	 go install -a -p 4 std

86.57r 	 go test -p 1 std -short
52.69r 	 go test -p 2 std -short
43.75r 	 go test -p 3 std -short
40.44r 	 go test -p 4 std -short

157.50r 	 go test -p 1 std
99.58r 	 go test -p 2 std
87.24r 	 go test -p 3 std
80.18r 	 go test -p 4 std

R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/5531057
2012-01-09 21:06:31 -08:00
Russ Cox
146a703cd1 cmd/go: add -v flag to build and install
The -v flag prints the names of packages as they are built/installed.

Use -v in make.bash/run.bash to avoid a silent pause during
the build while Go code is being compiled.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5532055
2012-01-09 16:44:01 -08:00
Russ Cox
b8615a0931 go: add ... patterns in import path arguments
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5530058
2012-01-09 16:23:00 -08:00
Russ Cox
0ad241dd55 cmd/go: fix import directory list for compilation
This fixes the most annoying bug in the go command,
that 'go build' sometimes ignored packages it had just
rebuilt in favor of stale installed ones.

This part of the code needs more thought, but this small
change is an important improvement.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5531053
2012-01-09 15:38:07 -08:00
Luuk van Dijk
41806ec26d gc: remove now redundant typecheck of ->ninit on switches.
Fixes #2576.

R=rsc
CC=golang-dev
https://golang.org/cl/5498105
2012-01-09 21:42:24 +01:00
Ian Lance Taylor
900b8becb3 cgo: if value for constant did not parse, get it from DWARF info
R=rsc, borman
CC=golang-dev
https://golang.org/cl/5525043
2012-01-09 11:22:26 -08:00
Russ Cox
8a4bd094a0 undo CL 5504108 / 0edee03791f4
breaks 386 build

««« original CL description
gc: put limit on size of exported recursive interface

Prevents edge-case recursive types from consuming excessive memory.

Fixes #1909.

R=golang-dev, lvd, rsc
CC=golang-dev
https://golang.org/cl/5504108

»»»

R=lvd, lvd
CC=golang-dev
https://golang.org/cl/5534049
2012-01-09 09:45:08 -08:00
Lorenzo Stoakes
aa63a928ea gc: put limit on size of exported recursive interface
Prevents edge-case recursive types from consuming excessive memory.

Fixes #1909.

R=golang-dev, lvd, rsc
CC=golang-dev
https://golang.org/cl/5504108
2012-01-09 11:48:53 -05:00
Wei Guangjing
9569c67a6b windows: use ArbitraryUserPointer as TLS slot
R=hectorchu, alex.brainman
CC=golang-dev
https://golang.org/cl/5519054
2012-01-09 11:23:07 +11:00
Ryan Hitchman
a15448d65e gc: improve unsafe.Pointer type-check error messages
Fixes #2627.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5498088
2012-01-06 14:34:16 -08:00
Robert Hencke
a3baccefd6 various: fix prints
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5516049
2012-01-05 18:38:01 -08:00
Andrew Gerrand
2c459f14e9 goinstall: fix test data
R=gri
CC=golang-dev
https://golang.org/cl/5519048
2012-01-06 09:48:03 +11:00
Eric Eisner
fd1322828c cmd/go: Pass arguments to command for run
Command arguments are separated from input .go file arguments
by a -- separator.

R=rsc, golang-dev, adg
CC=golang-dev
https://golang.org/cl/5514046
2012-01-06 09:23:00 +11:00
Andrew Gerrand
c2ea412296 goinstall: use correct checkout URL for Google Code svn repos
Fixes #2655.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5510045
2012-01-06 09:20:59 +11:00
Roger Peppe
5f5a7eb4bc go test: don't try to print package with error message.
If there's a error compiling a _test.go file, the error
message tries to print a *Package with %s. There's no String
method on *Package, so the error message looks bad.
Since the error messages identify the file in question
anyway, this CL removes the package from the error message.

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5520045
2012-01-05 13:19:25 -08:00
Sanjay Menakuru
2693232f16 cmd/go: include external test files in the files sent to gofmt, govet, and gofix
Also, add XTestGoFiles to the go command's public api.

Fixes #2649.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5502102
2012-01-05 10:37:15 +11:00
Sanjay Menakuru
7ccd505dc4 cmd/go: include test files in the files sent to gofmt, govet, and gofix
Also, add TestGoFiles to the go command's public api.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5505083
2012-01-03 14:12:54 +11:00
Christoph Hack
a274798d6e cmd/go: refer to the right command in the doc description.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5501072
2012-01-03 12:06:12 +11:00
Benny Siegert
8e9e75f008 gotest: make _testmain.go conform to gofmt rules
Otherwise, running "gofmt -d ." after "gotest" gives some
spurious changes.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5504101
2012-01-03 12:00:39 +11:00
David Symonds
57c9bb4a07 testing: use flag.Duration for -timeout flag.
R=golang-dev, gustavo, r
CC=golang-dev
https://golang.org/cl/5498077
2011-12-25 16:07:05 +11:00
Russ Cox
eef7184046 cmd/go: two testing fixes
1. Show passing output for "go test" (no args) and with -v flag.
2. Warn about out-of-date packages being rebuilt.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5504080
2011-12-22 22:24:43 -05:00
Andrew Gerrand
e8ae29588d cmd/go: update "go help remote" to use correct Google Code urls
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5489114
2011-12-23 14:09:44 +11:00
Robert Griesemer
198936f2b8 go/doc, godoc: move export filtering into go/doc
- exports.go contains a stripped-down (but semantically unchanged)
  version of the code in go/ast/filter.go for export filtering
- filter.go contains the documentation filtering code found before
  at the end of doc.go; this is simply a code move w/o any semantic
  changes
- godoc now relies on go/doc for export filtering when creating
  documentation. It still has a separate form of export filtering
  for showing the source code version. This needs to be consolidated
  (perhaps the source form view should just be removed?).
- Stripping of function bodies (stripFunctionBodies function of
  godoc.go) is now happening in doc.go (line 176).
- doc.NewPackageDoc has an extra parameter "exportsOnly. If set
  to false, the behavior is as before. This function is only called
  once in our source code; a gofix module is probably not warranted.
- Deleted doc.NewFileDoc - was never called.

This change is mostly a code move w/ some minimal tweaks. It should
not cause any changes to the behavior of godoc. It's a prerequisite
for extracting anonymous embedded fields.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5502072
2011-12-22 15:28:15 -08:00
Luuk van Dijk
86deacc0bc gc: better linenumbers for inlined functions
Fixes #2580 up to a point.

R=rsc
CC=golang-dev
https://golang.org/cl/5498068
2011-12-22 17:31:54 +01:00
Mikio Hara
98fe44bdfc cmd/go: fix windows build
R=golang-dev, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/5502066
2011-12-23 00:14:59 +09:00
Mikio Hara
e636f6f51c cmd/gc: make sure use of pthread for gcc-4.5 and beyond
R=golang-dev, rsc, n13m3y3r, rogpeppe
CC=golang-dev
https://golang.org/cl/5501060
2011-12-22 23:18:34 +09:00
Russ Cox
0509727b0d build: fixes for Windows
* work around a linker/cgo bug
* do not run deps.bash on Windows unless we need it
  (cuts a full minute off the build time)
* add windows to the list of cgo-enabled targets

The gopack problem is issue 2601.

R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5504062
2011-12-21 15:57:47 -05:00
Russ Cox
25c8014ed9 cmd/go: respect $GCFLAGS
R=lvd
CC=golang-dev
https://golang.org/cl/5500060
2011-12-21 09:04:34 -05:00
Russ Cox
f52a2088ef go/build: add new +build tags 'cgo' and 'nocgo'
This lets us mark net's cgo_stub.go as only to be
built when cgo is disabled.

R=golang-dev, ality, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5489100
2011-12-21 08:51:18 -05:00
Roger Peppe
43b8f68c3f cmd/go: use spaces consistently in help message
R=rsc
CC=golang-dev
https://golang.org/cl/5501053
2011-12-21 08:25:31 -05:00
Russ Cox
0fcb24b91c cmd/go: fix build (piece of 5489100 leaked in to last checkin)
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5489102
2011-12-21 08:05:04 -05:00
Russ Cox
8f5f347e2c 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

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5502055
2011-12-21 07:47:12 -05:00
Mikio Hara
16a2d2617f cmd/go: avoid infinite loop with package specific flags
R=rsc
CC=golang-dev
https://golang.org/cl/5505053
2011-12-21 21:20:17 +09:00
Alex Brainman
a462816753 build: multiple fixes to make "go install" work on windows
R=rsc
CC=golang-dev
https://golang.org/cl/5502054
2011-12-21 16:57:44 +11:00
Nigel Tao
d13ce8115d image/ycbcr: move the Y'CbCr types into image and image/color.
R=r, rsc
CC=golang-dev
https://golang.org/cl/5493084
2011-12-21 10:29:21 +11:00
Russ Cox
fd1c1b9679 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
2011-12-20 16:42:44 -05:00
Russ Cox
82a6a4f39e 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.

R=ken2
CC=golang-dev
https://golang.org/cl/5505046
2011-12-20 16:25:57 -05:00
Russ Cox
54fb9940cf 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.

R=r, iant, ality
CC=golang-dev
https://golang.org/cl/5504045
2011-12-20 14:25:23 -05:00
Maxim Pimenov
7be6229f9f cgo: support export for built-in types
This change doesn't pay attention to structs
so they still cannot be exported, see Issue 2552.

Fixes #2462.

R=dvyukov, rsc, iant
CC=golang-dev
https://golang.org/cl/5487058
2011-12-20 09:28:45 -08:00
Russ Cox
a1198fcc03 go: build runtime
R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/5495068
2011-12-20 10:28:04 -05:00
Joel Sing
5842f7e46a 5l/6l/8l: add support for netbsd signature note section
R=m4dh4tt3r, jsing, rsc
CC=golang-dev
https://golang.org/cl/5493068
2011-12-20 12:25:06 +11:00
Russ Cox
1d0f93b4be gc: avoid unsafe in defn of package runtime
Keeps -u tracking simple.

R=ken2
CC=golang-dev
https://golang.org/cl/5495094
2011-12-19 15:52:15 -05:00
Russ Cox
55889409f8 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
2011-12-19 15:51:13 -05:00
Andrew Gerrand
76a0783321 goinstall: only suggest -fix for bad imports when appropriate
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5495073
2011-12-17 13:14:59 +11:00
Russ Cox
86dcc431e9 runtime: hg revert -r 6ec0a5c12d75
That was the last build that was close to working.
I will try that change again next week.
Make is being very subtle today.

At the reverted-to CL, the ARM traceback appears
to be broken.  I'll look into that next week too.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5492063
2011-12-16 18:50:40 -05:00
Robert Griesemer
541b67d051 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.

Fixes issue  2570.

R=rsc
CC=golang-dev
https://golang.org/cl/5493057
2011-12-16 15:43:06 -08:00
Russ Cox
bd9243da22 runtime: separate out auto-generated files
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/5493063
2011-12-16 17:04:32 -05:00
Maxim Pimenov
bf6dd2db04 various: use $GCFLAGS and $GCIMPORTS like Make does
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5489065
2011-12-16 11:31:39 -05:00
Russ Cox
20090df70f go: implement test command
Gotest tries to build things, for which it invokes make,
and it was too hard to coordinate go invoking gotest
invoking go to build the test binary, so put all the code
here instead.  Gotest will be deleted once we switch.

The only code that really made sense to copy verbatim
was the flag parsing.

This remains a work in progress.  There are still plenty
of things to clean up and make better, but this is a good
checkpoint.  It can run all the tests in the tree (except
runtime, which it can't build yet).

$ go test all -short
ok  	archive/tar
ok  	archive/zip
ok  	bufio
?   	builtin [no test files]
ok  	bytes
ok  	compress/bzip2
ok  	compress/flate
ok  	compress/gzip
ok  	compress/lzw
ok  	compress/zlib
ok  	container/heap
ok  	container/list
ok  	container/ring
?   	crypto [no test files]
ok  	crypto/aes
ok  	crypto/bcrypt
ok  	crypto/blowfish
ok  	crypto/cast5
ok  	crypto/cipher
ok  	crypto/des
ok  	crypto/dsa
ok  	crypto/ecdsa
ok  	crypto/elliptic
ok  	crypto/hmac
ok  	crypto/md4
ok  	crypto/md5
ok  	crypto/ocsp
ok  	crypto/openpgp
ok  	crypto/openpgp/armor
ok  	crypto/openpgp/elgamal
?   	crypto/openpgp/error [no test files]
ok  	crypto/openpgp/packet
ok  	crypto/openpgp/s2k
ok  	crypto/rand
ok  	crypto/rc4
ok  	crypto/ripemd160
ok  	crypto/rsa
ok  	crypto/sha1
ok  	crypto/sha256
ok  	crypto/sha512
ok  	crypto/subtle
ok  	crypto/tls
ok  	crypto/twofish
ok  	crypto/x509
?   	crypto/x509/pkix [no test files]
ok  	crypto/xtea
ok  	debug/dwarf
ok  	debug/elf
ok  	debug/gosym
ok  	debug/macho
ok  	debug/pe
ok  	encoding/ascii85
ok  	encoding/asn1
ok  	encoding/base32
ok  	encoding/base64
ok  	encoding/binary
ok  	encoding/csv
ok  	encoding/git85
ok  	encoding/gob
ok  	encoding/hex
ok  	encoding/json
ok  	encoding/pem
ok  	encoding/xml
ok  	errors
ok  	exp/ebnf
?   	exp/ebnflint [no test files]
ok  	exp/gotype
ok  	exp/norm
ok  	exp/spdy
ok  	exp/sql
ok  	exp/sql/driver
ok  	exp/ssh
ok  	exp/types
ok  	expvar
ok  	flag
ok  	fmt
ok  	go/ast
ok  	go/build
ok  	go/doc
ok  	go/parser
ok  	go/printer
ok  	go/scanner
ok  	go/token
?   	hash [no test files]
ok  	hash/adler32
ok  	hash/crc32
ok  	hash/crc64
ok  	hash/fnv
ok  	html
ok  	html/template
ok  	image
?   	image/bmp [no test files]
?   	image/color [no test files]
ok  	image/draw
?   	image/gif [no test files]
ok  	image/jpeg
ok  	image/png
ok  	image/tiff
ok  	image/ycbcr
ok  	index/suffixarray
ok  	io
ok  	io/ioutil
ok  	log
ok  	log/syslog
ok  	math
ok  	math/big
ok  	math/cmplx
ok  	math/rand
ok  	mime
ok  	mime/multipart
ok  	net
?   	net/dict [no test files]
ok  	net/http
ok  	net/http/cgi
ok  	net/http/fcgi
?   	net/http/httptest [no test files]
ok  	net/http/httputil
?   	net/http/pprof [no test files]
ok  	net/mail
ok  	net/rpc
ok  	net/rpc/jsonrpc
ok  	net/smtp
ok  	net/textproto
ok  	net/url
ok  	old/netchan
ok  	old/regexp
ok  	old/template
ok  	os
ok  	os/exec
ok  	os/signal
ok  	os/user
ok  	patch
ok  	path
ok  	path/filepath
ok  	reflect
ok  	regexp
ok  	regexp/syntax
# cd /Users/rsc/g/go/src/pkg/runtime; 6g -o /var/folders/mw/qfnx8hhd1_s9mm9wtbng0hw80000gn/T/go-build874847916/runtime_test/_obj/_go_.6 -p runtime_test -I /var/folders/mw/qfnx8hhd1_s9mm9wtbng0hw80000gn/T/go-build874847916 append_test.go chan_test.go closure_test.go gc_test.go mfinal_test.go proc_test.go sema_test.go softfloat64_test.go symtab_test.go
proc_test.go:87: undefined: runtime.Entersyscall
proc_test.go:88: undefined: runtime.Exitsyscall
proc_test.go:111: undefined: runtime.Entersyscall
proc_test.go:116: undefined: runtime.Exitsyscall
softfloat64_test.go:79: undefined: Fadd64
softfloat64_test.go:80: undefined: Fsub64
softfloat64_test.go:82: undefined: Fmul64
softfloat64_test.go:83: undefined: Fdiv64
softfloat64_test.go:94: undefined: F64to32
softfloat64_test.go:99: undefined: F32to64
softfloat64_test.go:99: too many errors

exit status 1
FAIL	runtime [build failed]
?   	runtime/cgo [no test files]
ok  	runtime/debug
ok  	runtime/pprof
ok  	sort
ok  	strconv
ok  	strings
ok  	sync
ok  	sync/atomic
?   	syscall [no test files]
?   	testing [no test files]
?   	testing/iotest [no test files]
ok  	testing/quick
ok  	testing/script
ok  	text/scanner
ok  	text/tabwriter
ok  	text/template
ok  	text/template/parse
ok  	time
ok  	unicode
ok  	unicode/utf16
ok  	unicode/utf8
?   	unsafe [no test files]
ok  	websocket
$

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5495055
2011-12-15 23:51:04 -05:00
Alex Brainman
2da651f115 ld: allow for IMAGE_REL_AMD64_ADDR32NB relocation type
enable cgo again on windows/amd64

R=rsc, vcc.163
CC=golang-dev
https://golang.org/cl/5488074
2011-12-16 10:32:14 +11:00
Rob Pike
197eb8f7c3 govet: add checking for printf verbs
Also fix the errors it catches.

Fixes #1654.

R=rsc
CC=golang-dev
https://golang.org/cl/5489060
2011-12-15 15:17:52 -08:00
Volker Dobler
cb7d6e37d8 godoc: Allow examples for methods.
An example for a method M() of type T can be written as
func ExampleT_M() { ... }.
To differentiate between multiple examples for one function, type or
method a suffix with a lowercase start may be appended to the name
of the example function, e.g. ExampleFoo_basicUsage.

Fixes #2465.

R=golang-dev, adg, r, rsc, duperray.olivier, r
CC=golang-dev
https://golang.org/cl/5440100
2011-12-16 10:01:54 +11:00
Robert Griesemer
9f65e99ad4 go/printer, gofmt: don't write too many newlines
In some rare cases, gofmt would accept more than the maximum
number of empty lines (1) between source code snippets.

The actual change is in printer.go, lines 773-775; the rest
is some minor restructuring.

Applied gofmt -w src misc .

Fixes #2387.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5496047
2011-12-15 13:51:47 -08:00
Rob Pike
b618f32687 govet: divide the program into one file per vetting suite
Just a rearrangement except for a couple of new functions
and names so govet.go can have all the generic walk routines.

R=rsc
CC=golang-dev
https://golang.org/cl/5489058
2011-12-15 13:44:35 -08:00
Russ Cox
143f3b38f5 go: help messages for 'go test'
The plan is to make 'go test' replace gotest entirely, so it
cannot refer to gotest's godoc.  Instead, copy gotest's
documentation in as three different help messages:
'go help test', 'go help testflag', and 'go help testfunc'.

R=r
CC=golang-dev
https://golang.org/cl/5491048
2011-12-15 13:54:19 -05:00
Russ Cox
fd1f10966d more tags for go/build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5490047
2011-12-15 13:35:59 -05:00
Luuk van Dijk
7e6890a670 gc: inlining, allow empty bodies, fix _ arguments.
R=rsc
CC=golang-dev
https://golang.org/cl/5487077
2011-12-15 17:50:59 +01:00
Luuk van Dijk
5b2f8d96ce gc: omit argument names from function types in error messages
Fixes #2563

R=rsc
CC=golang-dev
https://golang.org/cl/5495047
2011-12-15 17:38:47 +01:00
Luuk van Dijk
9bf3478658 gc: better loopdepth analysis for labels
This avoids degraded performance caused by extra labels
emitted by inlining (breaking strconv ftoa alloc count unittest) and is better in any case.

R=rsc
CC=golang-dev
https://golang.org/cl/5483071
2011-12-15 17:35:59 +01:00
Russ Cox
17264df112 gc: implement and test \r in raw strings
For issue 680.

R=ken2
CC=golang-dev
https://golang.org/cl/5492046
2011-12-15 10:47:09 -05:00
Russ Cox
2ad8a9c507 go: implement build, install, run
clean is gone; all the intermediate files are created
in a temporary tree that is wiped when the command ends.

Not using go/build's Script because it is not well aligned
with this API.  The various builder methods are copied from
go/build and adapted.  Probably once we delete goinstall
we can delete the Script API too.

R=rogpeppe, adg, adg
CC=golang-dev
https://golang.org/cl/5483069
2011-12-14 22:42:42 -05:00
Rémy Oudompheng
076ebed0d8 cgo: add basic gccgo support.
R=rsc, iant
CC=golang-dev, remy
https://golang.org/cl/5485070
2011-12-14 15:40:35 -08:00
Anthony Martin
d89b7173c2 5c, 6c, 8c: support 64-bit switch value
For real this time. :-)

R=rsc, ken
CC=golang-dev
https://golang.org/cl/5486061
2011-12-14 17:30:40 -05:00
Robert Hencke
78821616d6 gotest: use build.DefaultContext.GOARCH
Fixes https://golang.org/cl/5480060/#msg4

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5485051
2011-12-14 11:21:30 -08:00
Luuk van Dijk
e14d1d7e41 gc: use inferred type rather than original one when reporting non-assignability.
Fixes #2451

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5372105
2011-12-14 17:34:35 +01:00
Luuk van Dijk
1f6d130b14 gc: add forgotten typecheck in a lonely corner of sinit
Fixes #2549

R=rsc
CC=golang-dev
https://golang.org/cl/5484060
2011-12-14 15:54:10 +01:00
Luuk van Dijk
a62722bba4 gc: inlining (disabled without -l)
Cross- and intra package inlining of single assignments or return <expression>.
Minus some hairy cases, currently including other calls, expressions with closures and ... arguments.

R=rsc, rogpeppe, adg, gri
CC=golang-dev
https://golang.org/cl/5400043
2011-12-14 15:05:33 +01:00
Luuk van Dijk
3c638f2892 gc: Use %#F in error messages instead of %F.
Fixes #2520

R=rsc
CC=golang-dev
https://golang.org/cl/5482056
2011-12-14 08:22:36 +01:00
Luuk van Dijk
6a401339c1 gc: suppress non-root cause message for bad receivers.
Fixed issue 2500

R=rsc
CC=golang-dev
https://golang.org/cl/5485053
2011-12-14 08:21:37 +01:00
Russ Cox
c8a5f8841c undo CL 5485063 / 21595dc0395a
breaks 64-bit build

««« original CL description
8c: handle 64-bit switch value
Cases must still be 32-bit values, but one thing at a time.

R=ality, ken2, ken
CC=golang-dev
https://golang.org/cl/5485063
»»»

R=ken2
CC=golang-dev
https://golang.org/cl/5488075
2011-12-14 00:46:07 -05:00
Russ Cox
6481e37d28 8c: handle 64-bit switch value
Cases must still be 32-bit values, but one thing at a time.

R=ality, ken2, ken
CC=golang-dev
https://golang.org/cl/5485063
2011-12-14 00:08:38 -05:00
Robert Griesemer
fe746335aa gofmt: simplify flags
-tabs replaces -tabindent
-spaces has been removed

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/5487066
2011-12-13 14:03:25 -08:00
Andrew Gerrand
0b0a6ec7ec gofix: add googlecode module for rewriting Google Code imports
goinstall: disallow googlecode.com import paths

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5421049
2011-12-14 08:46:26 +11:00
Yasuhiro Matsumoto
19d064f68a gofix: add fix httputil
R=r, rsc, adg
CC=golang-dev
https://golang.org/cl/5364056
2011-12-13 16:23:06 -05:00
Russ Cox
6e2c3ef428 go: implement doc, fmt, fix, list, vet
This CL is concerned with the basic Package structure
and applies it to the (trivial) implementations of the
doc, fmt, fix, list, and vet commands.

The command as a whole is still very much a work in progress.
In particular, work making the error messages look nice
is deferred to a future CL.

R=golang-dev, adg, dsymonds, r
CC=golang-dev
https://golang.org/cl/5482048
2011-12-13 14:28:41 -05:00
Russ Cox
c0951e9f8b 5g: fix build
R=ken2
CC=golang-dev
https://golang.org/cl/5482059
2011-12-13 14:12:16 -05:00
Russ Cox
6bf84214c1 godoc: text wrapping
Example:

PACKAGE

package utf8
    import "unicode/utf8"

    Package utf8 implements functions and constants to support text
    encoded in UTF-8.  This package calls a Unicode character a rune for
    brevity.

CONSTANTS

const (
    RuneError = unicode.ReplacementChar // the "error" Rune or "replacement character".
    RuneSelf  = 0x80                    // characters below Runeself are represented as themselves in a single byte.
    UTFMax    = 4                       // maximum number of bytes of a UTF-8 encoded Unicode character.
)
    Numbers fundamental to the encoding.

FUNCTIONS

func DecodeLastRune(p []byte) (r rune, size int)
    DecodeLastRune unpacks the last UTF-8 encoding in p and returns the
    rune and its width in bytes.

func DecodeLastRuneInString(s string) (r rune, size int)
    DecodeLastRuneInString is like DecodeLastRune but its input is a
    string.

func DecodeRune(p []byte) (r rune, size int)
    DecodeRune unpacks the first UTF-8 encoding in p and returns the rune
    and its width in bytes.

func DecodeRuneInString(s string) (r rune, size int)
    DecodeRuneInString is like DecodeRune but its input is a string.

func EncodeRune(p []byte, r rune) int
    EncodeRune writes into p (which must be large enough) the UTF-8
    encoding of the rune.  It returns the number of bytes written.

func FullRune(p []byte) bool
    FullRune reports whether the bytes in p begin with a full UTF-8
    encoding of a rune.  An invalid encoding is considered a full Rune
    since it will convert as a width-1 error rune.

func FullRuneInString(s string) bool
    FullRuneInString is like FullRune but its input is a string.

func RuneCount(p []byte) int
    RuneCount returns the number of runes in p.  Erroneous and short
    encodings are treated as single runes of width 1 byte.

func RuneCountInString(s string) (n int)
    RuneCountInString is like RuneCount but its input is a string.

func RuneLen(r rune) int
    RuneLen returns the number of bytes required to encode the rune.

func RuneStart(b byte) bool
    RuneStart reports whether the byte could be the first byte of an
    encoded rune.  Second and subsequent bytes always have the top two
    bits set to 10.

func Valid(p []byte) bool
    Valid reports whether p consists entirely of valid UTF-8-encoded
    runes.

func ValidString(s string) bool
    ValidString reports whether s consists entirely of valid UTF-8-encoded
    runes.

TYPES

type String struct {
    // contains filtered or unexported fields
}
    String wraps a regular string with a small structure that provides
    more efficient indexing by code point index, as opposed to byte index.
    Scanning incrementally forwards or backwards is O(1) per index
    operation (although not as fast a range clause going forwards).
    Random access is O(N) in the length of the string, but the overhead is
    less than always scanning from the beginning.  If the string is ASCII,
    random access is O(1).  Unlike the built-in string type, String has
    internal mutable state and is not thread-safe.

func NewString(contents string) *String
    NewString returns a new UTF-8 string with the provided contents.

func (s *String) At(i int) rune
    At returns the rune with index i in the String.  The sequence of runes
    is the same as iterating over the contents with a "for range" clause.

func (s *String) Init(contents string) *String
    Init initializes an existing String to hold the provided contents.
    It returns a pointer to the initialized String.

func (s *String) IsASCII() bool
    IsASCII returns a boolean indicating whether the String contains only
    ASCII bytes.

func (s *String) RuneCount() int
    RuneCount returns the number of runes (Unicode code points) in the
    String.

func (s *String) Slice(i, j int) string
    Slice returns the string sliced at rune positions [i:j].

func (s *String) String() string
    String returns the contents of the String.  This method also means the
    String is directly printable by fmt.Print.

Fixes #2479.

R=golang-dev, dsymonds, mattn.jp, r, gri, r
CC=golang-dev
https://golang.org/cl/5472051
2011-12-13 13:33:40 -05:00
Russ Cox
61655bc513 gc: delete DUPOK definition
The relevant header is already included.

R=ken2
CC=golang-dev
https://golang.org/cl/5487062
2011-12-13 13:25:48 -05:00
Luuk van Dijk
7cf4825425 gc: small fixes to fmt.c
don't crash when printing error messages about symbols in a garbled state.
render OCOMPLIT in export mode.

R=rsc
CC=golang-dev
https://golang.org/cl/5466045
2011-12-13 09:15:46 +01:00
Luuk van Dijk
e1b1a5fea2 gc: fix use of stackallocated AST node in generation of static initialisation code.
Fixes #2529

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5483048
2011-12-13 09:09:10 +01:00
Russ Cox
196b663075 gc: implement == on structs and arrays
To allow these types as map keys, we must fill in
equal and hash functions in their algorithm tables.
Structs or arrays that are "just memory", like [2]int,
can and do continue to use the AMEM algorithm.
Structs or arrays that contain special values like
strings or interface values use generated functions
for both equal and hash.

The runtime helper func runtime.equal(t, x, y) bool handles
the general equality case for x == y and calls out to
the equal implementation in the algorithm table.

For short values (<= 4 struct fields or array elements),
the sequence of elementwise comparisons is inlined
instead of calling runtime.equal.

R=ken, mpimenov
CC=golang-dev
https://golang.org/cl/5451105
2011-12-12 22:22:09 -05:00
David Symonds
3dbecd592b various: a grab-bag of time.Duration cleanups.
R=adg, r, rsc
CC=golang-dev
https://golang.org/cl/5475069
2011-12-13 10:42:56 +11:00
Christoph Hack
ecf4a9216e godoc: added an opensearch description document.
R=golang-dev, r, tux21b, rsc
CC=golang-dev
https://golang.org/cl/5479062
2011-12-12 18:01:06 -05:00
Lucio De Re
0f4f3c6769 gc: avoid 0-length C array
R=golang-dev, ality
CC=golang-dev, rsc
https://golang.org/cl/5467066
2011-12-12 16:25:31 -05:00
Rémy Oudompheng
d7634ad7d9 gc: fix wrong arguments to error message for switches.
Fixes #2502.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5472062
2011-12-12 16:08:32 -05:00
Christopher Nielsen
420fe22921 ld/6l/8l: First pass at changes to the linker to support NetBSD binaries.
This will not currently create valid NetBSD binaries because NetBSD requires
an ELF note section to run, otherwise the kernel will throw ENOEXEC. I was
unable to determine an elegant way to add the section, so I am submitting
what I have.

References:
http://www.netbsd.org/docs/kernel/elf-notes.html
http://mail-index.netbsd.org/netbsd-bugs/2001/08/03/0012.html

R=rsc
CC=golang-dev
https://golang.org/cl/5472049
2011-12-12 15:42:11 -05:00
Christopher Nielsen
728c16cf13 build: Changes to the build infrastructure for NetBSD.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5476048
2011-12-12 15:42:06 -05:00
Lucio De Re
d56ca13c03 gc: add varargck for %lN
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/5476049
2011-12-12 15:42:02 -05:00
Russ Cox
ecda0fa5d4 gc: allow colon in //line file name
Assume last colon introduces line number.

Fixes #2543.

R=ken2
CC=golang-dev
https://golang.org/cl/5485047
2011-12-12 15:41:54 -05:00
Robert Hencke
d8d321068b gotest: use build.ArchChar()
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5480060
2011-12-10 14:42:29 -08:00
Russ Cox
1cb7f85d74 gc: 0 expected bugs
Now that Luuk's qualified exporting code
is in, fixing this bug is trivial.

R=ken2
CC=golang-dev
https://golang.org/cl/5479048
2011-12-09 14:58:28 -05:00
Russ Cox
8c0b699ca4 gc: fix another blank bug
R=ken2
CC=golang-dev
https://golang.org/cl/5478051
2011-12-09 11:59:21 -05:00
Russ Cox
e77f057bf3 gc: resolve built-ins to built-in symbol
R=lvd
CC=golang-dev
https://golang.org/cl/5480049
2011-12-09 08:28:17 -05:00
Russ Cox
fc128403dc gc: minor changes for inlining
Copied from 5400043 since they stand alone from inlining.

R=lvd
CC=golang-dev
https://golang.org/cl/5479046
2011-12-09 08:03:51 -05:00
Russ Cox
012798a325 gc: rune is now an alias for int32
R=ken2
CC=golang-dev
https://golang.org/cl/5467049
2011-12-09 00:12:07 -05:00
Russ Cox
2ab9bb6aaf gc: fix export of '\'' and '\\' constants
Fixes Windows build.

R=ken2
CC=golang-dev
https://golang.org/cl/5472046
2011-12-08 22:43:31 -05:00
Russ Cox
a250f37cbc update tree for new default type rule
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5448091
2011-12-08 22:08:03 -05:00
Russ Cox
be0ffbfd02 gc: implement character constant type rules
R=ken2
CC=golang-dev
https://golang.org/cl/5444054
2011-12-08 22:07:43 -05:00
Russ Cox
f00340f022 gc: rename %union field name from lint to i
#define lint has special meaning to Bison;
having a field named lint conflicts with that.

R=ken2
CC=golang-dev
https://golang.org/cl/5462044
2011-12-07 23:38:32 -05:00
Rémy Oudompheng
4349effb15 gc: keep pointer to original node in constant rewrites.
This allows printing meaningful expressions in error messages
instead of evaluated constants.
Fixes #2276.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5432082
2011-12-07 16:18:50 -05:00
Russ Cox
5e98505ba7 gc: fix spurious typecheck loop in &composite literal
Fixes #2538.

R=ken2
CC=golang-dev
https://golang.org/cl/5449114
2011-12-07 15:48:55 -05:00
Scott Lawrence
a2ba34d374 ld: fix memory leaks
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5434068
2011-12-07 11:50:39 -05:00
Rémy Oudompheng
0c64972dd1 gc: more accurate description of -w and -W switches.
The -w switch actually prints steps of the syntax tree walks
while -W prints a summary before and after the walk.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5444049
2011-12-07 11:45:30 -05:00
Dmitriy Vyukov
428062da4e ld: increase default stack size on Windows for cgo
Fixes #2437.

R=rsc, hectorchu, mattn.jp, alex.brainman, jdpoirier, snaury, n13m3y3r
CC=golang-dev
https://golang.org/cl/5371049
2011-12-07 16:53:17 +03:00
Andrew Gerrand
2c7a84a95b goinstall: honour -install=false flag when -make=true
R=rsc
CC=golang-dev
https://golang.org/cl/5448124
2011-12-07 09:41:20 +11:00
Maxim Pimenov
972b98c135 cgo: fix typo in the documentation
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5448115
2011-12-06 08:16:39 -08:00
Russ Cox
46deaa297b gc: disallow map/func equality via interface comparison
Missed when I removed direct map/func equality.

R=ken2
CC=golang-dev
https://golang.org/cl/5452052
2011-12-06 10:48:17 -05:00
Russ Cox
4feafeeea0 gofix: fix for strconv API change
R=golang-dev, gri, adg, r
CC=golang-dev
https://golang.org/cl/5434098
2011-12-05 15:52:35 -05:00
Russ Cox
2666b815a3 use new strconv API
All but 3 cases (in gcimporter.go and hixie.go)
are automatic conversions using gofix.

No attempt is made to use the new Append functions
even though there are definitely opportunities.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5447069
2011-12-05 15:48:46 -05:00
Luuk van Dijk
40b2fe004f gc: changes in export format in preparation of inlining.
Includes minimal change to gcimporter to keep it working,

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5431046
2011-12-05 14:40:19 -05:00
Russ Cox
5cb1c82d96 gc: remove type elision in struct literals
R=ken2
CC=golang-dev
https://golang.org/cl/5437136
2011-12-05 14:22:41 -05:00
Russ Cox
b9ccd077dc runtime: prep for type-specific algorithms
Equality on structs will require arbitrary code for type equality,
so change algorithm in type data from uint8 to table pointer.
In the process, trim top-level map structure from
104/80 bytes (64-bit/32-bit) to 24/12.

Equality on structs will require being able to call code generated
by the Go compiler, and C code has no way to access Go return
values, so change the hash and equal algorithm functions to take
a pointer to a result instead of returning the result.

R=ken
CC=golang-dev
https://golang.org/cl/5453043
2011-12-05 09:40:22 -05:00
Russ Cox
214ec7b547 gc: fix build (not sure how this edit got lost)
R=ken2, ken
CC=golang-dev
https://golang.org/cl/5449072
2011-12-02 15:05:45 -05:00
Russ Cox
7a42dddbe6 gc: fix line number for redundant print
R=ken2
CC=golang-dev
https://golang.org/cl/5434111
2011-12-02 14:58:26 -05:00
Russ Cox
434a6c85cb gc: use gofmt spacing when printing map type
R=ken2
CC=golang-dev
https://golang.org/cl/5450071
2011-12-02 14:45:07 -05:00
Russ Cox
dcf1d7bc0e gofmt -s misc src
R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/5451079
2011-12-02 14:14:25 -05:00
Russ Cox
0dab624b70 gofmt: handle &T in composite literal simplify
R=gri
CC=golang-dev
https://golang.org/cl/5448086
2011-12-02 14:14:04 -05:00
Russ Cox
7dc9d8c72b gc: composite literals as per Go 1
R=ken2
CC=golang-dev
https://golang.org/cl/5450067
2011-12-02 14:13:12 -05:00
Robert Griesemer
951ba56adb goinstall: fix typo in comment
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5449068
2011-12-02 10:30:35 -08:00
Russ Cox
7d15eda95d gc: do not allow slice of array literal
R=ken2
CC=golang-dev
https://golang.org/cl/5440083
2011-12-02 12:30:56 -05:00
Robert Griesemer
15a3a5cf6c gofmt: applied gofmt -w -s src misc
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5451070
2011-12-01 14:33:24 -08:00
Robert Griesemer
e281576b9a go/doc: switch ToHTML from []byte to string argument
- this removes extra conversions from strings to bytes and vice versa
  for each comment
- minor cleanups

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5434096
2011-12-01 13:46:57 -08:00
Russ Cox
c52b7db470 gofix: add time+fileinfo fix
R=adg, rogpeppe, r, cw
CC=golang-dev
https://golang.org/cl/5450050
2011-12-01 13:59:57 -05:00
Adam Langley
bac7bc55a6 Add a []byte argument to hash.Hash to allow an allocation to be saved.
This is the result of running `gofix -r hashsum` over the tree, changing
the hash function implementations by hand and then fixing a couple of
instances where gofix didn't catch something.

The changed implementations are as simple as possible while still
working: I'm not trying to optimise in this CL.

R=rsc, cw, rogpeppe
CC=golang-dev
https://golang.org/cl/5448065
2011-12-01 12:35:37 -05:00
Adam Langley
2308aefc84 gofix: add a fix for hash.Sum.
This fix adds an output argument to hash.Sum.

Tree changes in https://golang.org/cl/5448065

R=rsc
CC=golang-dev
https://golang.org/cl/5450051
2011-12-01 12:25:09 -05:00
Luuk van Dijk
6bee4e556f gc: avoid re-genning ninit in branches involving float comparison.
R=rsc
CC=golang-dev
https://golang.org/cl/5451050
2011-12-01 14:46:32 +01:00
Ian Lance Taylor
bf43161c00 ld: align ELF data sections
fixes #2506

R=rsc, iant
CC=golang-dev
https://golang.org/cl/5440066
2011-11-30 13:24:16 -08:00
Russ Cox
8dce57e169 os: new FileInfo, FileMode types + update tree
R=golang-dev, r, r, gri, bradfitz, iant, iant, nigeltao, n13m3y3r
CC=golang-dev
https://golang.org/cl/5416060
2011-11-30 12:04:16 -05:00
Russ Cox
03823b881c use new time API
R=bradfitz, gri, r, dsymonds
CC=golang-dev
https://golang.org/cl/5390042
2011-11-30 12:01:46 -05:00
Luuk van Dijk
882368939c gc: move typedcl2 into export.c
R=rsc
CC=golang-dev
https://golang.org/cl/5447043
2011-11-29 13:34:08 +01:00
Andrew Gerrand
5a18aef67c goinstall: add -fix flag to run gofix on packages on build failure
goinstall: better error handling and reporting

R=r, r, rsc, mattn.jp
CC=golang-dev
https://golang.org/cl/5421051
2011-11-29 09:28:58 +11:00
Russ Cox
8e515485e2 gc: remove funarg special case in structfield
This should make CL 5431046 a little simpler.

R=ken2
CC=golang-dev
https://golang.org/cl/5444048
2011-11-28 16:40:39 -05:00
Rémy Oudompheng
60e4a61d30 gc: don't inherit orig from subnodes in constant expression nodes.
The wrong value made Nconv() show "1" for node "-1", and "2" from
node "2+3".
Fixes #2452.

R=gri, lvd, rsc
CC=golang-dev, remy
https://golang.org/cl/5435064
2011-11-28 12:22:15 -05:00
Maxim Pimenov
ffa6b383f5 gc: fix copying of types
reset xmethod during copytype

Fixes #2497

R=rsc, dvyukov
CC=golang-dev
https://golang.org/cl/5441045
2011-11-28 11:52:16 -05:00
Rob Pike
da62104169 gofix: trivial rewrite for template.ParseFiles
Also warn about uses of Set.

R=rsc
CC=golang-dev
https://golang.org/cl/5436051
2011-11-23 20:17:41 -08:00
Robert Griesemer
4874d14180 go/printer: remove "written" result value - is never used
R=r
CC=golang-dev
https://golang.org/cl/5436052
2011-11-22 15:27:10 -08:00
Russ Cox
6e3e380923 allow direct conversion between string and named []byte, []rune
The allowed conversions before and after are:
        type Tstring string
        type Tbyte []byte
        type Trune []rune

        string <-> string  // ok
        string <-> []byte  // ok
        string <-> []rune // ok
        string <-> Tstring // ok
        string <-> Tbyte // was illegal, now ok
        string <-> Trune // was illegal, now ok

        Tstring <-> string  // ok
        Tstring <-> []byte  // ok
        Tstring <-> []rune // ok
        Tstring <-> Tstring // ok
        Tstring <-> Tbyte // was illegal, now ok
        Tstring <-> Trune // was illegal, now ok

Update spec, compiler, tests.  Use in a few packages.

We agreed on this a few months ago but never implemented it.

Fixes #1707.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/5421057
2011-11-22 12:30:02 -05:00
Dmitriy Vyukov
11e73b89ca cgo: add support for callbacks from dynamic libraries
R=golang-dev, rsc
CC=golang-dev, mpimenov
https://golang.org/cl/5375042
2011-11-22 17:57:49 +03:00
Andrew Gerrand
86c08e9611 goinstall: support googlecode subrepos and add repo match tests
goinstall: don't hit network unless a checkout or update is required

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5343042
2011-11-22 07:10:25 +11:00
Russ Cox
2e9d7a6d1c gofix: test and fix missorted renames
Also introduce a new insertion heuristic:
insert new import next to existing import
with the longest matching prefix.

R=golang-dev, adg, gri
CC=golang-dev
https://golang.org/cl/5412053
2011-11-21 09:41:25 -05:00
Rémy Oudompheng
29e3ef88af cgo: document export of Go functions to C.
R=mpimenov, rsc
CC=golang-dev, remy
https://golang.org/cl/5376082
2011-11-18 18:24:59 -05:00
Robert Griesemer
9859af879b godoc: provide mode for flat (non-indented) directory listings
This feature should make it easier to look at very large
directory trees.

- a new mode (URL: /pkg/?m=flat) shows directory listings w/o
  indentation and entries with full path (html and text mode)
- in text mode, hierarchical (non-flat) directory listings are
  now presented with indentation (/pkg/?m=text)
- in html mode, hierarchical (non-flat) directory listings are
  presented with slightly less indentation
- there is an internal hook for programmatic control of the
  display mode (for specialized versions of godoc).

R=bradfitz
CC=golang-dev, rsc
https://golang.org/cl/5410043
2011-11-17 14:47:49 -08:00
Russ Cox
4d27f64863 gofmt: do not stop test.sh after 1 error
Fix bug377.go to be gofmt-compliant.

R=gri, r, r
CC=golang-dev
https://golang.org/cl/5400045
2011-11-16 18:44:21 -05:00
Anthony Martin
920df48fb1 gc: support for building with Plan 9 yacc
I've modified Plan 9's yacc to work with
the grammar in go.y.  These are the only
changes necessary on the Go side.

R=rsc
CC=golang-dev
https://golang.org/cl/5375104
2011-11-16 16:58:02 -05:00
Lucio De Re
293059ad85 cov: fix for Plan 9 build
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/5374086
2011-11-16 16:23:50 -05:00
Russ Cox
d03611f628 allow copy of struct containing unexported fields
An experiment: allow structs to be copied even if they
contain unexported fields.  This gives packages the
ability to return opaque values in their APIs, like reflect
does for reflect.Value but without the kludgy hacks reflect
resorts to.

In general, we trust programmers not to do silly things
like *x = *y on a package's struct pointers, just as we trust
programmers not to do unicode.Letter = unicode.Digit,
but packages that want a harder guarantee can introduce
an extra level of indirection, like in the changes to os.File
in this CL or by using an interface type.

All in one CL so that it can be rolled back more easily if
we decide this is a bad idea.

Originally discussed in March 2011.
https://groups.google.com/group/golang-dev/t/3f5d30938c7c45ef

R=golang-dev, adg, dvyukov, r, bradfitz, jan.mercl, gri
CC=golang-dev
https://golang.org/cl/5372095
2011-11-15 12:20:59 -05:00
Lucio De Re
11fe7cd6e3 6l, 8l: add missing space in error message
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/5374085
2011-11-14 15:59:27 -05:00
Luuk van Dijk
40afe58692 gc: fix newlines in %+N
fixes #2442

R=rsc
CC=golang-dev
https://golang.org/cl/5370066
2011-11-14 10:08:04 +01:00
Russ Cox
5bb54b8e9c gc: remove func, map compare
R=ken, ken
CC=golang-dev
https://golang.org/cl/5373079
2011-11-13 22:58:08 -05:00
Russ Cox
558e7fc332 various: avoid func compare
R=gri, r, bradfitz
CC=golang-dev
https://golang.org/cl/5371074
2011-11-13 22:57:19 -05:00
Russ Cox
c017a8299f syscall: use error
- syscall (not os) now defines the Errno type.
- the low-level assembly functions Syscall, Syscall6, and so on
  return Errno, not uintptr
- syscall wrappers all return error, not uintptr.

R=golang-dev, mikioh.mikioh, r, alex.brainman
CC=golang-dev
https://golang.org/cl/5372080
2011-11-13 22:44:52 -05:00
Luuk van Dijk
3208917d54 gc: look at cumulative error count, not just per-function.
Not sure if this is what you'd really want.  Maybe with a higher limit than 10
or perhaps keep checking nerrors > 10 per yyerror, but check the cumulative
after each function?

R=rsc
CC=golang-dev
https://golang.org/cl/5376064
2011-11-12 00:32:56 -05:00
Robert Griesemer
9192548f80 godoc: document -templates flag
Fixes #2441.

R=r
CC=golang-dev
https://golang.org/cl/5376078
2011-11-11 17:30:52 -08:00
Robert Griesemer
e8188c1607 godoc: fix remote search (use correct URL)
Also works now together with -html, as in:
godoc -html -q Sin
for an html result.

Fixes #2435.

R=iant
CC=golang-dev
https://golang.org/cl/5375074
2011-11-11 16:59:47 -08:00
Rémy Oudompheng
2ba0798682 gofmt: leave nil nodes of the AST unchanged.
Without this check, gofmt panics when trying to apply
the identity transformation on "item.field" expressions.
Fixes #2410.

R=rsc, gri
CC=golang-dev, remy
https://golang.org/cl/5376061
2011-11-11 14:11:30 -08:00
Russ Cox
5fc3771b3a gc: remove m[k] = x, false
R=ken2
CC=golang-dev
https://golang.org/cl/5376076
2011-11-11 16:48:25 -05:00
Russ Cox
6d9c02aea3 6a, 8a: allow $(-1) for consistency with $1, $(1), $-1.
R=ken2
CC=golang-dev
https://golang.org/cl/5373074
2011-11-11 14:56:49 -05:00
Wei Guangjing
3199a6ca8d ld: fix .bss for ldpe.
Fixes #2409.

R=mattn.jp, rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/5334046
2011-11-11 14:40:24 -05:00
Russ Cox
879a1c6a72 godefs: delete, replaced by cgo -godefs
Godefs was a C program that ran gcc and then parsed the
stabs debugging information in the resulting object file to
generate C or Go code for bootstrapping as part of
package runtime or package syscall.

Cgo does the same work, but using the dwarf debugging
information.  Add -godefs and -cdefs options to cgo that
mimic godefs's output, albeit with different input
(a Go program, not a C program).

This has been a "nice to have" for a while but was forced
by Apple removing stabs debugging output from their
latest compilers.

Fixes #835.
Fixes #2338.

R=golang-dev, bradfitz, r, dave, iant
CC=golang-dev
https://golang.org/cl/5367043
2011-11-10 19:08:04 -05:00
Rémy Oudompheng
23ffbe611d cgo: print error instead of panic on undeclared enums/structs
Types are left as nil if no DWARF information is found and
checking in the rewriting pass so that appropriate errors
with line numbers can be printed.
Fixes #2408.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/5336041
2011-11-09 16:01:55 -05:00
Michał Derkacz
17105870ff 6l: add MOVQ xmm_reg, xmm_reg
Added handler for:
        MOVQ xmm_reg, xmm_reg/mem64
        MOVQ xmm_reg/mem64, xmm_reg
using native MOVQ (it take precedence above REX.W MOVD)
I don't understood 6l code enough to be sure that my small changes
didn't broke it. But now 6l works with MOVQ xmm_reg, xmm_reg and
all.bash reports "0 unexpected bugs".

There is test assembly source:
MOVQ    X0, X1
MOVQ    AX, X1
MOVQ    X1, AX
MOVQ    xxx+8(FP), X2
MOVQ    X2, xxx+8(FP)

and generated code (gdb disassemble /r):

0x000000000040f112 <+0>:   f3 0f 7e c8        movq  %xmm0,%xmm1
0x000000000040f116 <+4>:   66 48 0f 6e c8     movq  %rax,%xmm1
0x000000000040f11b <+9>:   66 48 0f 7e c8     movq  %xmm1,%rax
0x000000000040f120 <+14>:  f3 0f 7e 54 24 10  movq  0x10(%rsp),%xmm2
0x000000000040f126 <+20>:  66 0f d6 54 24 10  movq  %xmm2,0x10(%rsp)

Fixes #2418.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5316076
2011-11-09 16:01:17 -05:00
Michał Derkacz
c8a2be8c38 6l: Fixes opcode for PSLLQ imm8, xmm_reg
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5340056
2011-11-09 16:00:24 -05:00
Lucio De Re
74f61fc656 gopack: fixes for Plan 9 build
. removed an unnexessary initialisation.
. replaced 0 with 0L to match print format that in turn matched
  the type of the original function return value.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/5306072
2011-11-09 13:24:36 -05:00
Russ Cox
1eadb89ee1 undo CL 5375043 / ea8b178f9b73
Never lasts long.

««« original CL description
gc: add GOEXPERIMENT=reorg

This won't last long but may ease conversions.

R=ken2
CC=golang-dev
https://golang.org/cl/5375043
»»»

R=ken2, ken
CC=golang-dev
https://golang.org/cl/5370043
2011-11-09 12:36:51 -05:00
Russ Cox
ae7a003cf9 gc: add GOEXPERIMENT=reorg
This won't last long but may ease conversions.

R=ken2
CC=golang-dev
https://golang.org/cl/5375043
2011-11-09 12:35:45 -05:00
Luuk van Dijk
924ea515cf gc: better error for non-calling use of unsafe builtins.
Fixes #1951

R=rsc
CC=golang-dev
https://golang.org/cl/5372041
2011-11-09 18:30:54 +01:00
Luuk van Dijk
d5a5855ba1 gc: Preserve original blank name for .anon substitution on out params.
Fixes #1802.

R=rsc
CC=golang-dev
https://golang.org/cl/5364043
2011-11-09 11:27:27 +01:00
Luuk van Dijk
151b2f1509 gc: Fail on implicit assigment to non-exported fields in copy and append.
Fixes #1387.

R=rsc
CC=golang-dev
https://golang.org/cl/5348046
2011-11-09 11:17:06 +01:00
Luuk van Dijk
13e92e4d75 gc: Better typechecks and errors in switches.
Allow any type in switch on interface value.
Statically check typeswitch early.

Fixes #2423.
Fixes #2424.

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/5339045
2011-11-09 10:58:53 +01:00
Rob Pike
f9489bed72 renaming_4: gofix -r everything/but/src/pkg
R=rsc
CC=golang-dev
https://golang.org/cl/5338043
2011-11-08 15:43:02 -08:00
Rob Pike
e50479ca88 gofix: add go1pkgrename
This will do the package import renamings for Go 1.

R=rsc, r, dsymonds
CC=golang-dev
https://golang.org/cl/5316078
2011-11-08 15:34:23 -08:00
Andrew Gerrand
2fcb045242 gotest: don't run examples that have no expected output
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5364041
2011-11-08 10:11:07 +11:00
Luuk van Dijk
087bec3dcd gc: Clean up dostruct/stotype, detect broken fields and propagate up to structs and functions to supress spurious errors.
Fixes #1556.

R=rsc
CC=golang-dev
https://golang.org/cl/5351042
2011-11-07 21:35:13 +01:00
Russ Cox
dfe03bb204 go/ast: fix bugs in SortImports
Tests are in gofix, since the bugs arise in rewritten ASTs.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5365043
2011-11-07 14:44:06 -05:00
Russ Cox
3f4a91d778 lib9: add ctime
ctime differs across Unix vs Plan 9 so add to portability library

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5363043
2011-11-07 13:15:16 -05:00
Ron Minnich
986ad31b2d gc: use HEADER_IO macro from gopack
Use HEADER_IO macro from gopack to read archive header
The HEADER_IO macro portably reads archive headers. The
current arsize code fails in the case of archive headers produced
on plan 9 6c and read on other systems (it's not portable).
Modify lex.c to use the portable macro
Build tested (including tests) on OSX.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5323072
2011-11-07 11:42:13 -05:00
Lucio De Re
2e1bb76f9b gc: format nits
src/cmd/gc/bits.c: corrected a mistaken format;
src/cmd/gc/go.h: %E can accept uints.

R=rsc
CC=golang-dev
https://golang.org/cl/5331041
2011-11-07 11:42:08 -05:00
Luuk van Dijk
ea9e93862d gc: Better error message for range over non-receive channel.
Fixes #2354

R=rsc
CC=golang-dev
https://golang.org/cl/5346044
2011-11-06 22:14:15 +01:00
Luuk van Dijk
0d6f857c3f gc: Switch related errors should use plain format.
Fixes #2422.

R=rsc
CC=golang-dev
https://golang.org/cl/5353046
2011-11-06 22:13:54 +01:00
David Symonds
c29cd8abb9 gofix: avoid panic on body-less functions in netudpgroup.
R=rsc, r
CC=golang-dev
https://golang.org/cl/5347041
2011-11-05 11:28:23 +11:00
Jani Monoses
cd6c7375d4 goinstall: allow packages from launchpad.net/~user branches.
The permitted filename characters should include ~ to allow
the names of user-owned branches in Launchpad.

R=golang-dev, rsc, n13m3y3r, gustavo
CC=golang-dev, gustavo.niemeyer
https://golang.org/cl/5280052
2011-11-04 15:07:34 -04:00
Luuk van Dijk
aac144b120 gc: detect type switch variable not used cases.
Fixes #873
Fixes #2162

R=rsc
CC=golang-dev
https://golang.org/cl/5341043
2011-11-04 17:03:50 +01:00
Gustavo Niemeyer
f2dc50b48d html,bzip2,sql: rename Error methods that return error to Err
There are three classes of methods/functions called Error:

a) The Error method in the just introduced error interface
b) Error methods that create or report errors (http.Error, etc)
c) Error methods that return errors previously associated with
   the receiver (Tokenizer.Error, rows.Error, etc).

This CL introduces the convention that methods in case (c)
should be named Err.

The reasoning for the change is:

- The change differentiates the two kinds of APIs based on
  names rather than just on signature, unloading Error a bit
- Err is closer to the err variable name that is so commonly
  used with the intent of verifying an error
- Err is shorter and thus more convenient to be used often
  on error verifications, such as in iterators following the
  convention of the sql package.

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5327064
2011-11-04 09:50:20 -04:00
David Symonds
d26144be29 gofix: make fix order implicit by date.
This partially undoes 8fd7e6d070c8, but preserves its semantics.
More importantly, it results in the data about each fix being
decentralised, which makes it easier for new fixes to be added,
and other gofix users to slot new fixes in.

It also adds some useful metadata that could be used in the future.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5306092
2011-11-04 08:34:37 +11:00
Luuk van Dijk
11075ed893 gc: Don't pollute the xmethod list with non-methods.
Fixes #2355.

I have a test, but not sure if it's worth adding.  Instead i've made
the patching-over in reflect.c methods more fatal and more descriptive.

R=rsc
CC=golang-dev
https://golang.org/cl/5302082
2011-11-03 17:51:15 +01:00
Russ Cox
80bce97e45 gc, ld: sync pathtoprefix + add comments
R=lvd, lvd
CC=golang-dev
https://golang.org/cl/5332051
2011-11-03 12:44:51 -04:00
Russ Cox
d6ff3c1177 gopack: do not look for Go metadata in non-Go objects
Fixes #2333.

R=r
CC=golang-dev
https://golang.org/cl/5316075
2011-11-03 12:07:47 -04:00
Russ Cox
1738dc0e71 8a: fix IMULL grammar
R=ken2
CC=golang-dev
https://golang.org/cl/5298091
2011-11-03 11:32:37 -04:00
Luuk van Dijk
33f1d47b38 gc: package paths in symbol names: don't escape periods before last slash, always escape >=0x7f.
R=rsc
CC=golang-dev
https://golang.org/cl/5323071
2011-11-02 22:33:15 +01:00
Russ Cox
965845a86d all: sort imports
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5319072
2011-11-02 15:54:16 -04:00
Russ Cox
4a9ebb18f1 gofmt, gofix: sort imports
Add ast.SortImports(fset, file) to go/ast, for use by both programs.

Fixes #346.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5330069
2011-11-02 15:53:57 -04:00
Luuk van Dijk
7df9ff5594 gc: helpful message instead of internal error on method call on pointer to pointer.
Fixes #2343.

R=rsc
CC=golang-dev
https://golang.org/cl/5332048
2011-11-02 17:18:53 +01:00
Luuk van Dijk
29a5ae657f gc: small fixes for printing.
mark OADDR inserted by typecheck as implicit
OCOPY takes ->left and ->right, not ->list
OMAKE*'s can all have arguments
precedence for OIND was initalized twice

fixes #2414

R=rsc, dave
CC=golang-dev
https://golang.org/cl/5319065
2011-11-02 15:36:33 +01:00
David Symonds
c4845c1c49 gc: fix spelling of "GOEXPERIMENT" in a comment.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5323070
2011-11-02 16:25:24 +11:00
Russ Cox
4c3ea0008c undo CL 5330066 / 6a5647d82728
I promised it wouldn't last very long.
People who really need this can sync to 6a5647d82728.

««« original CL description
gc: add GOEXPERIMENT=os.Error

This won't last long, I promise.

R=ken2
CC=golang-dev
https://golang.org/cl/5330066
»»»

R=ken2
CC=golang-dev
https://golang.org/cl/5333053
2011-11-01 23:26:10 -04:00
Russ Cox
47f4bf763d gc: add GOEXPERIMENT=os.Error
This won't last long, I promise.

R=ken2
CC=golang-dev
https://golang.org/cl/5330066
2011-11-01 23:24:28 -04:00
Russ Cox
492098eb75 all: rename os.Error to error in various non-code contexts
R=adg
CC=golang-dev
https://golang.org/cl/5328062
2011-11-01 22:58:09 -04:00
Russ Cox
44526cdbe0 non-pkg: gofix -r error -force=error
R=golang-dev, iant, r, r
CC=golang-dev
https://golang.org/cl/5307066
2011-11-01 22:06:05 -04:00
Russ Cox
c8ad1a4dc4 cgo, gotest: use error instead of os.Error in generated code
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5319057
2011-11-01 21:49:22 -04:00
Russ Cox
2a0e15d36c gc: add error type
R=ken
CC=golang-dev
https://golang.org/cl/5331043
2011-11-01 21:46:41 -04:00
Russ Cox
758200f219 gofix: error fix
To make the error fix more useful, expand typecheck to gather
more information about struct fields, typecheck range statements,
typecheck indirect and index of named types, and collect information
about assignment conversions.

Also, change addImport to rename top-level uses of a to-be-imported
identifier to avoid conflicts.  This duplicated some of the code in
the url fix, so that fix is now shorter.

R=iant, r, r
CC=golang-dev
https://golang.org/cl/5305066
2011-11-01 21:45:21 -04:00
Russ Cox
b4df33a6ea gc: test + fix escape analysis bug
R=lvd
CC=golang-dev
https://golang.org/cl/5333049
2011-11-01 11:02:43 -04:00
Russ Cox
7b04471dfa gopack: change archive file name length back to 16
This CL grew the archive file name length from 16 to 64:

        changeset:   909:58574851d792
        user:        Russ Cox <rsc@golang.org>
        date:        Mon Oct 20 13:53:56 2008 -0700

Back then, every x.go file in a package became an x.6 file
in the archive.  It was important to be able to allow the
use of long Go source file names, hence the increase in size.

Today, all Go source files compile into a single _go_.6 file
regardless of their names, so the archive file name length
no longer needs to be long.  The longer name causes some
problems on Plan 9, where the native archive format is the
same but with 16-byte names, so revert back to 16.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5333050
2011-11-01 00:29:16 -04:00
Luuk van Dijk
50110c9f83 gc: clean up printing.
Got rid of all the magic mystery globals. Now
for %N, %T, and %S, the flags +,- and # set a sticky
debug, sym and export mode, only visible in the new fmt.c.
Default is error mode. Handle h and l flags consistently with
the least side effects, so we can now change
things without worrying about unrelated things
breaking.

fixes #2361

R=rsc
CC=golang-dev
https://golang.org/cl/5316043
2011-10-31 18:09:40 +01:00
Julian Phillips
d066e02adc goinstall: More intelligent vcs selection for common sites
goinstall has built in support for a few common code hosting sites.  The
identification of which vcs tool should be used was based purely on a
regex match against the provided import path.  The problem with this
approach is that it requires distinct import paths for different vcs
tools on the same site.

Since bitbucket has recently starting hosting Git repositories under the
same bitbucket.org/user/project scheme as it already hosts Mercurial
repositories, now would seem a good time to take a more flexible
approach.

We still match the import path against a list of regexes, but now the
match is purely to distinguish the different hosting sites.  Once the
site is identified, the specified function is called with the repo and
path matched out of the import string.  This function is responsible for
creating the vcsMatch structure that tells us what we need to download
the code.

For github and launchpad, only one vcs tool is currently supported, so
these functions can simply return a vcsMatch structure.  For googlecode,
we retain the behaviour of determing the vcs from the import path - but
now it is done by the function instead of the regex.  For bitbucket, we
use api.bitbucket.org to find out what sort of repository the specified
import path corresponds to - and then construct the appropriate vcsMatch
structure.

R=golang-dev, adg
CC=golang-dev, rsc
https://golang.org/cl/5306069
2011-10-27 17:45:07 +09:00
Russ Cox
2cf5359830 6l: remove mention of -e flag
Emitting ELF symbol table is the default behavior now
and cannot be disabled.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5319050
2011-10-26 15:28:18 -07:00
Ron Minnich
1bc1caa802 cc: change cas to newcase
Change the name of cas() in cc to newcase() to avoid a NIX conflict.
cas() is used in cc to create a new Case struct. There is a name
conflict in that cas() is a commonly-used
name for compare and swap. Since cas() is only used internally
in the compiler in 3 places, change the name to avoid a wider
conflict with the NIX runtime. This issue might well come up on
other OSes in the future anyway, as the name is fairly common.

R=rsc
CC=golang-dev
https://golang.org/cl/5294071
2011-10-26 15:27:59 -07:00
Russ Cox
6323a40f31 gofix: test import insertion, deletion
Small change to go/ast, go/parser, go/printer so that
gofix can delete the blank line left from deleting an import.

R=golang-dev, bradfitz, adg
CC=golang-dev
https://golang.org/cl/5321046
2011-10-26 14:04:07 -07:00
Mikio Hara
8b92066e31 gc: fix [568]g -V crash
R=lvd
CC=golang-dev
https://golang.org/cl/5314060
2011-10-26 16:16:46 +09:00
Russ Cox
81b014818c govet: update signatures for rune
R=r
CC=golang-dev
https://golang.org/cl/5301053
2011-10-25 22:20:35 -07:00
Russ Cox
5be33e9543 godoc, exp/ebnf, exp/types, go/scanner, scanner: use rune
API question: is a scanner token an int or a rune?

Since the rune is the common case and the token values
are the special (negative) case, I chose rune.  But it could
easily go the other way.

R=gri
CC=golang-dev
https://golang.org/cl/5301049
2011-10-25 22:20:20 -07:00
Russ Cox
db33959797 cgo, goyacc, go/build, html, http, path, path/filepath, testing/quick, test: use rune
Nothing terribly interesting here.

R=golang-dev, bradfitz, gri, r
CC=golang-dev
https://golang.org/cl/5300043
2011-10-25 22:20:02 -07:00
Russ Cox
6ed3fa6553 gc: introduce rune
R=ken, r
CC=golang-dev
https://golang.org/cl/5293046
2011-10-25 22:19:39 -07:00
Rob Pike
c6bdef3fd8 gotest: make it easier to get the help string
Because gotest's args are mingled with the tests, it's
hard to get the usage message to print. This CL adds
explicit support for -help, spelled several different ways.
Gotest has special flags like -file that are somewhat
hidden otherwise.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5298052
2011-10-21 11:16:46 -07:00
Russ Cox
b0ec32db11 govet: check canonical dynamic method signatures
Adds check that, for example, a Scan method taking
a first argument of type fmt.ScanState has the correct
signature to satisfy fmt.Scanner.

Similarly, a ReadByte should return byte, os.Error.

These are important to check because various pieces
of code (fmt, gob, json, flate) do dynamic checks
for these methods, so code with incorrect signatures
would not be flagged at compile time.

These become even more important to check when
rune is introduced.

R=r
CC=golang-dev
https://golang.org/cl/5305044
2011-10-19 16:06:16 -04:00
Russ Cox
35b2bfc8da gotest: use $GCFLAGS like make does
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5297044
2011-10-19 13:10:23 -04:00
Mikkel Krautz
78ad19f214 ld: modify macho linkedit segment to enable OS X code signing
Move string table to the end of the __LINKEDIT segment.

This change allows Apple's codesign(1) utility to successfully sign
Go binaries, as long as they don't contain DWARF data (-w flag to
8l/6l).  This is because codesign(1) expects the string table to be
the last part of the file.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5271050
2011-10-18 16:31:03 -04:00
Anthony Martin
033585d675 5l, 6l, 8l: correct ELFRESERVE diagnostic
If the length of the interpreter string
pushes us over the ELFRESERVE limit, the
resulting error message will be comical.

I was doing some ELF tinkering with a
modified version of 8l when I hit this.

To be clear, the stock linkers wouldn't
hit this without adding about forty more
section headers.  We're safe for now. ;)

Also, remove a redundant call to cflush.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5268044
2011-10-18 16:05:38 -04:00
Mikkel Krautz
4566868b41 6l, 8l: emit macho dwarf info before linkedit section
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5272050
2011-10-18 15:58:10 -04:00
Russ Cox
862179b0f5 gc: preserve uint8 and byte distinction in errors, import data
There is no semantic change here, just better errors.
If a function says it takes a byte, and you pass it an int,
the compiler error now says that you need a byte, not
that you need a uint8.

Groundwork for rune.

R=ken2
CC=golang-dev
https://golang.org/cl/5300042
2011-10-18 14:55:50 -04:00
Russ Cox
d604cf7808 5g, 6g: comment out uses of -r
R=ken2
CC=golang-dev
https://golang.org/cl/5299043
2011-10-18 14:55:28 -04:00
Robert Griesemer
0e4d1c3e2c godoc: fix ToAbsolute mapping
The implementation of splitFirst was broken;
splitFirst("foo/") must be the same as splitFirst("foo").
As a result, ToAbsolute could be simplified, and as a side
effect this fixes a long-standing bug.

Thanks to Luca Greco <luca.greco@alcacoop.it> for doing
the investigation.

Fixes #1157.

R=rsc
CC=golang-dev
https://golang.org/cl/5278050
2011-10-18 10:28:30 -07:00
Russ Cox
4e7aac5413 reflect: make unsafe use of SliceHeader gc-friendly
Revert workaround in compiler and
revert test for compiler workaround.

Tested that the 386 build continues to fail if
the gc change is made without the reflect change.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5312041
2011-10-18 10:03:37 -04:00
Russ Cox
313c8224d5 gofix -r mapdelete
R=golang-dev, r, adg, r, cw
CC=golang-dev
https://golang.org/cl/5266045
2011-10-18 09:56:34 -04:00
Russ Cox
7242052bc7 gofix: add mapdelete
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5286043
2011-10-18 09:45:36 -04:00
Russ Cox
1d687c742d gc: add delete(m, x) but leave in m[x] = 0, false.
The old m[x] = 0, false syntax will be deleted
in a month or so, once people have had time to
change their code (there is a gofix in a separate CL).

R=ken2
CC=golang-dev
https://golang.org/cl/5265048
2011-10-18 09:41:32 -04:00
Mikkel Krautz
c9bf048337 ld: bump pe linker version to 3.0 to allow code signing
The Windows signtool.exe thinks our binaries are 'invalid
Win32 programs' unless the PE linker version field is 3.0
or greater.

This minor change makes it possible to successfully sign
gc-built binaries on Windows.

R=golang-dev, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/5268045
2011-10-18 15:31:55 +11:00
Russ Cox
e40d6e066a runtime: random offset for map iteration
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5285042
2011-10-17 18:49:02 -04:00
Anthony Martin
95b4f8284f build: add missing nuke target
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5266046
2011-10-17 14:18:21 -07:00
Dmitriy Vyukov
b0c674b65d gc: treat uintptr as potentially containing a pointer
Fixes #2376

R=golang-dev, lvd, rsc
CC=golang-dev
https://golang.org/cl/5278048
2011-10-17 15:14:07 -04:00
Esko Luontola
edd1c9111d gotest: avoid conflicts with the name of the tested package
Uses a generic solution of renaming the tested package, instead of
using cryptic names for all other imports, variables and methods
in the generated _testmain.go file.

Fixes #2346.

R=golang-dev, r, adg
CC=golang-dev, rsc
https://golang.org/cl/5254061
2011-10-17 14:19:02 +11:00
Anthony Martin
fc61ea3ba3 goyacc: clean up after units
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5286047
2011-10-15 07:12:10 -07:00
Robert Griesemer
c5b3a4fb07 godoc: updates for latest Go app-engine release.
R=adg
CC=golang-dev
https://golang.org/cl/5273044
2011-10-14 16:06:39 -07:00
Dave Cheney
a3ff67c3a7 godefs: add enum/const testdata
Also, add golden output data for linux/arm.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5256041
2011-10-14 17:34:00 -04:00
Russ Cox
236aff31c5 gofmt: fix //line handling
Fixes #2369.

R=gri
CC=golang-dev
https://golang.org/cl/5275048
2011-10-14 15:54:45 -04:00
Jaroslavas Počepko
ff866c4ca3 ld: Fixes issue 1899 ("cannot create 8.out.exe")
http://code.google.com/p/go/issues/detail?id=1899

R=rsc, alex.brainman, bsiegert, hectorchu, bradfitz
CC=golang-dev
https://golang.org/cl/4978047
2011-10-14 20:37:07 +01:00
Chris Hundt
550fa3fa2d goyacc: make more gofmt-compliant
Adjust goyacc.go to produce code that is gofmt-compliant whenever it is easy to do so. Also changed two lines in cpyact that appeared to be bugs.

Also updated units.y to remove a few other errors.

After this change, units.go has only two style errors: an extra newline at the top of the file, and yys misaligned in yySymType.

R=rsc
CC=golang-dev
https://golang.org/cl/5265047
2011-10-14 13:10:02 -04:00
Robert Griesemer
812249fe5e gotype: move to exp/gotype per Go 1 plan
R=r, dsymonds
CC=golang-dev
https://golang.org/cl/5269043
2011-10-13 16:36:53 -07:00
Robert Griesemer
da7538c29c gotype: fix build (update test)
R=r
CC=golang-dev
https://golang.org/cl/5277044
2011-10-13 16:06:27 -07:00
Russ Cox
6198336bb5 gofix: make fix order explicit
Also test only specific fixes, not all fixes.
This means we don't have to keep updating old
test cases to match later changes to the library.

I had to adjust some of the reflect test cases,
because they were implicitly testing
reflect+oserrorstring, not just reflect.

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5283042
2011-10-13 18:45:38 -04:00
Robert Griesemer
29c2838cb4 go/types: move to exp/types per Go 1 plan
This package is only used by gotype at the moment.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5266042
2011-10-13 15:41:48 -07:00
Russ Cox
f58ed4e641 gc: disallow close on receive-only channels
Fixes #2353.
Fixes #2246.

R=golang-dev, r, gri
CC=golang-dev
https://golang.org/cl/5282042
2011-10-13 16:58:04 -04:00
Russ Cox
eb3aba24b5 gc: stricter multiple assignment + test
Fixes #693.

R=ken2
CC=golang-dev
https://golang.org/cl/5265045
2011-10-13 15:46:39 -04:00
Russ Cox
c18d1a78a4 gc: implement new return restriction
R=ken2
CC=golang-dev
https://golang.org/cl/5245056
2011-10-13 12:17:55 -04:00
Dmitriy Vyukov
bf9c778fe2 gc: pass FlagNoPointers to runtime.new
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5151043
2011-10-13 11:06:55 +03:00
Rob Pike
1204f740cf gotest: correct the documentation of -parallel.
It said the default was zero, but it's actually $GOMAXPROCS.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5229059
2011-10-12 16:56:39 -07:00
Robert Griesemer
787f439733 godoc: setup script for app engine, cleanups
- automated app-engine setup with bash script
- added README.godoc-app
- removed orphaned files in misc/godoc

R=rsc
CC=golang-dev
https://golang.org/cl/5231042
2011-10-12 10:48:38 -07:00
Dmitriy Vyukov
af1232fe38 runtime: faster strings
Use FlagNoPointers and do not zeroize memory when allocate strings.
test/garbage/parser.out        old         new
run #1                     32.923s     32.065s
run #2                     33.047s     31.931s
run #3                     32.702s     31.841s
run #4                     32.718s     31.838s
run #5                     32.702s     31.868s

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5259041
2011-10-12 17:40:02 +03:00
Luuk van Dijk
77fac21e82 runtime: append([]byte, string...)
Fixes #2274

R=rsc, gri, dsymonds, bradfitz, lvd
CC=golang-dev
https://golang.org/cl/5149045
2011-10-12 15:59:23 +02:00
Robert Griesemer
e9ba607bf5 gofmt: fix a couple of crashes, disallow rewrites for incomplete programs
The current implementation of formatting for incomplete programs
cannot tolerate program rewrites; ignore -rewrite in that case
with a warning message (temporary solution).

Fix a couple of crashes that were introduced recently.

Fixes #2348.

R=rsc
CC=golang-dev
https://golang.org/cl/5233054
2011-10-11 21:49:53 -07:00
Robert Griesemer
e58a77809d ebnf, ebnflint: move under exp
pkg/ebnf -> pkg/exp/ebnf
cmd/ebnflint -> pkg/exp/ebnflint

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5188042
2011-10-11 17:43:10 -07:00
Rob Pike
f4cb96b438 container/vector: delete
Slices are better:
http://code.google.com/p/go-wiki/wiki/SliceTricks

R=golang-dev, bradfitz, dsymonds
CC=golang-dev
https://golang.org/cl/5248060
2011-10-11 16:41:48 -07:00
Rob Pike
d69b820e01 try: delete
A fun experiment but not carrying its weight.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5246054
2011-10-11 16:17:21 -07:00
Robert Griesemer
ec7963565a godoc: show source code if -src flag is set in command-line mode
This also shows the source code of exported functions in server
mode (e.g. pkg/big/?m=src).

Fixes #2360.

R=rsc
CC=golang-dev
https://golang.org/cl/5254057
2011-10-11 11:47:24 -07:00
Andrew Gerrand
8440fdd904 godoc: support multiple examples
gotest: document examples
go/doc: tidy comment

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5235055
2011-10-11 11:11:47 +11:00
Luuk van Dijk
b536adbfba gc: changes to export format in preparation for inlining.
string literals used as package qualifiers are now prefixed with '@'
which obviates the need for the extra ':' before tags.

R=rsc, gri, lvd
CC=golang-dev
https://golang.org/cl/5129057
2011-10-08 19:37:06 +02:00
Robert Griesemer
bb51de1cba gofmt: update test.sh
R=r
CC=golang-dev
https://golang.org/cl/5235043
2011-10-07 15:14:37 -07:00
Robert Griesemer
f566fca2b3 godoc: show "unexported" declarations when executing "godoc builtin"
Was never working correctly when executing from the command-line.

R=r
CC=golang-dev
https://golang.org/cl/5236042
2011-10-07 12:45:19 -07:00
Robert Griesemer
f198bbc850 godoc: use scanner instead of go/scanner for ebnf processing of spec
Also: Fewer calls to flush for faster processing (once per identifier
or error instead of once per token).

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5236041
2011-10-06 21:46:05 -07:00
Robert Griesemer
ec9ea9a5cb godoc: use a bufio.Buffer to read search index
Also: Minor refactoring for cleanliness and symmetry.

Fixes #2286.

R=r
CC=golang-dev
https://golang.org/cl/5232041
2011-10-06 17:36:00 -07:00
Robert Griesemer
a64b2699c4 godoc: documentation for all (not just exported) declarations
Removed the URL form parameter "f=text" in favor of a more
flexible mode parameter "m" which now accepts a list of mode
flags as documented in doc.go.

Fixes #1784.

R=rsc
CC=golang-dev
https://golang.org/cl/5227041
2011-10-06 16:06:23 -07:00
Andrew Gerrand
af1ae438b9 go/doc, godoc, gotest: support for reading example documentation
This CL introduces the go.Example type and go.Examples functions that
are used to represent and extract code samples from Go source.

They should be of the form:

// Output of this function.
func ExampleFoo() {
        fmt.Println("Output of this function.")
}

It also modifies godoc to read example code from _test.go files,
and include them in the HTML output with JavaScript-driven toggles.

It also implements testing of example functions with gotest.
The stdout/stderr is compared against the output comment on the
function.

This CL includes examples for the sort.Ints function and the
sort.SortInts type. After patching this CL in and re-building go/doc
and godoc, try
        godoc -http=localhost:6060
and visit http://localhost:6060/pkg/sort/

R=gri, r, rsc
CC=golang-dev
https://golang.org/cl/5137041
2011-10-06 11:56:17 -07:00
Rob Pike
417c42218f gotest: document -test.parallel
R=golang-dev, bradfitz, dsymonds, gri
CC=golang-dev
https://golang.org/cl/5223043
2011-10-06 10:41:52 -07:00
Miki Tebeka
f80d8fbcf0 testing: Add support for running tests in parallel (t.Parallel API).
See discussion at https://groups.google.com/d/topic/golang-dev/RAKiqi44GEU/discussion

R=golang-dev, bradfitz, dvyukov, rogpeppe, r, r, borman
CC=golang-dev
https://golang.org/cl/5071044
2011-10-06 09:58:36 -07:00
Wei Guangjing
e7042418c5 cgo: support for mingw-w64 4.5.1 and newer
R=rsc, jp, hectorchu
CC=golang-dev
https://golang.org/cl/4962051
2011-10-06 07:22:48 +01:00
Robert Griesemer
0da66a2e90 ebnf: use scanner instead of go/scanner
R=rsc, r
CC=golang-dev
https://golang.org/cl/5192043
2011-10-05 10:34:01 -07:00
Ian Lance Taylor
a55de2ba61 5l/6l/8l: add a DT_DEBUG dynamic tag to a dynamic ELF binary
This requires making the .dynamic section writable, as the
dynamic linker will change the value of the DT_DEBUG tag at
runtime.  The DT_DEBUG tag is used by gdb to find all loaded
shared libraries.

R=rsc
CC=golang-dev
https://golang.org/cl/5189044
2011-10-04 21:25:11 -07:00
Russ Cox
e2d326b878 5g, 6g, 8g: fix loop finding bug, squash jmps
The loop recognizer uses the standard dominance
frontiers but gets confused by dead code, which
has a (not explicitly set) rpo number of 0, meaning it
looks like the head of the function, so it dominates
everything.  If the loop recognizer encounters dead
code while tracking backward through the graph
it fails to recognize where it started as a loop, and
then the optimizer does not registerize values loaded
inside that loop.  Fix by checking rpo against rpo2r.

Separately, run a quick pass over the generated
code to squash JMPs to JMP instructions, which
are convenient to emit during code generation but
difficult to read when debugging the -S output.
A side effect of this pass is to eliminate dead code,
so the output files may be slightly smaller and the
optimizer may have less work to do.
There is no semantic effect, because the linkers
flatten JMP chains and delete dead instructions
when laying out the final code.  Doing it here too
just makes the -S output easier to read and more
like what the final binary will contain.

The "dead code breaks loop finding" bug is thus
fixed twice over.  It seemed prudent to fix loopit
separately just in case dead code ever sneaks back
in for one reason or another.

R=ken2
CC=golang-dev
https://golang.org/cl/5190043
2011-10-04 15:06:16 -04:00
Joe Poirier
aec89a6db9 cgo: allow Window's specific path characters in flag directives.
Example: #cgo windows LDFLAGS: -LC:\\WINDOWS\\system32

R=alex.brainman, go.peter.90, golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5154042
2011-10-04 15:07:28 +11:00
Nigel Tao
a2846e65dc image: spin off a new color package out of the image package.
The spin-off renames some types. The new names are simply better:
image.Color              -> color.Color
image.ColorModel         -> color.Model
image.ColorModelFunc     -> color.ModelFunc
image.PalettedColorModel -> color.Palette
image.RGBAColor          -> color.RGBA
image.RGBAColorModel     -> color.RGBAModel
image.RGBA64Color        -> color.RGBA64
image.RGBA64ColorModel   -> color.RGBA64Model
(similarly for NRGBAColor, GrayColorModel, etc)

The image.ColorImage type stays in the image package, but is renamed:
image.ColorImage -> image.Uniform

The image.Image implementations (image.RGBA, image.RGBA64, image.NRGBA,
image.Alpha, etc) do not change their name, and gain a nice symmetry:
an image.RGBA is an image of color.RGBA, etc.

The image.Black, image.Opaque uniform images remain unchanged (although
their type is renamed from image.ColorImage to image.Uniform). The
corresponding color types (color.Black, color.Opaque, etc) are new.

Nothing in the image/ycbcr is renamed yet. The ycbcr.YCbCrColor and
ycbcr.YCbCrImage types will eventually migrate to color.YCbCr and
image.YCbCr, but that will be a separate CL.

R=r, bsiegert
CC=golang-dev
https://golang.org/cl/5132048
2011-10-04 11:09:03 +11:00
Russ Cox
e419535f2a 5g, 6g, 8g: registerize variables again
My previous CL:

changeset:   9645:ce2e5f44b310
user:        Russ Cox <rsc@golang.org>
date:        Tue Sep 06 10:24:21 2011 -0400
summary:     gc: unify stack frame layout

introduced a bug wherein no variables were
being registerized, making Go programs 2-3x
slower than they had been before.

This CL fixes that bug (along with some others
it was hiding) and adds a test that optimization
makes at least one test case faster.

R=ken2
CC=golang-dev
https://golang.org/cl/5174045
2011-10-03 17:46:36 -04:00
Russ Cox
e7e5c5adb3 runtime: fix map memory leak
The map implementation was using the C idiom of using
a pointer just past the end of its table as a limit pointer.
Unfortunately, the garbage collector sees that pointer as
pointing at the block adjacent to the map table, pinning
in memory a block that would otherwise be freed.

Fix by making limit pointer point at last valid entry, not
just past it.

Reviewed by Mike Burrows.

R=golang-dev, bradfitz, lvd, r
CC=golang-dev
https://golang.org/cl/5158045
2011-10-01 13:00:53 -04:00
David Symonds
39493be294 io: rename Copyn to CopyN.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5157045
2011-09-30 13:13:39 -07:00
Rob Pike
1a13f9b810 math: remove the leading F from Fabs etc.
The letter is a holdover from C and unnecessary in Go.
Gofix module included.
Fixes #2306.

R=golang-dev, gri, dsymonds
CC=golang-dev
https://golang.org/cl/5158043
2011-09-29 09:54:20 -07:00
Russ Cox
092a211fb9 5g: fix -f()
R=ken2
CC=golang-dev
https://golang.org/cl/5161041
2011-09-29 12:09:46 -04:00
Russ Cox
b74136984d go: skeleton implementation
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5141051
2011-09-28 20:07:21 -04:00
Russ Cox
9aae6482f4 go: documentation for new command
*** This is a design review, not a code review. ***
Feel free to reply to the mail instead of picking out
individual lines to comment on in Rietveld.

This command, go, will replace both gomake/make and goinstall.
Make will stick around only for building our C commands
and perhaps package runtime.

In normal use while developing you'd run commands like

        go compile
        go test
        go clean
        go install

which apply to the package in the current directory.

To operate on code written by others, you add an explicit
package path:

        go get gopath.googlecode.com/hg/oauth
        go test gopath.googlecode.com/hg/oauth

The script.txt file is a script showing the output of
the various help commands that the command has.
(Right now, all the command can do is print help messages.)

R=golang-dev, bradfitz, kevlar, r, edsrzf, gri, adg, rogpeppe, r
CC=golang-dev
https://golang.org/cl/5019045
2011-09-28 16:00:12 -04:00
Yasuhiro Matsumoto
76ea456e45 hgpatch: do not use hg exit status
Fixes #2243.

R=rsc
CC=golang-dev
https://golang.org/cl/5146041
2011-09-28 12:00:17 -04:00
Russ Cox
6c230fbc67 regexp: move to old/regexp, replace with exp/regexp
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5127042
2011-09-26 18:33:13 -04:00
Robert Griesemer
ec8469b6c7 godoc: simplify internal FileSystem interface
- also fixed bug: ReadFile never closed the file before
- per suggestion by bradfitz

R=bradfitz
CC=golang-dev
https://golang.org/cl/5092047
2011-09-21 15:12:06 -07:00
Russ Cox
7ca406396f gc: disallow invalid map keys
The algtype-based test broke when algtype
got a bit more fine-grained, so replace with
an explicit check for the invalid key types.

R=ken2
CC=golang-dev
https://golang.org/cl/5071041
2011-09-19 13:11:24 -04:00
Jaroslavas Počepko
5edf5197e0 cgo: cgo to use GOARCH from the environment, not runtime.GOARCH (otherwise it results in necessity of having 8cgo and 6cgo)
R=rsc, adg
CC=golang-dev
https://golang.org/cl/4978061
2011-09-19 11:50:59 -04:00
Russ Cox
ad7dea1e96 gc: handle complex CONVNOP
Fixes #2256.

R=ken2
CC=golang-dev
https://golang.org/cl/5044047
2011-09-19 11:50:53 -04:00
Dave Cheney
f554c90cef 8l: remove left over debugging
This line was triggering a null dereference warning
        under clang-3.0. The line was added in a46819aa9150
        but compared to it's sibling in 6l it appears to be
        leftover debugging.

R=rsc
CC=golang-dev
https://golang.org/cl/5049042
2011-09-19 11:50:45 -04:00
Robert Griesemer
642d272c3c godoc: remove dependency of syscall
On app-engine, we cannot import syscall.
The respective constants are already defined
elsewhere for the same reason.

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/5036042
2011-09-15 16:47:01 -07:00
Robert Griesemer
66e44000d4 godoc: use new index/suffixarray serialization code
When saving/restoring the fulltext index, the entire
respective suffixarray is now saved/restored (as opposed
to the indexed data only, and the suffixarray recreated).
This saves significant start-up time for large indexes,
at the cost of significantly larger index files.

R=r
CC=golang-dev
https://golang.org/cl/5037043
2011-09-15 16:21:42 -07:00
Russ Cox
bb0c8b3b66 godoc: use go/build to find files in a package
Fixes #1156.
Fixes #2172.

R=gri
CC=golang-dev
https://golang.org/cl/5015044
2011-09-15 16:49:06 -04:00
Russ Cox
17bebd3caa go/build: handle cgo, //build comments
R=adg
CC=golang-dev
https://golang.org/cl/5018044
2011-09-15 12:11:41 -04:00
Robert Griesemer
d76c4a52e7 godoc: support for complete index serialization
- now fulltext index information is saved/restored
- minor updates to appinit.go

R=rsc
CC=golang-dev
https://golang.org/cl/5024043
2011-09-14 20:46:03 -07:00
Russ Cox
b039883946 gofmt: add else test
R=gri
CC=golang-dev
https://golang.org/cl/4978065
2011-09-14 11:29:18 -04:00
Nigel Tao
aa75bee7a5 image: change the NewXxx functions to take a Rectangle instead of
taking (w, h int).

R=rsc, bsiegert, r
CC=golang-dev
https://golang.org/cl/4964073
2011-09-14 21:39:49 +10:00
Rob Pike
4e3b725cf0 path/filepath: new signature for Walk
This one uses a closure than an interface, and is much simpler to use.
It also enables a called function to return an error and (possibly)
halt processing.

Fixes #2237.

R=golang-dev, gri, rsc, r, cw, n13m3y3r
CC=golang-dev
https://golang.org/cl/5014043
2011-09-13 17:47:59 -07:00
Russ Cox
9fc687392c gc: clean up if grammar
Fixes #2248.

R=ken2
CC=golang-dev
https://golang.org/cl/4978064
2011-09-12 15:52:29 -04:00
Russ Cox
48e9c771a1 gofmt: accept program fragments on standard input
This makes it possible to grab a block of code
in an editor and pipe it through gofmt, instead of
having to pipe in the entire file.

R=gri
CC=golang-dev
https://golang.org/cl/4973074
2011-09-12 15:41:49 -04:00
Robert Griesemer
7944bbf2d2 godoc, suffixarray: switch to exp/regexp
R=rsc
CC=golang-dev
https://golang.org/cl/4983058
2011-09-12 12:20:48 -07:00
Andrew Gerrand
3bc2d0f20b doc: link to notable blog posts
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4996041
2011-09-10 09:35:25 +10:00
Luuk van Dijk
ac1b9545e3 ld: grow dwarf includestack on demand.
Fixes #2241
while not breaking issue 1878 again.

R=rsc
CC=golang-dev
https://golang.org/cl/4988048
2011-09-09 15:08:57 +02:00
Robert Griesemer
041dc0a1c2 godoc: show packages matching a query at the top
Also: fix layout of textual search results and
fix a field reference in the respective template.

Fixes #1987.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4962061
2011-09-08 15:35:56 -07:00
Robert Griesemer
49bcc88f79 undo CL 4964067 / 661cb84cc6f0
API change. Needs further reflection.

««« original CL description
path/filepath: Simplify Walk interface

The last argument of filepath.Walk was removed, and the Visitor
interface now contains an Error method that is called on errors.

Fixes #2237.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/4964067

»»»

R=r
CC=golang-dev
https://golang.org/cl/4974065
2011-09-07 15:19:53 -07:00
Gustavo Niemeyer
e5c20dc270 path/filepath: Simplify Walk interface
The last argument of filepath.Walk was removed, and the Visitor
interface now contains an Error method that is called on errors.

Fixes #2237.

R=golang-dev, gri, r
CC=golang-dev
https://golang.org/cl/4964067
2011-09-07 14:49:48 -07:00
Russ Cox
1e480cd1ad gc: add -p flag to catch import cycles earlier
The linker would catch them if gc succeeded,
but too often the cycle manifests as making the
current package and the imported copy of itself
appear as different packages, which result in
type signature mismatches that confuse users.

As a crutch, add the -p flag to say 'if you see an
import of this package, give up early'.  Results in
messages like (during gotest in sort):

export_test.go:7: import "sort" while compiling that package (import cycle)
export_test.go:7: import "container/heap": package depends on "sort" (import cycle)

Fixes #2042.

R=ken
CC=bradfitz, dsymonds, golang-dev
https://golang.org/cl/4972057
2011-09-07 15:50:21 -04:00
Hector Chu
aed2c06dcb 5a, 5c, 6a, 6c, 8a, 8c: fix Windows file paths
Verified with objdump -W.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/4974061
2011-09-07 15:49:56 -04:00
Lucio De Re
4ba677c6ea gc: silence Plan 9 warnings
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4975055
2011-09-07 13:55:48 -04:00
Hector Chu
7b2f214b6c gopprof: regexp fixes
Extract Windows filenames correctly.
Don't remove receivers from method names.

Fixes #2227.

R=rsc
CC=golang-dev
https://golang.org/cl/4969059
2011-09-07 13:53:29 -04:00
Luuk van Dijk
f2460a8c57 gc: treat DOTMETH like DOT in escape analysis.
Fixes #2225

R=rsc, nigeltao, dave
CC=bradfitz, golang-dev, mikioh.mikioh
https://golang.org/cl/4972056
2011-09-07 19:03:11 +02:00
Russ Cox
5ddf6255a1 gc: unify stack frame layout
allocparams + tempname + compactframe
all knew about how to place stack variables.

Now only compactframe, renamed to allocauto,
does the work.  Until the last minute, each PAUTO
variable is in its own space and has xoffset == 0.

This might break 5g.  I get failures in concurrent
code running under qemu and I can't tell whether
it's 5g's fault or qemu's.  We'll see what the real
ARM builders say.

R=ken2
CC=golang-dev
https://golang.org/cl/4973057
2011-09-06 10:24:21 -04:00
Russ Cox
919cb2ec7c gc: fix zero-length struct eval
Fixes #2232.

R=ken2
CC=golang-dev
https://golang.org/cl/4960054
2011-09-05 15:31:22 -04:00
Mike Rosset
8ddd66145e build: clear execute bit from Go files
R=golang-dev, rsc
CC=golang-dev, mike.rosset
https://golang.org/cl/4950062
2011-09-05 07:48:42 -04:00
Gustavo Niemeyer
c5670f1548 gofix: do not convert url in field names
There's some ambiguity in the U{url: url} case as it could be
both a map or a struct literal, but given context it's more
likely a struct, so U{url: url_} rather than U{url_: url_}.
At least that was the case for me.

R=golang-dev, rsc, adg
CC=golang-dev
https://golang.org/cl/4972052
2011-09-03 16:01:54 -03:00
Hector Chu
9b011500c0 runtime: implement exception handling on windows/amd64
Fixes #2194.

R=rsc, alex.brainman, vcc.163, jp
CC=golang-dev
https://golang.org/cl/4977044
2011-09-03 18:27:16 +10:00
Russ Cox
9854fd2a0e gc: introduce temp = nod+tempname
R=ken2
CC=golang-dev
https://golang.org/cl/4967052
2011-09-02 15:35:16 -04:00
Russ Cox
c45c0c0c1d gc: zero stack-allocated slice backing arrays
Fixes Han-Wen's termite bug.

R=lvd
CC=golang-dev
https://golang.org/cl/4977052
2011-09-02 15:11:28 -04:00
Robert Griesemer
cd6f319a76 godoc: minor tweaks for app-engine use
- read search index files in groutine to avoid
  start-up failure on app engine because reading
  the files takes too long
- permit usage of search index files and indexer
- minor cosmetic cleanups

R=dsymonds
CC=golang-dev
https://golang.org/cl/4952050
2011-09-02 10:07:29 -07:00
Andrew Gerrand
3fa7226de7 goinstall: better usage message
Fixes #2185.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4967046
2011-09-02 10:07:47 +10:00
Russ Cox
60d47101aa gc: fix label recursion bugs
Was keeping a pointer to the labeled statement in n->right,
which meant that generic traversals of the tree visited it twice.
That combined with aggressive flattening of the block
structure when possible during parsing meant that
the kinds of label: code label: code label: code sequences
generated by yacc were giving the recursion 2ⁿ paths
through the program.

Fixes #2212.

R=lvd
CC=golang-dev
https://golang.org/cl/4960050
2011-09-01 13:44:46 -04:00
Robert Griesemer
3f1269ff1e godoc: more index size reduction
- KindRuns don't need to repeat SpotKind,
  it is stored in each Spot
- removed extra indirection from FileRuns
  to KindRuns
- slight reduction of written index size
  (~500KB)

R=rsc
CC=golang-dev
https://golang.org/cl/4969052
2011-08-31 14:01:58 -07:00
Russ Cox
0c9ea63b3b cgo: explain how to free something
R=golang-dev, n13m3y3r, r
CC=golang-dev
https://golang.org/cl/4958053
2011-08-31 08:17:01 -04:00
Russ Cox
335da67e00 gc: make static initialization more static
Does as much as possible in data layout instead
of during the init function.

Handles var x = y; var y = z as a special case too,
because it is so prevalent in package unicode
(var Greek = _Greek; var _Greek = []...).

Introduces InitPlan description of initialized data
so that it can be traversed multiple times (for example,
in the copy handler).

Cuts package unicode's init function size by 8x.
All that remains there is map initialization, which
is on the chopping block too.

Fixes sinit.go test case.

Aggregate DATA instructions at end of object file.

Checkpoint.  More to come.

R=ken2
CC=golang-dev
https://golang.org/cl/4969051
2011-08-31 07:37:14 -04:00
Russ Cox
4304de6e0c runtime: make arm work on Ubuntu Natty qemu
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4963050
2011-08-31 07:02:46 -04:00
Gustavo Niemeyer
0cfa0fe242 cgo: note that CString result must be freed
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4968054
2011-08-31 06:44:55 -03:00
Robert Griesemer
40f0a0d759 godoc index: first step towards reducing index size
- canonicalize package descriptors
- remove duplicate storage of file paths
- reduces (current) written index file by approx 3.5MB
(from 28434237B to 24686643B, or 13%)

- next step: untangle DAG (when serializing, using
gob, the index dag explodes into an index tree)

R=dsymonds
CC=golang-dev
https://golang.org/cl/4983042
2011-08-30 18:47:15 -07:00
Lucio De Re
4ca2172f38 gc: fix for Plan 9 build
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4977045
2011-08-30 09:40:46 -04:00
Russ Cox
4fb3c4f765 gc: fix div bug
R=ken2
CC=golang-dev
https://golang.org/cl/4950052
2011-08-30 08:47:28 -04:00
Lucio De Re
2d489e67dc gc: fix for Plan 9 build
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4975044
2011-08-30 08:00:07 -04:00
Robert Griesemer
d01ee38fb0 godoc: support for reading/writing (splitted) index files.
This CL implements a new godoc feature to save the search
index on disk. Use -write_index to create the search
index file named with -index_files. Use -index_files to
provide a glob pattern specifying index file(s) when
starting godoc; in this case the run-time indexer is not
run.

Known issues:
- saving/restoring full text index is not yet supported
- the list of flags and overall usage logic could use a
  cleanup

R=rsc, dsymonds
CC=golang-dev
https://golang.org/cl/4974045
2011-08-29 17:22:20 -07:00
Robert Griesemer
6b90262870 godoc: fix bug in zip.go
The result of sort.Search is in the interval [0,n);
specifically, if no entry is found, the result is n
and not -1.

R=dsymonds
CC=golang-dev
https://golang.org/cl/4982041
2011-08-29 16:49:31 -07:00
Andrew Gerrand
58b05e2448 goinstall: select the tag that is closest to runtime.Version
release.r50 looks for newest tag <= go.r50
weekly.2010-10-10 looks for newest tag <= go.2010-10-10

Implements behavior for hg, git, and bzr.

R=dsymonds, rsc, n13m3y3r
CC=golang-dev
https://golang.org/cl/4873057
2011-08-30 09:37:22 +10:00
Mateusz Czapliński
eae0a48cf5 libmach: support reading symbols from Windows .exe for nm
Fixes #979.

R=rsc, alex.brainman
CC=golang-dev, vcc.163
https://golang.org/cl/4894051
2011-08-29 14:25:43 -04:00
Yuval Pavel Zholkover
c20a338c2f runtime, syscall: use the vdso page on linux x86 for faster syscalls instead of int $0x80.
8l: fix handling CALL $(constant) code generated by 8a.
8a,8l: add indirect call instruction: CALL *data(SB).

R=rsc, iant
CC=golang-dev
https://golang.org/cl/4817054
2011-08-29 10:36:06 -04:00
Lucio De Re
b3cc4897be gc: fix build on Plan 9
gc/bits.c
. improved format with associated cast;
gc/closure.c
gc/dcl.c
gc/range.c
gc/reflect.c
gc/sinit.c
. dropped unnecessary assignments;
gc/gen.c
. dropped unnecessary assignment;
. added static qualifier to local function definition;
gc/go.h
. added varargck pragmas;
gc/lex.c
. used {} instead of ; in if statement to suppress warning;
. replaced exit(0) with exits(0);
. added compilation conditions for SIGBUS/SIGSEGV;
. dropped unnecessary assignment;
gc/mparith2.c
. dropped four unnecessary assignments/initialisations;
gc/obj.c
. added type cast to local pointer;
gc/pgen.c
. added cast and related print format;
gc/subr.c
. replaced exit(1) with exits("error");
. replaced unlink() with remove();
. renamed local cistrmp() as ucistrmp() to remove conflict with
  Plan 9 function by the same name;
gc/swt.c
. added braces instead of ; as empty statment;
gc/typecheck.c
. added static qualifier to local function definition;
. dropped unnecessary assignments;
gc/walk.c
. dropped unnecessary assignments;
. added static qualifier to local function definitions;

R=rsc
CC=golang-dev
https://golang.org/cl/4964046
2011-08-29 09:35:04 -04:00
Lucio De Re
219c9e9c46 6g: fix build on Plan 9
src/cmd/6g/cgen.c
src/cmd/6g/gobj.c
src/cmd/6g/reg.c
. dropped unused assignments;
src/cmd/6g/gg.h
. added varargck pragmas;
src/cmd/6g/list.c
. adjusted print format for ulong casts;
src/cmd/6g/peep.c
. dropped redundant increment;

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4953049
2011-08-29 09:34:59 -04:00