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

5235 Commits

Author SHA1 Message Date
Russ Cox
7e84666df1 gc: clearer error for struct == struct
cmp6.go:48: invalid operation: t3 == t3 (operator == not defined on struct)

Fixes #1438.

R=ken2
CC=golang-dev
https://golang.org/cl/4003045
2011-01-21 18:15:59 -05:00
Ian Lance Taylor
9e441e5215 net: Fix race condition in test.
The test code used to do this:

for _, tc := range tests {
	ch <- &tc
}

Note that &tc is always the same value here.  As the value is
received from the channel, the sender can loop around and
change the contents of tc.  This means that the receiver's
value is unstable and can change while it is in use.

R=adg, r2, rsc
CC=chris, golang-dev
https://golang.org/cl/3978043
2011-01-21 13:57:52 -08:00
Russ Cox
27c74d3499 spec, runtime, tests: send on closed channel panics
Close of closed channel panics.
Receive from closed channel never panics,
even if done repeatedly.

Fixes #1349.
Fixes #1419.

R=gri, iant, ken2, r, gri1, r2, iant2, rog, albert.strasheim, niemeyer, ejsherry
CC=golang-dev
https://golang.org/cl/3989042
2011-01-21 15:07:13 -05:00
Rob Pike
5b5a674b46 gob: better debugging, commentary
Re-implement the debugging helper to be independent of the existing
implementation.  This is preparatory to a rewrite to clean up issue 1416.
Include a definition of the grammar of the data stream.

R=rsc
CC=golang-dev
https://golang.org/cl/3970045
2011-01-21 11:28:53 -08:00
Luuk van Dijk
5cf120827c cc: remove pickle generation code.
R=rsc
CC=golang-dev
https://golang.org/cl/4083043
2011-01-21 17:59:35 +01:00
Anschel Schaffer-Cohen
3921d26300 Use defer to unlock mutex in crypto/rand.
R=agl1
CC=golang-dev
https://golang.org/cl/3991045
2011-01-21 10:14:43 -05:00
Anschel Schaffer-Cohen
49e2888a96 Fixed documentation for netchan import()
This was broken after the last update (2011-01-20).
	However, I'm not sure if the changed example is a
	sensible use of import(), so I'd appreciate comments.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4067043
2011-01-20 19:58:08 -08:00
Robert Griesemer
955aa159ad godoc: show line numbers for non-go files (bug fix)
Also: Give line numbers a style and make them less intrusive.

R=rsc
CC=golang-dev
https://golang.org/cl/4060043
2011-01-20 10:43:55 -08:00
Russ Cox
3c7104479c runtime: drop CLONE_PARENT
The functionality we want (shared ppid) is implied
by CLONE_THREAD already, and CLONE_PARENT
causes problems if the Go program is pid 1 (init).

See issue 1406 for more details.

Fixes #1406.

R=adg, iant
CC=golang-dev
https://golang.org/cl/3971044
2011-01-20 13:36:00 -05:00
Russ Cox
32a8f5a874 gotest: new cgo does not require LD_LIBRARY_PATH
Fixes #1410.

R=r
CC=golang-dev
https://golang.org/cl/4072043
2011-01-20 13:11:06 -05:00
Miek Gieben
40c7449044 encoding/base32: new package
R=rsc
CC=Miek Gieben, golang-dev
https://golang.org/cl/3926041
2011-01-20 12:51:15 -05:00
Russ Cox
ecbcd816dc unsafe: add missing case to doc for Pointer
Fixes #1433.

R=r, gri
CC=golang-dev
https://golang.org/cl/3999047
2011-01-20 12:50:50 -05:00
Russ Cox
50fe459ce2 6g: fix uint64(uintptr(unsafe.Pointer(&x)))
Fixes #1417.

R=ken2
CC=golang-dev
https://golang.org/cl/4079042
2011-01-20 12:50:35 -05:00
Russ Cox
8b8cd0e4c4 http: follow relative redirect in Get
Fixes #1431.

R=bradfitz, dangabrad
CC=golang-dev
https://golang.org/cl/4077042
2011-01-20 12:50:27 -05:00
Russ Cox
e8f2692ca2 5l: document -F, force it on old ARMs
Fixes #1341.

R=ken2, r
CC=golang-dev
https://golang.org/cl/4006045
2011-01-20 12:50:10 -05:00
Wei Guangjing
f1751e7de5 8l: emit DWARF in Windows PE.
R=rsc, lvd, brainman, Joe Poirier
CC=golang-dev
https://golang.org/cl/2124041
2011-01-20 11:28:30 -05:00
Wei Guangjing
1aa2d88739 cgo: windows/386 port
R=rsc, peterGo, brainman
CC=golang-dev
https://golang.org/cl/3733046
2011-01-20 10:22:20 -05:00
Wei Guangjing
3aec5516ed 6l: windows/amd64 port
R=rsc
CC=golang-dev
https://golang.org/cl/3746044
2011-01-20 09:21:10 -05:00
Hector Chu
6c240d7671 runtime: fix tabs in windows/386/sys.s
R=rsc, brainman
CC=golang-dev
https://golang.org/cl/4030043
2011-01-20 09:21:04 -05:00
Russ Cox
4f269d3060 runtime: make select fairer
The o+i*p approach to visiting select cases in random
order stops being fair when there is some case that
is never ready.  If that happens, then the case that follows
it in the order gets more chances than the others.

