Rob Pike [Thu, 18 Aug 2011 03:27:18 +0000 (13:27 +1000)]
test/chan/select5.go: change "with" to "if" in templatea
I converted this program yesterday and the output is the
same as it used to be, ignoring space, but the result is
not the best expression of the algorithm. The old {.section
Maybe} pieces are now {{with .Maybe}}, as a direct translation,
but I they should be {{if .Maybe}} as the output is just a
bool and there is no cascading.
I have verified that the output of the program is unaffected.
Marcel van Lohuizen [Wed, 17 Aug 2011 08:12:39 +0000 (18:12 +1000)]
exp/norm: implementation of decomposition and composing functionality.
forminfo.go:
- Wrappers for table data.
- Per Form dispatch table.
composition.go:
- reorderBuffer type. Implements decomposition, reordering, and composition.
- Note: decompose and decomposeString fields in formInfo could be replaced by
a pointer to the trie for the respective form. The proposed design makes
testing easier, though.
normalization.go:
- Temporarily added panic("not implemented") methods to make the tests run.
These will be removed again with the next CL, which will introduce the
implementation.
Rob Pike [Wed, 17 Aug 2011 04:34:48 +0000 (14:34 +1000)]
template: delete old template code.
It's already in old/template; make that build.
Update a couple of references to point to the old template.
They can be updated later.
Update goplay to use exp/template.
Rob Pike [Wed, 17 Aug 2011 03:36:02 +0000 (13:36 +1000)]
url: new package
This is just moving the URL code from package http into its own package,
which has been planned for a while.
Besides clarity, this also breaks a nascent dependency cycle the new template
package was about to introduce.
Add a gofix module, url, and use it to generate changes outside http and url.
Sadness about the churn, gladness about some of the naming improvements.
R=dsymonds, bradfitz, rsc, gustavo, r
CC=golang-dev
https://golang.org/cl/4893043
Joel Sing [Tue, 16 Aug 2011 21:26:51 +0000 (17:26 -0400)]
net, syscall: move multicast address handling
Multicast address handling is not consistent across all BSDs. Move
the multicast address handling code into OS dependent files. This
will be needed for OpenBSD support.
Dmitriy Vyukov [Tue, 16 Aug 2011 20:53:02 +0000 (16:53 -0400)]
runtime: fix GC bitmap corruption
The corruption can occur when GOMAXPROCS
is changed from >1 to 1, since GOMAXPROCS=1
does not imply there is only 1 goroutine running,
other goroutines can still be not parked after
the change.
Julian Phillips [Tue, 16 Aug 2011 18:56:23 +0000 (14:56 -0400)]
cgo: omit duplicate symbols in writeDefs
When the C API being used includes multiple names for the same
underlying symbol (e.g. multiple #define's for the same variable), then
cgo will generate the same placeholder variables for each name. This
then prevents the code from compiling due to multiple declarations of
the same variable - so change cgo to only create one instance of the
variable for the underlying symbol.
Russ Cox [Tue, 16 Aug 2011 15:14:26 +0000 (11:14 -0400)]
errchk: allow multiple patterns
// ERROR "pattern1" "pattern2"
means that there has to be one or more
lines matching pattern1 and then excluding
those, there have to be one or more lines
matching pattern2. So if you expect two
different error messages from a particular
line, writing two separate patterns checks
that both errors are produced.
Also, errchk now flags lines that produce
more errors than expected. Before, as long as
at least one error matched the pattern, all the
others were ignored.
Revise tests to expect or silence these
additional errors.
Dmitriy Vyukov [Tue, 16 Aug 2011 08:34:56 +0000 (18:34 +1000)]
rpc: make Server.Mutex unexported
Currently it's possible to write:
var s rpc.Server
...
// reuse for my own purposes
s.Lock()
...
s.Unlock()
which is seemingly not intended.
Sugu Sougoumarane [Mon, 15 Aug 2011 22:06:22 +0000 (08:06 +1000)]
rpc: implement ServeRequest to synchronously serve a single request.
This is useful for applications that want to micromanage the rpc service.
Moved part of ServeCodec into a new readRequest function.
Renamed existing readRequest to readRequestHeader, and reordered
its parameters to align with the new readRequest and service.call.
Rob Pike [Mon, 15 Aug 2011 21:51:44 +0000 (07:51 +1000)]
builtin: add documentation for builtins
Do this by adding a fake package called builtin. At the moment, godoc will
not present this documentation because the function names are all lower case,
but there are plans to address this.
The print and println functions are undocumented here. I could be talked
into doing them but I'd rather not promote their use.
Gustavo Niemeyer [Mon, 15 Aug 2011 17:19:30 +0000 (14:19 -0300)]
build: support versioning without hg
CL 4873048 introduced the ability to build without hg and
getting an "unknown" version. While this approach works
to avoid the hg dependency, it also means that every
exported tree that is built without hg or .hg will have not
only missing information, but will also be compatible to
one another. Considering that it is a common practice to
remove the VCS data in distributions, I suggest we don't
take this approach to avoid its consequences.
This CL fixes the same problem in a different way: if a
VERSION file at the top of the tree exists, use it at
all times. If it doesn't, fall back to using information
from hg necessarily, and fail if that's not possible. The
error message when VERSION and hg are not available
instructs users to handle it properly.
The VERSION file can be generated with
"src/version.bash -save" while hg is still around.
Rob Pike [Mon, 15 Aug 2011 05:16:57 +0000 (15:16 +1000)]
old/template: copy code from template
First step of moving exp/template into template: save the old code.
Code is unedited except for target name in Makefile.
Gustavo Niemeyer [Mon, 15 Aug 2011 03:56:01 +0000 (00:56 -0300)]
exp/template: support field syntax on maps
While using exp/template in practice, the syntax for
indexing values using the "index" action was found to be
very inconvenient for frequent use when handling dynamic
data from maps such as the ones used with json and yaml,
that use a type like map[string]interface{}.
For these kinds of maps, the default handling of fields as
{{.Field}} makes the task of handling the several references
significantly more pleasant and elegant, and is equivalent
to what's currently done in the "template" package and in
other external packages (e.g. mustache).
Even with this change, the index action is still relevant
as it allows indexing maps in other scenarios where keys
wouldn't be valid field names.
Gustavo Niemeyer [Mon, 15 Aug 2011 03:22:28 +0000 (00:22 -0300)]
exp/template: don't panic on range of nil interface
This avoids a non-obvious panic when range is used on a
nil interface, and fixes it by behaving as if the range
was empty.
The new behavior is equivalent to the outcome of iterating
on a nil map or slice, and is useful because it allows
generic structures such as used in json (map[string]interface{})
to behave correctly if a key generally set to a list or map
isn't present.
Robert Griesemer [Fri, 12 Aug 2011 23:28:55 +0000 (16:28 -0700)]
godoc: position URLs (containing file names) must be quoted and URL escaped
Since the posLink_url also adds a non-URL attribute, the quoting and URL-escaping
must happen inside posLink_url (otherwise the non-URL attribute becomes part or the
URL portion of the tag.
Robert Griesemer [Fri, 12 Aug 2011 22:43:10 +0000 (15:43 -0700)]
godoc: remove last vestiges of old template system
- rename template funcs for better consistency and
sort them into groups of related functionality
- try to be more consistent with html vs url escaping
Robert Griesemer [Fri, 12 Aug 2011 17:06:32 +0000 (10:06 -0700)]
godoc: first round of template cleanups
- simplified pipelines
- simplified templates by using template variables
- converted most old-style formatters into new-style funcs
- fixed some escaping bugs (use of url escaping where it was missing)
Mike Samuel [Fri, 12 Aug 2011 04:34:29 +0000 (14:34 +1000)]
exp/template/html: New package with a toy template transformation.
func Reverse(*Template) *Template
returns a template that produces the reverse of the original
for any input.
Changes outside exp/template/html include:
- Adding a getter for a template's FuncMap so that derived templates
can inherit function definitions.
- Exported one node factory function, newIdentifier.
Deriving tempaltes requires constructing new nodes, but I didn't
export all of them because I think shallow copy functions might
be more useful for this kind of work.
- Bugfix: Template's Name() method ignores the name field so
template.New("foo") is a nil dereference instead of "foo".
Caveats: Reverse is a toy. It is not UTF-8 safe, and does not
preserve order of calls to funcs in FuncMap.
Robert Griesemer [Thu, 11 Aug 2011 20:24:13 +0000 (13:24 -0700)]
godoc: moving to new template package
- first step; rough conversion of all template files
- there is plenty of opportunity for cleanups/simplifications (next CLs)
- html and text output as before
Dave Grijalva [Wed, 10 Aug 2011 21:16:13 +0000 (14:16 -0700)]
http: corrects undocumented side effects in http.DefaultTransport's RoundTrip method
Fixes #2140.
The http.DefaultTransport's RoundTrip method leaves the http.Request object
in an altered state after performing the round trip. This patch removes
the header from the Request before returning to the client.
Marcel van Lohuizen [Wed, 10 Aug 2011 13:36:27 +0000 (15:36 +0200)]
exp/norm: added trie lookup code and associated tests.
- triegen.go: Factored out trie generation code from maketables.go
(only renamed printTrieTables to printTables and made it a method).
- maketesttables.go: new tool to generate data for the trie unit test.
- Makefile: changed accordingly.
- trie.go: trie lookup code.
- trietest_data.go: generated by maketesttables.go.
- trie_test.go: unit test for trie.go.
Marcel van Lohuizen [Wed, 10 Aug 2011 13:34:12 +0000 (15:34 +0200)]
exp/norm: added trie lookup code and associated tests.
- triegen.go: Factored out trie generation code from maketables.go
(only renamed printTrieTables to printTables and made it a method).
- maketesttables.go: new tool to generate data for the trie unit test.
- Makefile: changed accordingly.
- trie.go: trie lookup code.
- trietest_data.go: generated by maketesttables.go.
- trie_test.go: unit test for trie.go.
Alex Brainman [Wed, 10 Aug 2011 07:17:28 +0000 (17:17 +1000)]
runtime: correct seh installation during callbacks
Every time we enter callback from Windows, it is
possible that go exception handler is not at the top
of per-thread exception handlers chain. So it needs
to be installed again. At this moment this is done
by replacing top SEH frame with SEH frame as at time
of syscall for the time of callback. This is incorrect,
because, if exception strike, we won't be able to call
any exception handlers installed inside syscall,
because they are not in the chain. This changes
procedure to add new SEH frame on top of existing
chain instead.
I also removed m sehframe field, because I don't
think it is needed. We use single global exception
handler everywhere.
R=golang-dev, r
CC=golang-dev, hectorchu
https://golang.org/cl/4832060