Rob Pike [Wed, 25 Nov 2009 05:07:05 +0000 (21:07 -0800)]
fix weird all.bash failures by running deps.bash before make clean runs in pkg directory.
before this change, if pkg/Make.deps is missing or broken, clean.bash fails and the build dies
but not until much later.
add freebsd to error message about valid values of $GOOS
TODO: would be nice if this process exited when an error occurred. subshells make it hard
Robert Griesemer [Wed, 25 Nov 2009 01:20:13 +0000 (17:20 -0800)]
Replace sort.Sort call with heapify algorithm in Init.
Fixed package comment.
Renamed some variables for symmetry, added more internal comments and more tests.
Fixes #304.
Rob Pike [Tue, 24 Nov 2009 22:04:43 +0000 (14:04 -0800)]
change the rules for maintaining AUTHORS and CONTRIBUTORS files.
the current system is too painful, so instead let's just have the coders tell us the details.
we can update the files ourselves.
Robert Griesemer [Tue, 24 Nov 2009 21:43:18 +0000 (13:43 -0800)]
Change to container/vector interface:
- removed New(len int) in favor of new(Vector).Resize(len, cap)
- removed Init(len int) in favor of Resize(len, cap)
- runs all.bash
Sergio Luis O. B. Correia [Tue, 24 Nov 2009 01:32:51 +0000 (17:32 -0800)]
go: makes it build for the case $GOROOT has whitespaces
the bash scripts and makefiles for building go didn't take into account
the fact $GOROOT / $GOBIN could both be directories containing whitespaces,
and was not possible to build it in such a situation.
this commit adjusts the various makefiles/scripts to make it aware of that
possibility, and now it builds successfully when using a path with whitespaces
as well.
Sergio Luis O. B. Correia [Tue, 24 Nov 2009 00:00:26 +0000 (16:00 -0800)]
cmd/cc: change getquoted() to accept whitespaces.
getquoted() currently checks for whitespaces and returns nil
if it finds one. this prevents us from having go in a path
containing whitespaces, as the #pragma dynld directives are
processed through the said function.
this commit makes getquoted() accept whitespaces, and this is
also needed for solving issue #115.
Robert Griesemer [Fri, 20 Nov 2009 19:50:11 +0000 (11:50 -0800)]
Support for basic try-catch style exception handling.
Meant as illustration of the Go pattern that is using
goroutines and channels to handle exceptional situations.
Note: There is no need for "Finally" since the
"try block" (the function f supplied to Try)
cannot do a Smalltalk-style non-local return
and terminate the function surrounding Try.
Russ Cox [Fri, 20 Nov 2009 17:11:46 +0000 (09:11 -0800)]
x[lo:] - gc and runtime.
* add runtime sliceslice1 for x[lo:]
* remove runtime arraytoslice, rewriting &arr into arr[0:len(arr)].
* port cgen_inline into 8g, 5g.
* use native memmove in maps
Russ Cox [Fri, 20 Nov 2009 16:59:11 +0000 (08:59 -0800)]
test/bench revisions;
* reverse-complement: port C algorithm to Go
saves 30% on my MacBook Pro and makes it a fairer comparison.
* test reverse-complement with and without GC (another 15%)
* revise timing.sh to work on more systems
* avoid two glibcisms in fasta.c
James Meneghello [Fri, 20 Nov 2009 05:08:05 +0000 (21:08 -0800)]
Map support for template.Execute().
Allows the developer to pass a map either by itself for
evaluation, or inside a struct. Access to data inside
maps is identical to the current system for structs, ie.
-Psuedocode-
mp map[string]string = {
"header" : "A fantastic header!",
"footer" : "A not-so-fantastic footer!",
}
template.Execute(mp)
...can be accessed using {header} and {footer} in
the template. Similarly, for maps inside structs:
type s struct {
mp map[string]string,
}
s1 = new s
s1.mp["header"] = "A fantastic header!";
template.Execute(s1)
...is accessed using {mp.header}. Multi-maps, ie.
map[string](map[string]string) and maps of structs
containing more maps are unsupported, but then, I'm
not even sure if that's supported by the language.
Map elements can be of any type that can be written
by the formatters. Keys should really only be strings.
Evan Shaw [Fri, 20 Nov 2009 04:43:30 +0000 (20:43 -0800)]
archive/tar: Make Reader and Writer more closely follow io.Reader and io.Writer interfaces
There's no functional change here. io gives the Read and Write methods byte slice arguments, but tar called them uint8. It's the same thing, but I think this is clearer and it matches what other packages do.
Rob Pike [Fri, 20 Nov 2009 00:45:50 +0000 (16:45 -0800)]
two easy optimizations for regexp:
1) if char class contains a single character, make it a single character.
(this is used to quote, e.g. [.] rather than \.
2) if regexp begins with ordinary text substring, use plain string match to start engine
Trevor Strohman [Fri, 20 Nov 2009 00:35:34 +0000 (16:35 -0800)]
Adds benchmark support to gotest.
No benchmarks are run unless the --benchmarks=<regexp> flag
is specified on the gotest command line. This change includes
sample benchmarks for regexp.
Rob Pike [Thu, 19 Nov 2009 03:23:08 +0000 (19:23 -0800)]
add bytes.IndexByte; common case we can make fast later.
also pick off the special case in strings.Index. don't want strings.IndexByte
because the call site will very rarely need to allocate and we can handle the
test in the code itself. bytes.IndexByte can avoid a common allocation.
Adam Langley [Wed, 18 Nov 2009 21:18:34 +0000 (13:18 -0800)]
net: remove race condition on Close.
Previously a netFd could be queued for reading/writing in the channel,
but close(2)'ed before pollServer got to it. In this case, the kernel
would consider the descriptor closed and the attempt to add it to the
epoll set would fail and panic.
This patch makes Close a roundtrip to the pollServer, although the
actual close(2) still occurs elsewhere to avoid blocking the
pollServer.
Eden Li [Wed, 18 Nov 2009 17:59:10 +0000 (09:59 -0800)]
Mangle C struct fields that happen to be named after Go keywords by prefixing them with _. Collisions with existing fields are resolved by prefixing the new Go identifier with _ until it matches nothing else in the struct.
Fixes #36.
Russ Cox [Wed, 18 Nov 2009 17:54:51 +0000 (09:54 -0800)]
big: implement 386 assembly routines
7x speedup on big and crypto/rsa unit tests.
also dropped useAsm in favor of making the
asm stubs jump to the Go versions.