In general the only way to ensure fairness is to make
all permutations equally likely.  I've done that by computing
one explicitly.

Makes the permutations correct for n >= 4 where
previously they were broken.  For n > 12, there's not
enough randomness to do a perfect job but this should
still be much better than before.

Fixes #1425.

R=r, ken2, ejsherry
CC=golang-dev
https://golang.org/cl/4037043
2011-01-20 09:20:47 -05:00
Adam Langley
0bec484e6f crypto/openpgp: add s2k
s2k implements the string-to-key functions for OpenPGP

R=rsc
CC=golang-dev
https://golang.org/cl/3937043
2011-01-20 07:38:34 -05:00
Alex Brainman
6d94b14e19 syscall: include all, even duplictate, invented error messages
Otherwise syscall.Errstr() returns "" for some (EWOULDBLOCK) errors.

R=rsc
CC=golang-dev
https://golang.org/cl/3941041
2011-01-20 21:24:15 +11:00
Alex Brainman
de2184f3a8 net: get tests working to fix windows build
R=golang-dev
CC=golang-dev
https://golang.org/cl/4089041
2011-01-20 19:18:04 +11:00
Russ Cox
b7bf2a3a0b net: fix windows build (?)
TBR=adg
CC=golang-dev
https://golang.org/cl/4083042
2011-01-20 00:16:16 -05:00
Russ Cox
f2b5a07453 delete float, complex - code changes
also:
	cmplx -> complex
	float64(1.0) -> 1.0
	float64(1) -> 1.0

R=gri, r, gri1, r2
CC=golang-dev
https://golang.org/cl/3991043
2011-01-19 23:09:00 -05:00
Russ Cox
0849944694 gc: delete float, complex
rename cmplx -> complex

R=ken2
CC=golang-dev
https://golang.org/cl/4071041
2011-01-19 23:08:11 -05:00
Andrew Gerrand
5eb8c9baa7 net: remove duplicate import of runtime
R=rsc
CC=golang-dev
https://golang.org/cl/3999046
2011-01-20 12:56:32 +11:00
Andrew Gerrand
0b08119adc syscall: attempt to fix windows build, supply missing constant
R=r, brainman, rsc1
CC=golang-dev
https://golang.org/cl/4023043
2011-01-20 12:41:59 +11:00
Adam Langley
4a7fed4d90 crypto/twofish: update with rsc's comments
TBR=rsc

R=rsc
CC=berengar.lehr, golang-dev
https://golang.org/cl/4050042
2011-01-19 19:41:27 -05:00
Ken Thompson
7963b04a18 arm bug with stack adjust
R=r
CC=golang-dev
https://golang.org/cl/3980043
2011-01-19 16:30:13 -08:00
Robert Griesemer
a441037f3f godoc: enable fulltext index by default
- added flag -maxresults (default: 10000) to limit the max.
  number of full text results shown
- removed flag -fulltext; use -maxresults=0 to disable fulltext
  index
- better indication on result page if not all results are shown
  (... after line list)

R=rsc, gri1
CC=golang-dev
https://golang.org/cl/4049042
2011-01-19 14:33:05 -08:00
Robert Griesemer
4e3f389476 godoc: enable qualified identifiers ("math.Sin") as query strings again
A query string of the form ident.ident will be used both as a qualified
identifier for identifier search and as a regular expression.
Qualified identifier lookup got broken accidentally when introducing
regexp full text search. Cleaned up surrounding logic a bit.

R=rsc
CC=golang-dev
https://golang.org/cl/3984042
2011-01-19 12:48:10 -08:00
Gustavo Niemeyer
c52ad23461 xml: handle tag paths through the same element
With the current implementation, xml unmarshalling
will silently fail to unmarshal any paths passing
through the same element, such as:

type T struct {
	A string "dummy>a"
	B string "dummy>b"
}

This change tweaks the algorithm so that this works
correctly.

Also, using paths that would cause the same element to
unmarshal twice will error out ahead of time explaining
the problem, rather than silently misbehaving.

R=rsc
CC=golang-dev
https://golang.org/cl/4082041
2011-01-19 15:43:58 -05:00
Rob Pike
b99a6d465a runtime/debug: fix build (missing Makefile)
Why does this happen so often?

R=rsc
CC=golang-dev
https://golang.org/cl/4067042
2011-01-19 12:36:52 -08:00
Jeff R. Allen
1558834248 5a, 5l, 6a, 6l, 8a, 8l: handle out of memory, large allocations
Fixes #392.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/2732042
2011-01-19 15:30:26 -05:00
Roger Peppe
6fb1bf26ae netchan: do not block sends; implement flow control.
When data is received for a channel, but that channel
is not ready to receive it, the central run() loop
is currently blocked, but this can lead to deadlock
and interference between independent channels.
This CL adds an explicit buffer size to netchan
channels (an API change) - the sender will not
send values until the buffer is non empty.

The protocol changes to send ids rather than channel names
because acks can still be sent after a channel is hung up,
we we need an identifier that can be ignored.

R=r, rsc
CC=golang-dev
https://golang.org/cl/2447042
2011-01-19 12:28:49 -08:00
Rob Pike
89993544c2 runtime/debug: new package
Facilities for printing stack traces from within a running goroutine.

