Commit Graph

9389 Commits

Author SHA1 Message Date
Rob Pike
73b7afbebd 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.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4902046
2011-08-17 14:34:48 +10:00
Rob Pike
ff0240da6d misc: fix a couple of template uses preparatory to the big switch.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4876057
2011-08-17 13:57:06 +10:00
Rob Pike
1d8f822c17 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
2011-08-17 13:36:02 +10:00
Aleksandar Dezelin
d72c96df2a net: Added function SetTimeout() to interface Listener.
Fixes #2148.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4905042
2011-08-16 18:36:51 -04:00
Robert Griesemer
182cf988e9 go/parser: use correct precedence when parsing range clauses
Fixes #2156.

R=rsc
CC=golang-dev
https://golang.org/cl/4899046
2011-08-16 15:19:23 -07:00
Russ Cox
9801c8e886 A+C: Aleksandar Dezelin (individual CLA)
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/4901047
2011-08-16 18:15:36 -04:00
Joel Sing
5af6ce541f net: add multicast stubs for openbsd
Add multicast stubs and sync with recent changes.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/4838058
2011-08-16 17:28:16 -04:00
Joel Sing
1bc245181e 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.

R=mikioh.mikioh, golang-dev
CC=golang-dev
https://golang.org/cl/4809074
2011-08-16 17:26:51 -04:00
Mikio Hara
c20ced956e net: return correct local address for an accepted TCP connection
Fixes #2127.

R=rsc
CC=golang-dev
https://golang.org/cl/4873043
2011-08-16 16:53:09 -04:00
Dmitriy Vyukov
a2677cf363 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.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4873050
2011-08-16 16:53:02 -04:00
Julian Phillips
01dd57b312 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.

R=rsc
CC=golang-dev
https://golang.org/cl/4826055
2011-08-16 14:56:23 -04:00
Lucio De Re
f12e543255 5l, 6l, 8l: add varargck for %Z
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4837044
2011-08-16 14:22:12 -04:00
Lucio De Re
c8c6e1961d 5c, 6c, 6l: fix Plan 9 build warnings
src/cmd/5c/reg.c:
. Added USED() attribute.

src/cmd/6c/cgen.c:
. Revised code around "REGARG" to resemble use in "8c" and
  consequently remove a warning.

src/cmd/6l/asm.c:
. Added USED() attributes.
. Removed an unnecessary assignment.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4836045
2011-08-16 14:22:08 -04:00
Lucio De Re
93ecb5bb1b ld: make addaddrplus4 static
R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4835043
2011-08-16 14:22:02 -04:00
Russ Cox
a5d7c1f45e 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.

R=lvd, r, iant
CC=golang-dev
https://golang.org/cl/4869044
2011-08-16 11:14:26 -04:00
Dmitriy Vyukov
53573c02b8 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.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4888049
2011-08-16 18:34:56 +10:00
Dmitriy Vyukov
381f6a2eeb syscall: make LazyDLL/LazyProc.Mutex unexported
They are seemingly not intended to be a part
of the public interface.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4873052
2011-08-16 18:33:48 +10:00
Rob Pike
00dd2b4ab9 builtin: correct description of a closed channel.
R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/4896046
2011-08-16 16:03:30 +10:00
Rob Pike
43d6389397 builtin: tweak a couple of descriptions.
R=golang-dev, adg, dsymonds
CC=golang-dev
https://golang.org/cl/4875050
2011-08-16 15:24:00 +10:00
Robert Griesemer
0310935058 godoc: show all top-level decls for (fake) package builtin
R=r, adg
CC=golang-dev
https://golang.org/cl/4904045
2011-08-15 19:05:52 -07:00
Robert Griesemer
e6ae13d35d godoc: fix lib/godoc/package.txt template
- show documentation in text mode; e.g.:
http://localhost:7777/cmd/godoc/?f=text

- simplify template by using $ variable

R=r, adg
CC=golang-dev
https://golang.org/cl/4873045
2011-08-15 15:42:27 -07:00
Robert Griesemer
91fadbca17 godoc: fix escaping in templates
- HTML-escape URL paths
- URL-escape URL parameters

R=bradfitz
CC=golang-dev
https://golang.org/cl/4890041
2011-08-15 15:15:54 -07:00
Sugu Sougoumarane
9f677f91d1 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.

R=golang-dev, r, rsc, sougou
CC=golang-dev, msolomon
https://golang.org/cl/4889043
2011-08-16 08:06:22 +10:00
Rob Pike
de1f856d66 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.

R=dsymonds, n13m3y3r, r, gri, rsc
CC=golang-dev
https://golang.org/cl/4907041
2011-08-16 07:51:44 +10:00
Gustavo Niemeyer
b0fc8a9d57 build: don't print anything on version.bash -save
R=rsc
CC=golang-dev
https://golang.org/cl/4904044
2011-08-15 14:25:54 -03:00
Gustavo Niemeyer
220c74984a 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.

