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

2908 Commits

Author SHA1 Message Date
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