R=rsc
CC=golang-dev
https://golang.org/cl/4031041
2011-01-19 12:28:38 -08:00
Russ Cox
035fcb0da2 net: fix build on freebsd
TBR=adg
CC=golang-dev
https://golang.org/cl/3992044
2011-01-19 15:24:25 -05:00
Brad Fitzpatrick
f96c1d076a http: support for relative URLs
R=rsc, adg
CC=golang-dev
https://golang.org/cl/4002041
2011-01-19 15:13:42 -05:00
Kyle Lemons
a4f6ed3574 net: add LookupAddr
R=adg, rsc
CC=golang-dev
https://golang.org/cl/3851041
2011-01-19 15:11:03 -05:00
Hector Chu
aae5f91213 windows: implement exception handling
R=rsc, brainman
CC=golang-dev
https://golang.org/cl/4079041
2011-01-19 15:10:15 -05:00
Alex Brainman
48d2de7eb9 8l: pe changes
Dll names and function names padded to even size.
Refactoring of imports writing code.

R=rsc
CC=golang-dev
https://golang.org/cl/3804042
2011-01-19 15:10:01 -05:00
Wei Guangjing
ff25900bb6 net: implement windows timeout
R=brainman, rsc
CC=golang-dev
https://golang.org/cl/1731047
2011-01-19 14:49:25 -05:00
Albert Strasheim
3a97119517 net, syscall: return source address in Recvmsg
R=rsc
CC=golang-dev
https://golang.org/cl/3766042
2011-01-19 14:34:53 -05:00
Sebastien Binet
655da99627 cgo: add complex float, complex double
R=rsc
CC=binet, golang-dev
https://golang.org/cl/3906041
2011-01-19 14:30:57 -05:00
Eoghan Sherry
13c2e62966 math: handle denormals in Frexp, Ilogb, Ldexp, and Logb
Also:
* document special cases for Frexp and Ldexp
* handle ±Inf in Ldexp
* correctly return -0 on underflow in Ldexp
* test special cases for Ldexp
* test boundary cases for Frexp, Ilogb, Ldexp, and Logb

R=rsc
CC=golang-dev
https://golang.org/cl/3676041
2011-01-19 14:23:59 -05:00
Albert Strasheim
01fad6a6b0 net: add unixpacket
R=golang-dev, rsc, rsc1
CC=golang-dev
https://golang.org/cl/2309043
2011-01-19 14:21:58 -05:00
Ben Lynn
eb56a79e99 regexp: reject bare ?
Minor cleanup:
  - removed a duplicate test case
  - added a function to remove repeated code
  - for consistency, replaced "return nil" with a panic at an
    unreachable point

Fixes #1428.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/4057042
2011-01-19 13:47:04 -05:00
Russ Cox
bcd910cfe2 runtime: add per-pause gc stats
R=r, r2
CC=golang-dev
https://golang.org/cl/3980042
2011-01-19 13:41:42 -05:00
Russ Cox
61a4e9812e fmt: document %X of string, []byte
suggested by Mark Summerfield

R=r
CC=golang-dev
https://golang.org/cl/4018042
2011-01-19 13:35:45 -05:00
Clement Skau
49741f23d5 http: fix Content-Range and Content-Length in response
RFC2616 sections 4.4 and 14.16:
  * Cannot use Content-Length with non-identity Transfer-Encoding
  * Content-Range response is "bytes x-y/z" not "x-y/z"

R=rsc
CC=golang-dev
https://golang.org/cl/4018041
2011-01-19 10:05:48 -05:00
Corey Thomasson
43582bad33 net: avoid nil dereference if /etc/services can't be opened
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4081041
2011-01-19 09:55:46 -05:00
Yasuhiro Matsumoto
4a7cdc7944 syscall: fix build. WUNTRACED isn't defined for win32.
For Windows, the options for syscall.Wait4() aren't used.
Then this will be dummy value like WNOHANG, WSTOPPED.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4075041
2011-01-18 23:00:19 -08:00
Rob Pike
052ff45690 crypto/cipher: fix build (missing file in Makefile)
R=agl, adg
CC=golang-dev
https://golang.org/cl/4073041
2011-01-18 20:56:55 -08:00
Ken Thompson
eead5e8879 arm register allocation/tempname allocation bug
R=r
CC=golang-dev
https://golang.org/cl/4008044
2011-01-18 20:45:17 -08:00
Adam Langley
9b6d8b3c4f crypto/cipher: add OFB mode
R=rsc, r
CC=golang-dev
https://golang.org/cl/3994042
2011-01-18 18:16:06 -05:00
Russ Cox
3e0adc9ffb cc: fix vlong condition
Fixes #1032.

R=ken2
CC=golang-dev
https://golang.org/cl/4025043
2011-01-18 16:28:21 -05:00
Russ Cox
b0543ddd8a gc, runtime: make range on channel safe for multiple goroutines
Fixes #397.

R=ken2
CC=golang-dev
https://golang.org/cl/3994043
2011-01-18 15:59:19 -05:00
Gustavo Niemeyer
3426b80dd9 xml: support for > in tags
This introduces support for selecting which subelement
to unmarshal into a given struct field by providing a
nesting path separated by the > character.