R=golang-dev, rsc, gustavo
CC=golang-dev
https://golang.org/cl/4897043
2011-08-15 14:19:30 -03:00
Gustavo Niemeyer
a2bb0159d6 reflect: panic on Invalid Interface call
This was initially pushed as part of CL 4876046, found
when logic in exp/template was using the method on
an Invalid value.

R=rsc
CC=golang-dev
https://golang.org/cl/4890043
2011-08-15 14:14:15 -03:00
Andrew Gerrand
241a262fe5 build: don't require hg for build
R=golang-dev, dsymonds, n13m3y3r
CC=golang-dev
https://golang.org/cl/4873048
2011-08-15 21:19:07 +10:00
Gustavo Niemeyer
175849295c runtime: fix pseudo-randomness on some selects
Fixes #2152.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/4888044
2011-08-15 03:51:51 -03:00
Rob Pike
d7440ce21a 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.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4893042
2011-08-15 15:16:57 +10:00
Gustavo Niemeyer
e3df71f50b 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.

R=golang-dev, r, gustavo
CC=golang-dev
https://golang.org/cl/4898043
2011-08-15 00:56:01 -03:00
Gustavo Niemeyer
e3f3a5411a 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.

R=golang-dev, r, gustavo
CC=golang-dev
https://golang.org/cl/4876046
2011-08-15 00:22:28 -03:00
Robert Hencke
8a439334ad exp/norm: fix incorrect prints found by govet.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4895042
2011-08-14 14:02:48 +10:00
Andrew Gerrand
6e66b16abe goinstall: report all newly-installed public packages
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4875048
2011-08-14 10:52:20 +10:00
Rob Pike
9bcec3bbce C: add Sugu Sougoumarane, Googler.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4901041
2011-08-14 09:35:01 +10:00
Andrew Gerrand
df3df7b70a godoc: fix godoc.html template bug: correctly display package roots
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4898042
2011-08-14 08:56:47 +10:00
David Symonds
5e48e648f1 exp/template: rename filter: url -> urlquery.
R=r, rsc
CC=golang-dev
https://golang.org/cl/4873046
2011-08-13 14:00:16 +10:00
Robert Griesemer
c71b676724 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.

R=r
CC=golang-dev
https://golang.org/cl/4888041
2011-08-12 16:28:55 -07:00
Robert Griesemer
5c45e56898 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

R=r
CC=golang-dev
https://golang.org/cl/4887041
2011-08-12 15:43:10 -07:00
Robert Griesemer
5233c50321 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)

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4868044
2011-08-12 10:06:32 -07:00
Marcel van Lohuizen
4abbdc0399 exp/norm: generate trie struct in triegen.go for better encapsulation.
R=r, r
CC=golang-dev
https://golang.org/cl/4837071
2011-08-12 18:00:31 +02:00
Marcel van Lohuizen
58a92bd1ef exp/norm: generate trie struct in triegen.go for better encapsulation.
R=r, r
CC=golang-dev
https://golang.org/cl/4837071
2011-08-12 17:44:14 +02:00
Mikio Hara
8d19d6bb39 lib/godoc: fix typo
R=gri, dsymonds
CC=golang-dev
https://golang.org/cl/4881042
2011-08-12 22:42:42 +10:00
Joel Sing
8c46e47b61 crypto, exec, path, time: add support for OpenBSD
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4837048
2011-08-12 14:44:16 +10:00
Mike Samuel
595e9d5034 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.

For context, see http://groups.google.com/group/golang-nuts/browse_thread/thread/e8bc7c771aae3f20/b1ac41dc6f609b6e?lnk=gst

R=rsc, r, nigeltao, r
CC=golang-dev
https://golang.org/cl/4808089
2011-08-12 14:34:29 +10:00
Rob Pike
1b13131c6b CLA: Add Mike Samuel, Googler.
R=golang-dev, dsymonds
CC=golang-dev, mikesamuel
https://golang.org/cl/4875042
2011-08-12 14:31:12 +10:00
David Symonds
fe59d86dd6 exp/template: fix implementation of printValue.
R=r
CC=golang-dev
https://golang.org/cl/4878042
2011-08-12 13:29:56 +10:00
Rob Pike
3cca9e0b00 utf8: rename some internal constants to remove leading underscores.
How quaint.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4874045
2011-08-12 11:50:46 +10:00
Rob Pike
b1d1da405a exp/template: add builtin len function
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4868045
2011-08-12 11:47:44 +10:00
Robert Griesemer
2e394c51d9 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

R=r, dsymonds
CC=golang-dev
https://golang.org/cl/4852048
2011-08-11 13:24:13 -07:00