Add the ability to attach functions to template and template sets.
Make variadic functions and methods work.
Still to come: static checking of function names during parse.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4643068
It's probably just an oversight that it doesn't work,
perhaps caused by analogy with Cap.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4634125
This changes Signature so that parsed signatures can be reserialized
exactly. With this ability we can add Serialize to Entity and also the
ability to sign other public keys.
R=bradfitz
CC=golang-dev
https://golang.org/cl/4627084
This change extends goinstall to support "magic" package names of the
form:
<host>/<repo>.<vcs>/<path>
Where <host> is the hostname, <repo> the path to the repository, <vcs>
the type of vcs (git, hg, bzr or svn), and <path> is the path inside the
repository that contains the source code for the package.
For example: "example.com/pub/foo.hg/src" means download the Mercurial
repository at either pub/foo.hg or pub/foo from example.com and then
build and install the source files from src inside the repository
checkout.
Repositories on the built-in hostings sites (github, bitbucket,
launchpad and googlecode) must still use the old form (i.e.
github.com/xxx/yyy.git/src will be rejected).
R=adg, rsc
CC=golang-dev
https://golang.org/cl/4626064
Each package using struct field tags assumes that
it is the only package storing data in the tag.
This CL adds support in package reflect for sharing
tags between multiple packages. In this scheme, the
tags must be of the form
key:"value" key2:"value2"
(raw strings help when writing that tag in Go source).
reflect.StructField's Tag field now has type StructTag
(a string type), which has method Get(key string) string
that returns the associated value.
Clients of json and xml will need to be updated.
Code that says
type T struct {
X int "name"
}
should become
type T struct {
X int `json:"name"` // or `xml:"name"`
}
Use govet to identify struct tags that need to be changed
to use the new syntax.
R=r, r, dsymonds, bradfitz, kevlar, fvbommel, n13m3y3r
CC=golang-dev
https://golang.org/cl/4645069
Also reuse of *Regexp nodes.
I believe this is the end of the parser.
The only non-execution code that remains is
the code to expand x{3,5} into simpler operations.
R=sam.thorogood, r
CC=golang-dev
https://golang.org/cl/4629078
The decision for when to say "hash/crc32".New instead of
crc32.New in an error was double-counting imports
from different packages or indirect imports, so it was
quoting even when there was no ambiguity.
R=ken2
CC=golang-dev
https://golang.org/cl/4645070
The gosymtab and gopclntab sections were pointing to the proper
data, but that data was already owned by the rodata section.
Some ELF references explicitly prohibit multiple sections from
owning the same data, and strip behaves accordingly.
The data for these sections was moved to after rodata, and the
gosymtab and gopclntab sections now own their respective ranges.
This change makes strip happy both with and without -s being
provided at link time. Note that it won't remove these sections
because they are still allocated, and that's by design since
they are necessary at runtime for generating proper backtraces
and similar introspection operations.
Unlike the previous behavior, -s will now maintain zero-sized
gosymtab and gopclntab sections. This makes the implementation
slightly cleaner.
Fixes#1242.
NOTE: Tested on Linux amd64/386/arm only.
R=ality, rsc
CC=golang-dev
https://golang.org/cl/4639077
The public godoc looked confused. I imagine these were
written before current conventions were established.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4662060
The implementation does not grab the lock,
if Once is already initalized.
Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
are as follows:
benchmark old ns/op new ns/op delta
sync_test.BenchmarkOnce 187.00 14.00 -92.51%
sync_test.BenchmarkOnce-2 909.00 21.40 -97.65%
sync_test.BenchmarkOnce-4 3684.00 20.90 -99.43%
sync_test.BenchmarkOnce-8 5987.00 23.00 -99.62%
sync_test.BenchmarkOnce-16 5051.00 21.60 -99.57%
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4641066
including evaluation up the data tree (in this code all fields must be
in dot itself), plus more control structure, but the basics are in place.
R=rsc, r
CC=golang-dev
https://golang.org/cl/4665041
For both contended and uncontended case:
- support arbitrary number of cpus (not just 2)
- dynamic load balancing (improves stability)
- periodic execution of Gosched() to work around non-preemptiviness
For uncontended case eliminates possible false-sharing.
For contended case includes additional variation with some
amount of local work between mutex operations.
R=r, rsc
CC=golang-dev
https://golang.org/cl/4634093
This avoids allocation when writing to bytes.Buffers and bufio.Writers, for
example.
R=golang-dev, rsc, r, consalus, r
CC=golang-dev
https://golang.org/cl/4625068
#pragma varargck countpos f 1
says that the first argument to f is
the count of variadic arguments that follow.
#pragma varargck type f t
says that t is one of the allowed types for
a variadic argument to f.
(can be repeated)
combined, these can be used to check the
runtime.stdcall functions in the windows port
or in any other port that needs a vararg list of
uintptrs even on a 64-bit platform (where it is
very easy to pass a less-than-uintptr in the ...).
demo:
typedef unsigned int uintptr;
#pragma varargck countpos f 1
#pragma varargck type f uintptr
#pragma varargck type f void*
int f(int count, ...);
void *v;
char *p;
void
main(void)
{
f(1, v); // ok
f(1, main); // ok
f(1, p); // ok
f(2, v, v); // ok
f(2, v); // found 1 argument after count 2
f(1, 'a'); // invalid type INT in call to f
f(1, 0); // invalid type INT in call to f
}
R=ken, r, alex.brainman
CC=golang-dev
https://golang.org/cl/4634103
Change the signature of Split to have no count,
assuming a full split, and rename the existing
Split with a count to SplitN.
Do the same to package bytes.
Add a gofix module.
R=adg, dsymonds, alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/4661051
I have written up a Marshal and MarshalIndent pair that should
closely reflect the way that Unmarshal works. I would love feedback
on making this code more accessible and efficient... I haven't used
reflecton on this scale before, so there is probably a lot of work
that can be done on that.
Some potentially controversial things:
- All tag names are lower-cased by default.
- Zero-valued struct values are skipped.
- No namespace prefix (o:tag, etc) mechanism is supplied.
- You are allowed to marshal non-struct values (even though unmarshal
cannot handle them).
- A tag for a non-XMLName struct field that isn't "attr", "chardata",
or "innerxml" is used as the name of the tag. This could wreak
havoc if you try to marshal a protobuf struct.
- The "innerxml" and "chardata" are inserted verbatim. If you try to
marshal something straight from unmarshal, the results could be
unexpected (remove "innerxml" support from Marshal would be one
possible solution).
R=rsc
CC=golang-dev
https://golang.org/cl/4539082
Permits serving from virtual filesystems, such as files linked
into a binary, or from a zip file.
Also adds a gofix for:
http.FileServer(root, prefix) -> http.StripPrefix(prefix, http.FileServer(http.Dir(root)))
R=r, rsc, gri, adg, dsymonds, r, gri
CC=golang-dev
https://golang.org/cl/4629047
Reader previously had cached an error from the underlying reader
and would return it on every subsequent call to Read. The Reader
will now return the error only once, and subsequent calls will result
in a new Read call to the underlying Reader.
Fixes#1934.
R=bradfitz, rogpeppe, rsc
CC=golang-dev
https://golang.org/cl/4528133
8a/a.h:
. Removed <u.h> and <libc.h> includes as they work better in "a.y".
. Made definition of EOF conditional as it's defined in the Plan 9
header files, but not elsewhere.
8a/a.y:
. Added <u.h> and <libc.h> because <stdio.h> in Plan 9 needs them.
Sequence <u.h>, <stdio.h>, <libc.h> recommended by RSC.
8a/lex.c:
. Added <u.h> and <libc.h> as now needed by "a.h".
. Dropped <ctype.h>.
cc/lexbody:
. exit() -> exits().
. Dropped unwanted incrementation.
cc/macbody:
. Adjusted a few format specifications.
R=rsc
CC=golang-dev
https://golang.org/cl/4644047
Previously we were snapshotting the TLS state into *Request
before we did the HTTP ReadRequest, the first Read of which
triggered the TLS handshake implicitly.
Fixes#1956
R=golang-dev, rsc
CC=agl, golang-dev
https://golang.org/cl/4630072
-test.benchtime allows to specify benchmark execution time.
-test.cpu allows to execute tests/benchmarks for several
values of GOMAXPROCS.
R=r, r, rsc
CC=golang-dev
https://golang.org/cl/4662046
did darwin on mac with older, not broken xcode.
did linux arm by copying diffs from linux 386.
did freebsd amd64 by copying diffs from freebsd 386.
R=golang-dev, r, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/4629067
Documentation mentioned the obsolete package "crypto/block",
which has been replaced with "crypto/cipher".
R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/4654064
- don't rely on /dev/stdin as the name for standard input
- employ EBNF extraction if the source contains tags
"cat source.html | ebnflint" works now
R=r
CC=golang-dev
https://golang.org/cl/4641075
Users of the Scan() infrastructure that employ ReadRune() rather than
Token() need a way to skip leading spaces and newlines as set by the
the parent, Fscan(), Fscanln, or Fscanf(). As the internal methods and
boolean flags are not exported, this new function was added here and
in the Int and Nat Scan() functions of the big package. (fmt.Rat did
not need change since it uses Token()) Also added Printf style format
code support to int types and tests for same to int_test.go
R=r, r, gri, mtj
CC=golang-dev
https://golang.org/cl/4634074
As rsc suggested after change 58a6bdac3d12 was committed, we
now read the first byte of Request.Body when the
Request.ContentLength is 0 to disambiguate between a truly
zero-length body and a body of unknown length where the user
didn't set the ContentLength field.
This was also causing the reverse proxy problem where incoming
requests (which always have a body, of private type http.body,
even for 0-lengthed requests) were being relayed to the http
Transport for fetching, which was serializing the request as a
chunked request (since ContentLength was 0 and Body was
non-nil)
Fixes#1999
R=golang-dev, kevlar
CC=golang-dev
https://golang.org/cl/4628063
RFC 1521 section 4 states "The type, subtype, and parameter names are not case sensitive.".
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4648047
grsec needs the FIXED flag to be provided to mmap, which
works now. That said, when the allocation fails to be made
in the specific address, we're still given back a writable
page. This change will unmap that page to avoid using
twice the amount of memory needed.
It'd also be pretty easy to avoid the extra system calls
once we detected that the flag is needed, but I'm not sure
if that edge case is worth the effort.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4634086
The optable for 0xDB is handled specially.
This was the cause of a really weird bug
when using cov (386!) on the math package.
A real head-scratcher.
R=rsc
CC=golang-dev
https://golang.org/cl/4639066
This has the effect of making goinstall rebuild a package's
dependencies when they are newer than the current package object.
R=rsc
CC=golang-dev
https://golang.org/cl/4627051
These changes add a Ctty int field to the Unix syscall.ProcAttr which,
if set >= 0 in conjuction with Setsid=true, will be used by
forkAndExecInChild as the file descriptor for the new child's
controlling terminal.
Necessary changes have been made to mkerrors.sh to generate defs for
TIOC*, though changes to its output files are not included here.
The changes made should support Linux, FreeBSD and Darwin, at least.
R=iant, bradfitz, r, rsc, borman
CC=golang-dev
https://golang.org/cl/4532075
This prevents ld from generating zeroed symtab entries for
sections that aren't going to be generated because dynamic
linkage has been disabled (-d was used or no dynamic libs
were seen). Even though they were not explicitly added by
doelf, the section creation process was making them
reachable again.
The windows head is being disconsidered for this because
apparently it's not taking into account debug['d'].
This makes elflint 0.1% happier.
R=golang-dev, rsc, gustavo
CC=golang-dev
https://golang.org/cl/4638050
This is a core API change.
1) gofix misc src
2) Manual adjustments to the following files under src/pkg:
gob/decode.go
rpc/client.go
os/error.go
io/io.go
bufio/bufio.go
http/request.go
websocket/client.go
as well as:
src/cmd/gofix/testdata/*.go.in (reverted)
test/fixedbugs/bug243.go
3) Implemented gofix patch (oserrorstring.go) and test case (oserrorstring_test.go)
Compiles and runs all tests.
R=r, rsc, gri
CC=golang-dev
https://golang.org/cl/4607052
The test is only defined on darwin/amd64, and it fails
with recent versions of Xcode, which do not support
-gstabs+ debugging output. At some point godefs will
have to be replaced, perhaps merged with cgo.
Godefs is not needed during builds anyway (its output files
are checked into the repository in src/pkg/runtime),
so its failure on the newer Xcode is a distraction from an
otherwise usable build. Disable the test.
Fixes#1985.
R=golang-dev, gri, robert.hencke, r
CC=golang-dev
https://golang.org/cl/4638053
Once these changes are effected, it is possible to construct
"8l" native on a (386?) Plan 9 system, albeit with assistance
from modules such as mkfiles that are not (yet) included in any
public patches.
8l/asm.c:
. Corrected some format qualifiers.
8l/list.c:
. Cast a print() argument to (int) to match the given format.
It may be possible to change the format (%R), but I have not
looked into it.
8l/obj.c:
. Removed some unused code.
8l/span.c:
. Removed unnecessary incrementation on "bp".
. Corrected some format qualifiers.
ld/data.c:
. Corrected some format qualifiers.
. Cast print argument to (int): used as field size.
. Use braces to suppress warning about empty if() statements.
ld/dwarf.c:
. Trivial spelling mistake in comment.
ld/ldelf.c:
. Added USED() statements to silence warnings.
. Dropped redundant address (&) operators.
. corrected some format qualifiers.
. Cast to (int) for switch selection variable.
ld/macho.c:
. Added USED() statements to silence warnings.
ld/ldpe.c:
. Added USED() statements to silence warnings.
. More careful use of "sect" variable.
. Corrected some format qualifiers.
. Removed redundant assignments.
. Minor fix dropped as it was submitted separately.
ld/pe.c:
. Dropped <time.h> which is now in <u.h>.
. Dropped redundant address (&) operators.
. Added a missing variable initialisation.
ld/symtab.c:
. Added USED() statements to silence warnings.
. Removed redundant incrementation.
. Corrected some format qualifiers.
All the above have been tested against a (very) recent release
and do not seem to trigger any regressions.
All review suggestions have been incorporated.
R=rsc
CC=golang-dev
https://golang.org/cl/4633043
This change causes Print et al. to catch panics generated by
calls to String, GoString, and Format. The panic is formatted
into the output stream as an error, but the program continues.
As a special case, if the argument was a nil pointer, the
result is just "<nil>", because that's almost certainly enough
information and handles the very common case of String
methods that don't guard against nil.
Scan does not want this change. Input must work; output can
be for debugging and it's nice to get output even when you
make a mistake.
R=dsymonds, r, adg, gri, rsc, gri
CC=golang-dev
https://golang.org/cl/4640043
We'll do the right thing by default, but people wanting minimal
response sizes can explicitly remove the Date header.
(empty fields aren't written out)
R=rsc
CC=golang-dev
https://golang.org/cl/4634048
All but two packages depend on net:
debug/proc
os/signal
With this change, we can produce
a working build with GOOS=plan9.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4639053
Extend goinstall to support downloading from any hg/git/svn/bzr hosting
site, not just the standard ones. The type of hosting is automatically
checked by trying all the tools, so the import statement looks like:
import "example.com/mything"
Which will work for Mercurial (http), Subversion (http, svn), Git (http,
git) and Bazaar (http, bzr) hosting.
All the existing package imports will work through this new mechanism,
but the existing hard-coded host support is left in place to ensure
there is no change in behaviour.
R=golang-dev, bradfitz, fvbommel, go.peter.90, n13m3y3r, adg, duperray.olivier
CC=golang-dev
https://golang.org/cl/4650043
It's sad to think there are environments where compiling against a library
isn't enough information for the the linker to decide that you need that
library.
TBR=jdpoirier
R=jdpoirier
CC=golang-dev
https://golang.org/cl/4646047