R=rsc
CC=golang-dev
https://golang.org/cl/4066041
2011-01-18 15:39:38 -05:00
Russ Cox
12307008e9 runtime: print signal information during panic
$ 6.out
panic: runtime error: invalid memory address or nil pointer dereference

[signal 11 code=0x1 addr=0x0 pc=0x1c16]

runtime.panic+0xa7 /Users/rsc/g/go/src/pkg/runtime/proc.c:1089
	runtime.panic(0xf6c8, 0x25c010)
runtime.panicstring+0x69 /Users/rsc/g/go/src/pkg/runtime/runtime.c:88
	runtime.panicstring(0x24814, 0x0)
runtime.sigpanic+0x144 /Users/rsc/g/go/src/pkg/runtime/darwin/thread.c:465
	runtime.sigpanic()
main.f+0x16 /Users/rsc/x.go:5
	main.f()
main.main+0x1c /Users/rsc/x.go:9
	main.main()
runtime.mainstart+0xf /Users/rsc/g/go/src/pkg/runtime/amd64/asm.s:77
	runtime.mainstart()
runtime.goexit /Users/rsc/g/go/src/pkg/runtime/proc.c:149
	runtime.goexit()

R=r
CC=golang-dev
https://golang.org/cl/4036042
2011-01-18 14:15:11 -05:00
Russ Cox
acd858eee0 syscall: correct WSTOPPED on OS X
Have to set #defines correctly to get correct value.
Otherwise get a mask for use in implementing WIFSTOPPED(status).

Changed WSTOPPED definition in os because on
OS X WSTOPPED and WUNTRACED have different values
even though they seem to mean the same thing.

Fixes #1374.

R=r, r2
CC=golang-dev
https://golang.org/cl/4063042
2011-01-18 14:02:41 -05:00
Robert Griesemer
1b112c2297 godoc: bring back "indexing in progress" message
A wrongly nested if prevented the message from appearing.

Fixes #1420.

R=r, r2
CC=golang-dev
https://golang.org/cl/3987043
2011-01-18 10:59:54 -08:00
Anthony Martin
661bcb773b gc: fix typed constant declarations
Fixes #1411.

R=rsc, gri, ejsherry
CC=golang-dev
https://golang.org/cl/4035042
2011-01-18 11:24:49 -05:00
Jos Visser
25f762c75b expvar: add Float
R=r, rsc, dsymonds
CC=golang-dev
https://golang.org/cl/4044041
2011-01-18 11:24:43 -05:00
Ian Lance Taylor
2862d003cb syscall: Correct length of GNU/Linux abstract Unix domain sockaddr.
R=rsc, iant2
CC=golang-dev
https://golang.org/cl/3974044
2011-01-18 08:10:22 -08:00
Ken Thompson
fa9befd777 arm reg bug with SP adjust
after call to deferproc

R=r
CC=golang-dev
https://golang.org/cl/4059041
2011-01-17 20:39:26 -08:00
Ken Thompson
3537b79329 arm bug address of a string
R=r
CC=golang-dev
https://golang.org/cl/4004042
2011-01-17 13:27:05 -08:00
Ken Thompson
3965519ae5 arm reg bug with address(variable)
R=r
CC=golang-dev
https://golang.org/cl/4047041
2011-01-16 15:25:13 -08:00
Ken Thompson
6432471497 disable reg - tar test failed
R=r
CC=golang-dev
https://golang.org/cl/3969042
2011-01-15 17:11:24 -08:00
Ken Thompson
2c35e548bb arm reg bug MOVW into bool variable
R=r
CC=golang-dev
https://golang.org/cl/4034042
2011-01-15 16:55:47 -08:00
Rob Pike
7b4495c041 bytes.Buffer: fix typo in comment (doubled 'to')
R=ken2
CC=golang-dev
https://golang.org/cl/4035041
2011-01-14 23:00:02 -08:00
Russ Cox
141a4a1759 runtime: fix arm reflect.call boundary case
The fault was lucky: when it wasn't faulting it was silently
copying a word from some other block and later putting
that same word back.  If some other goroutine had changed
that word of memory in the interim, too bad.

The ARM code was inconsistent about whether the
"argument frame" included the saved LR.  Including it made
some things more regular but mostly just caused confusion
in the places where the regularity broke.  Now the rule
reflects reality: argp is always a pointer to arguments,
never a saved link register.

Renamed struct fields to make meaning clearer.

Running ARM in QEMU, package time's gotest:
  * before: 27/58 failed
  * after: 0/50

R=r, r2
CC=golang-dev
https://golang.org/cl/3993041
2011-01-14 14:05:20 -05:00
Ian Lance Taylor
5adfe93752 cgo: In _cgo_main.c define all provided symbols as functions.
This defines crosscall2 in a way that matches that real
definition, and also defines _cgo_allocate and _cgo_panic to
indicate that they are available to be called by code compiled
with gcc.

R=rsc
CC=golang-dev
https://golang.org/cl/4026041
2011-01-14 10:52:08 -08:00
Ian Lance Taylor
b97005c1d3 runtime/cgo: Don't define crosscall2 in dummy _cgo_main.c.
In this specific package crosscall2 is already defined in a .S
file anyhow.  This avoids a warning about mismatched
alignment.

R=rsc
CC=golang-dev
https://golang.org/cl/4000043
2011-01-14 10:51:47 -08:00
Ian Lance Taylor
18941a75b7 syscall: Correct length of SockaddrUnix.
R=rsc
CC=golang-dev
https://golang.org/cl/4025041
2011-01-14 10:50:51 -08:00
Robert Griesemer
157cd6ef3a gofmt, go/printer: do not insert extra linebreaks where they may break the code
Introduced a printer mode (pmode) type and corresponding
pmode values which permit easy toggling of the current
printer mode for fine-tuning of layout.

Use the printer mode to disable potential introduction of
line breaks before a closing '}' in composite literals.

Added extra test case. Applied gofmt to src and misc.

Fixes #1365.

R=r2
CC=golang-dev
https://golang.org/cl/4008041
2011-01-14 09:42:37 -08:00
Ken Thompson
a093f3d5a0 fix tst instruction on arm to set overflow bit
R=r
CC=golang-dev
https://golang.org/cl/4009041
2011-01-13 20:05:08 -08:00
Robert Griesemer
4ed7c59a50 fix build (this time for real): adjust typechecker test, ogle
R=r, r2
CC=golang-dev
https://golang.org/cl/4006041
2011-01-13 17:41:45 -08:00
Robert Griesemer
8b41055656 fix build (submitted a modified parser.go file by mistake)
R=r
CC=golang-dev
https://golang.org/cl/4005041
2011-01-13 17:26:38 -08:00
Robert Griesemer
bff2c207e4 go/scanner: Make Init take a *token.File instead of a *token.FileSet.
Until now, each scan of a file added a new file to the file set.
With this change, a file can be re-scanned using the same *token.File
w/o changing the file set. Eventually this will enable the re-use of
cached source code in godoc (for the fulltext index). At the moment,
source files are read over and over again from disk.

This is the first step in that direction.

R=r, rsc, r2
CC=golang-dev
https://golang.org/cl/4001041
2011-01-13 17:20:26 -08:00
Rob Pike
b814cca3c3 cmath test: fix format (%g does not print booleans)
R=ken
CC=golang-dev
https://golang.org/cl/4003041
2011-01-13 16:30:56 -08:00
Ken Thompson
2a74009675 add TST op code
R=r
CC=golang-dev
https://golang.org/cl/4000041
2011-01-13 15:34:52 -08:00
Brad Fitzpatrick
b448263f79 http: fix scheme-relative URL parsing; add ParseRequestURL
Also adds some tests for Issue 900 which was the reason
the current URL parsing is broken.  (the previous fix
was wrong)

R=rsc, adg, dangabrad, bradfitzwork
CC=golang-dev
https://golang.org/cl/3910042
2011-01-14 09:10:02 +11:00
Robert Griesemer
f6f1401286 godoc: don't double HTML-escape search result snippets
Fixes #1412.

R=rsc, r
CC=golang-dev
https://golang.org/cl/3994041
2011-01-13 12:44:04 -08:00
Russ Cox
cdb0bbf4d5 http: handle HEAD requests correctly
R=r, r2
CC=golang-dev
https://golang.org/cl/3939042
2011-01-13 14:34:31 -05:00
Robert Griesemer
d4bdaf11d9 godoc: peephole optimization for generated HTML
When searching for regular expressions such as
".", there are many consecutive matches.
In the generated HTML, combine them instead of
generating a new <span> for each adjacent text
segment highlighting a match.

Massively reduces the size of the generated
HTML in those cases.

R=r, rsc
CC=golang-dev
https://golang.org/cl/3971041
2011-01-13 10:23:42 -08:00
Rob Pike
d88f717da6 disable arm registifier for the moment
R=ken2, ken3
CC=golang-dev
https://golang.org/cl/3970041
2011-01-12 16:17:14 -08:00
Rob Pike
51b8d23e3b rpc: export names in debug service so it works with template changes
R=dsymonds
CC=golang-dev
https://golang.org/cl/3760049
2011-01-12 15:23:21 -08:00
Gustavo Niemeyer
6f6b7e3a33 goinstall: Fix template to use exported fields
It's currently broken due to f6d5bac536c5.

R=r, r2
CC=golang-dev
https://golang.org/cl/3967041
2011-01-12 10:45:24 -08:00
Rob Pike
699864b696 encoding/line: fix error call (missing argument)
R=agl1, rsc
CC=golang-dev
https://golang.org/cl/3861044
2011-01-12 00:25:29 -08:00
Rob Pike
29cbad6c72 template: give "unexported" error when accessing an unexported field.
R=adg, rsc
CC=golang-dev
https://golang.org/cl/3903043
2011-01-12 00:25:17 -08:00
Eric Eisner
e3c9565b43 suffixarray: faster creation algorithm
This implements the algorithm qsufsort using the sort package
as a sorting primitive. Its worst-case performance is O(N*log(N)), and it
uses only an additional slice of N ints of memory during creation.

Benchmarks (seconds):
           old    new
10k nulls          149    0.044
1M English corpus  32.0   3.6

R=gri, gri1
CC=golang-dev
https://golang.org/cl/3752044
2011-01-11 21:46:50 -08:00
Robert Griesemer
7b4a4d3788 godoc: remove TODO (bug257.go can now be indexed)
Pending CL 3752044.

R=r, r2
CC=golang-dev
https://golang.org/cl/3949042
2011-01-11 21:24:44 -08:00
Alex Brainman
3a052b5f54 net: use closesocket api instead of CloseHandle on Windows
thanks to piotrnar for the original CL.
Fixes #1371.

R=rsc
CC=golang-dev
https://golang.org/cl/3834042
2011-01-12 15:55:17 +11:00
Rob Pike
a80cdcbe0a gob: make (en|dec)code(Ui|I)nt methods rather than functions.
No functional (ha!) change.

R=rsc
CC=golang-dev
https://golang.org/cl/3959041
2011-01-11 17:56:45 -08:00
Adam Langley
5aeacadc5a crypto/openpgp: add error and armor
error is needed by all the OpenPGP packages as they return a shared
family of error types.

armor implements OpenPGP armoring. It's very like PEM except:
  a) it includes a CRC24 checksum
  b) PEM values are small (a few KB) and so encoding/pem assumes that
     they fit in memory. Armored data can be very large and so this
     package presents a streaming interface.

R=r, nsz, rsc
CC=golang-dev
https://golang.org/cl/3786043
2011-01-11 20:54:30 -05:00
Berengar Lehr
1aec7c7f34 crypto: add twofish package
The code was (as annotated in the source code) adopted from Tom's
LibCrypt (public domain code, [1]). It was neither optimised for speed
nor were any security features added.

[1] http://libtom.org/?page=features&newsitems=5&whatfile=crypt

R=rsc, berengarlehr, albert.strasheim, agl1
CC=golang-dev, schulze
https://golang.org/cl/2687042
2011-01-11 20:51:35 -05:00
Ken Thompson
1c99bdc8e5 turn off peep half of optimizer for release
R=r
CC=golang-dev
https://golang.org/cl/3919043
2011-01-11 17:30:25 -08:00
Andrew Gerrand
09d4bcf0f7 json: do not Marshal unexported struct fields
R=r, cw, niemeyer, rsc
CC=golang-dev
https://golang.org/cl/3952041
2011-01-12 11:59:33 +11:00
Alex Brainman
a41d85498e runtime: revert 6974:1f3c3696babb
I missed that environment is used during runtime setup,
well before go init() functions run. Implemented os-dependent
runtime.goenvs functions to allow for different unix, plan9 and
windows versions of environment discovery.

R=rsc, paulzhol
CC=golang-dev
https://golang.org/cl/3787046
2011-01-12 11:48:15 +11:00
Andrew Gerrand
217693e93c os: add Sync to *File, wraps syscall.Fsync
R=rsc, brainman, r, r2
CC=golang-dev
https://golang.org/cl/3887042
2011-01-12 11:08:39 +11:00
Rob Pike
02e88019f2 template: allow accesses only to exported fields and methods
R=rsc, gri
CC=golang-dev
https://golang.org/cl/3890042
2011-01-11 15:47:45 -08:00
Ian Lance Taylor
ac1c09458c ld: Fix exported dynamic symbols on 386 Mach-O.
R=rsc
CC=golang-dev
https://golang.org/cl/3948043
2011-01-11 14:43:28 -08:00
Russ Cox
cc928b7b6e http: fix text displayed in Redirect
In the case where r.Method == "POST", was
calling Printf with an argument but "" format string,
causing a spurious %!EXTRA(...) message.

Also escape string properly in HTML generation.

R=r
CC=golang-dev
https://golang.org/cl/3923043
2011-01-11 17:15:28 -05:00
Ian Lance Taylor
3a43ff1a77 ld: Fix exported dynamic symbols on Mach-O.
* Avoid confusion between imported and exported symbols.
* Record number of imported and exported symbols correctly.
* Explictly relocate SMACHOSYM section, since it is not in datap.

R=rsc
CC=golang-dev
https://golang.org/cl/3920042
2011-01-11 13:56:47 -08:00
Rob Pike
3036604b4c gob: do not encode or decode unexported fields
Such fields are simply ignored.

R=rsc, r2
CC=golang-dev
https://golang.org/cl/3889043
2011-01-11 13:44:00 -08:00
Rob Pike
feb8d0b2ba netchan: make fields public for pending gob change
R=rsc
CC=golang-dev
https://golang.org/cl/3882042
2011-01-11 13:43:43 -08:00
Anthony Martin
fee3aca2e0 syscall: fix mksysnum_linux.sh
A few system call numbers on x86 Linux are
defined in terms of a previous definition,

e.g.,
	#define __NR_timer_create	259
	#define __NR_timer_settime	(__NR_timer_create+1)
	...
	#define __NR_mq_open		277
	#define __NR_mq_unlink		(__NR_mq_open+1)

This change assumes the numbers are sorted
sequentially in the input file.

R=rsc, bradfitzwork
CC=golang-dev
https://golang.org/cl/3946041
2011-01-11 14:38:14 -05:00
Ian Lance Taylor
882f9d6d7a ld: Permit an Mach-O symbol to be exported in the dynamic symbol table.
Submitting TBR to fix Darwin build.

R=rsc
TBR=rsc
CC=golang-dev
https://golang.org/cl/3912043
2011-01-11 11:22:47 -08:00
Gustavo Niemeyer
03b46849f2 goinstall: preliminary support for cgo packages
Can handle cgo packages now but only if they
do not need to set CGO_LDFLAGS and CGO_CFLAGS.

R=adg, rsc
CC=golang-dev
https://golang.org/cl/3891042
2011-01-11 13:14:48 -05:00
Rob Pike
f9f196c2a0 log: add methods for exit and panic
There were already functions for the standard logger;
this just completes the set.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/3901043
2011-01-11 09:57:47 -08:00
Ian Lance Taylor
17d50d8664 runtime/cgo: Add callbacks to support SWIG.
R=rsc, iant2, r
CC=golang-dev
https://golang.org/cl/3886041
2011-01-11 09:36:44 -08:00
Russ Cox
5b8bcf2324 godefs: better handling of enums
Fixes #432.

R=r, r2
CC=golang-dev
https://golang.org/cl/3869043
2011-01-11 11:12:15 -05:00
Gustavo Niemeyer
9f178edf51 cgo: export unsafe.Pointer as void*
This will enable functions which use unsafe.Pointer as an argument
to be correctly exported by cgo.

R=rsc
CC=golang-dev
https://golang.org/cl/3849043
2011-01-11 11:12:06 -05:00
Gustavo Niemeyer
632be89407 cgo: output alignment fix
R=rsc
CC=golang-dev
https://golang.org/cl/3902044
2011-01-11 10:17:54 -05:00
Gustavo Niemeyer
02ff646fef cgo: fix enum const conflict
This change prevents enum consts from conflicting with themselves
when loaded twice in different go files.

Fixes #1400.

R=rsc
CC=golang-dev
https://golang.org/cl/3849044
2011-01-11 10:15:49 -05:00
Robert Griesemer
4bdaf59cc9 godoc: support for regular expression full text search
Regular expressions may now be used in conjuction with full text
search. Godoc will show the first 10000 occurences in the source
code and highlight the respective text segments.

- added new flag -testDir to specify a small directory for testing
  (fast index creation; default = "")

- use new FormatText function to format text and Go source
  code in HTML, supporting multiple kinds of text selections
  simulatenously); this replaces the uses of go/printer
  Stylers

- for now removed currently unused mechanism for identifier-
  specific JS popups (will come back in some form once we
  have type or other useful information)

- various typo fixes and minor cleanups throughout

Missing:
- indexing of non-.go files

R=r, r2
CC=golang-dev, rsc
https://golang.org/cl/3699041
2011-01-10 15:34:29 -08:00
Ken Thompson
ab4d8bf16c arm optimizer bug fixes
R=rsc
CC=golang-dev
https://golang.org/cl/3913043
2011-01-10 13:15:52 -08:00
Roger Peppe
212e074be2 time: add AfterFunc to call a function after a given duration.
The After code is trivially generalisable to provide support
for this, and it is possible to use AfterFunc to do
things that After cannot, such as waiting
for many events at varied times without an overhead
of one goroutine per event.

R=rsc, r
CC=golang-dev
https://golang.org/cl/3905041
2011-01-10 11:51:38 -08:00
Robert Griesemer
23410ced69 go/ast: correct end position for Index and TypeAssert expressions
- added position information for [ and ] brackets of Index and Slice expression nodes
- removed a TODO in go/printer

R=r, rsc
CC=golang-dev
https://golang.org/cl/3867045
2011-01-10 11:26:04 -08:00
Peter Mundy
2b0a276129 bytes: fix TrimSpace typo
Fixes #1401.

R=golang-dev, agl1
CC=golang-dev
https://golang.org/cl/3937041
2011-01-09 12:11:16 -05:00
Eoghan Sherry
0c02bd1801 time: fix tick accuracy when using multiple Tickers
* correctly ignore obsolete ticks
* fix update of next alarm time
* tighten alarm channel buffers
Fixes #1379.

R=r, adg, r2
CC=golang-dev, soul9
https://golang.org/cl/3789045
2011-01-08 21:24:44 -08:00
Ian Lance Taylor
2d39303429 runtime: Restore scheduler stack position if cgo callback panics.
If we don't do this, then when C code calls back to Go code
which panics, we lose space on the scheduler stack.  If that
happens a lot, eventually there is no space left on the
scheduler stack.

R=rsc
CC=golang-dev
https://golang.org/cl/3898042
2011-01-08 10:22:37 -08:00
Adam Langley
66a45b486b encoding/line: add
I needed a way to read lines without worrying about \n and \r\n.

R=r, rsc
CC=golang-dev
https://golang.org/cl/2859041
2011-01-08 10:29:37 -05:00
Ken Thompson
4ed17ceace add peep
R=rsc
CC=golang-dev
https://golang.org/cl/3902042
2011-01-07 18:20:26 -08:00
Ken Thompson
90ca4d75a4 initial cut at arm optimizer
R=rsc
CC=golang-dev
https://golang.org/cl/3921041
2011-01-07 18:04:48 -08:00
Rob Pike
80055c658b arm: fix build
previous version was built with -l32; should be -b32

R=ken
CC=golang-dev
https://golang.org/cl/3867044
2011-01-07 17:17:42 -08:00
Robert Griesemer
a6820b65cb gofmt: don't attempt certain illegal rewrites
(e.g.: echo 'package main' | gofmt -r 'x->7'
cannot change the package name to 7)

R=rsc
CC=golang-dev
https://golang.org/cl/3913041
2011-01-07 15:04:41 -08:00
Rob Pike
f383062e01 time.NewTicker: panic for intervals <= 0.
Not absolutely certain it's right to do this, but since there's
no error value coming back, it seems reasonable.

Fixes #1392.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/3896042
2011-01-07 14:41:46 -08:00
Rob Pike
353fd1014c bytes.Buffer: Fix bug in UnreadByte.
Error check was inverted.

Fixes #1396.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/3851042
2011-01-07 14:41:33 -08:00
Robert Griesemer
9d634e50c7 gofmt: rewriter matches apply to expressions only
Fixes #1384.

R=rsc
CC=golang-dev
https://golang.org/cl/3912041
2011-01-07 13:33:29 -08:00
Adam Langley
ee58cc799e crypto/block: mark as deprecated.
R=rsc
CC=golang-dev
https://golang.org/cl/3909041
2011-01-07 16:17:47 -05:00
Ian Lance Taylor
1b2d5b4c93 ld: Permit an ELF symbol to be exported in the dynamic symbol table.
This permits exporting crosscall2 from the runtime/cgo
package.

R=rsc
CC=golang-dev
https://golang.org/cl/3885041
2011-01-06 16:37:05 -08:00
Russ Cox
02327a72d7 cgo: disallow use of C.errno
It's incorrect, and it causes cryptic linker errors.

Fixes #1360.

R=r, r2
CC=golang-dev
https://golang.org/cl/3880041
2011-01-06 15:15:31 -05:00
Russ Cox
c1fbe589a9 Make.pkg: use installed runtime.h for cgo
Fixes #1381.

R=r, r2
CC=golang-dev
https://golang.org/cl/3775050
2011-01-06 15:15:22 -05:00
Anthony Martin
db89e19d26 runtime/cgo: fix stackguard on FreeBSD/amd64
A cursory reading of the cgo code suggests this
should be necessary, though I don't have access
to a FreeBSD machine for testing.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/3746047
2011-01-06 11:36:47 -05:00
Russ Cox
2281ca169c gc: fix &^=
Fixes #1394.

R=ken2
CC=golang-dev
https://golang.org/cl/3879041
2011-01-06 11:21:18 -05:00
Russ Cox
a46102d209 crypto/cipher: make NewCBCEncrypter return BlockMode
Fixes #1389.

R=agl1
CC=golang-dev
https://golang.org/cl/3827043
2011-01-06 11:21:04 -05:00
Kyle Consalus
754f0402c3 Made format string handling more efficient.
R=rsc, r, r2
CC=golang-dev
https://golang.org/cl/3421042
2011-01-05 11:42:35 -08:00
Russ Cox
0f26608ebc io: fix Copyn EOF handling
Fixes #1383.

R=r
CC=golang-dev
https://golang.org/cl/3821044
2011-01-05 14:35:13 -05:00
Russ Cox
189d4ff776 syscall: correct Linux Splice definition
Fixes #1376.

R=r
CC=golang-dev
https://golang.org/cl/3869042
2011-01-05 14:35:07 -05:00
Kyle Lemons
ddc2710d69 goinstall: add -clean flag
R=adg, rsc
CC=golang-dev
https://golang.org/cl/3821042
2011-01-05 14:34:59 -05:00
Anthony Martin
94df1a067c gc: return constant floats for parts of complex constants
Fixes #1369.

R=rsc
CC=golang-dev
https://golang.org/cl/3731046
2011-01-05 13:12:30 -05:00
Rob Pike
c0332fc93f fmt: normalize processing of format string
The old loop was a bit odd; change it to be more regular.
This also enables a diagnostic for Printf("%", 3): %!(NOVERB)

R=rsc, Kyle C
CC=golang-dev
https://golang.org/cl/3749044
2011-01-05 10:11:34 -08:00
Brad Fitzpatrick
d71d08af5a http: permit empty Reason-Phrase in response Status-Line
Fixes #1388.

R=rsc
CC=golang-dev
https://golang.org/cl/3749043
2011-01-05 13:09:38 -05:00
Robert Griesemer
4a7d1f2061 go/ast: correct Pos/End ranges for field lists
R=rsc
CC=golang-dev
https://golang.org/cl/3797045
2011-01-05 10:08:39 -08:00
Rob Pike
d84317ba58 gob: generate a better error message in one confusing place
(with maybe more to come) by printing a human-readable
representation of a remote type.

R=rsc
CC=golang-dev
https://golang.org/cl/3802045
2011-01-05 09:28:47 -08:00
Ian Lance Taylor
e9c4f09985 syscall: Make Access second argument consistently uint32.
Fixes #1377.

R=rsc, adg, r
CC=golang-dev
https://golang.org/cl/3868041
2011-01-04 22:28:31 -08:00
Roger Peppe
2f5a5be237 strings: fix description of FieldsFunc
R=r
CC=golang-dev
https://golang.org/cl/3814041
2011-01-04 16:23:29 -08:00
Robert Griesemer
8184778abf fix occurrences of occur[^sr .,?!;\n]
R=r, r2
CC=golang-dev
https://golang.org/cl/3794043
2011-01-04 13:16:50 -08:00