1
0
mirror of https://github.com/golang/go synced 2024-10-03 15:31:22 -06:00
Commit Graph

15010 Commits

Author SHA1 Message Date
Matthew Dempsky
80a87a99cc spec: Use "non-negative" instead of "positive"
Replacing division-by-power-of-2 with right-shift is valid for
zero too.

R=gri
CC=golang-dev
https://golang.org/cl/7027049
2013-01-06 16:56:06 -08:00
Dave Cheney
47e5266a22 misc/dashboard/builder: set GOPATH before building subrepos
This proposal updates the dashboard builder to avoid relying on the (soon to be removed) support for using go get to download to $GOROOT. The result is

WORKSPACE=$(the value of the -buildRoot flag / $BUILDER_NAME + hg revision)
GOROOT=$WORKSPACE/go
GOPATH=$WORKSPACE

Required for CL 6941058.

R=minux.ma, adg
CC=golang-dev
https://golang.org/cl/7034049
2013-01-07 11:24:01 +11:00
Robin Eklind
f36a53cd5d cmd/gofmt, bufio, image: Consistency and error handling.
cmd/gofmt: Add error handling for ioutil.WriteFile.
bufio: Consistency, rename e to err.
image: Consistency, fix comment for asReader.

R=golang-dev, dave, minux.ma, adg
CC=golang-dev
https://golang.org/cl/7029056
2013-01-07 11:15:53 +11:00
Nigel Tao
c753404886 bytes: fix docs: s/array/slice/.
R=rsc, mdempsky, dave
CC=golang-dev
https://golang.org/cl/7028051
2013-01-07 10:48:06 +11:00
Matthew Dempsky
46811d27ce src: Use bytes.Equal instead of bytes.Compare where possible.
bytes.Equal is simpler to read and should also be faster because
of short-circuiting and assembly implementations.

Change generated automatically using:
  gofmt -r 'bytes.Compare(a, b) == 0 -> bytes.Equal(a, b)'
  gofmt -r 'bytes.Compare(a, b) != 0 -> !bytes.Equal(a, b)'

R=golang-dev, dave, adg, rsc
CC=golang-dev
https://golang.org/cl/7038051
2013-01-07 10:03:49 +11:00
Matthew Dempsky
56961274bb bytes: Examples recommending bytes.Compare(a, b) rel_op 0 to test a rel_op b.
R=golang-dev, minux.ma, rsc, adg
CC=golang-dev
https://golang.org/cl/7042045
2013-01-07 09:59:37 +11:00
Caleb Spare
396c957a32 encoding/json: documented that ,string applies only to string and numeric fields.
Fixes #4437.

R=golang-dev, adg
CC=golang-dev, rsc
https://golang.org/cl/7064045
2013-01-07 09:44:35 +11:00
Andrew Gerrand
161884d3f4 A+C: Caleb Spare (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7070046
2013-01-07 09:43:53 +11:00
Rémy Oudompheng
0f545d9ab2 go/types: less closure creations in gcimporter.
Closures are incredibly expensive on linux/arm due to
repetitive flush of instruction cache.

go test -short on ODROID-X:

Before:
ok      exp/gotype      17.091s
ok      go/types        2.225s

After:
ok      exp/gotype      7.193s
ok      go/types        1.143s

R=dave, minux.ma, rsc
CC=golang-dev, remy
https://golang.org/cl/7062045
2013-01-06 23:38:38 +01:00
Robin Eklind
1e1aea6821 doc: Updated links for sub-repository documentation.
Use godoc.org instead of gopkgdoc.appspot.com.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7036051
2013-01-07 09:10:09 +11:00
Russ Cox
cbbc6a102d cmd/5l, cmd/6l, cmd/8l, cmd/cc, cmd/gc: new flag parsing
This CL adds a flag parser that matches the semantics of Go's
package flag. It also changes the linkers and compilers to use
the new flag parser.

Command lines that used to work, like
        8c -FVw
        6c -Dfoo
        5g -I/foo/bar
now need to be split into separate arguments:
        8c -F -V -w
        6c -D foo
        5g -I /foo/bar
The new spacing will work with both old and new tools.

The new parser also allows = for arguments, as in
        6c -D=foo
        5g -I=/foo/bar
but that syntax will not work with the old tools.

In addition to matching standard Go binary flag parsing,
the new flag parser generates more detailed usage messages
and opens the door to long flag names.

The recently added gc flag -= has been renamed -complete.

R=remyoudompheng, daniel.morsing, minux.ma, iant
CC=golang-dev
https://golang.org/cl/7035043
2013-01-06 15:24:47 -05:00
Russ Cox
d37c572ad5 cmd/ld: move symtab, ELF generation to portable code
More cleanup in preparation for fixing issue 4069.

This CL replaces the three nearly identical copies of the
asmb ELF code with a single asmbelf function in elf.c.

In addition to the ELF code movement, remove the elfstr
array in favor of a simpler lookup, and identify sections by
name throughout instead of computing fragile indices.

The CL also replaces the three nearly identical copies of the
genasmsym code with a single genasmsym function in lib.c.

The ARM linker still compiles and generates binaries,
but I haven't tested the binaries. They may not work.

R=ken2
CC=golang-dev
https://golang.org/cl/7062047
2013-01-06 14:32:45 -05:00
Dave Cheney
b006cd9bb0 cmd/go: avoid leaking timer if test process failed to start
R=rsc
CC=golang-dev
https://golang.org/cl/7034047
2013-01-05 21:15:51 +11:00
Russ Cox
4e2aa9bff0 cmd/ld: use native-endian symbol values in symbol table
The Plan 9 symbol table format defines big-endian symbol values
for portability, but we want to be able to generate an ELF object file
and let the host linker link it, as part of the solution to issue 4069.
The symbol table itself, since it is loaded into memory at run time,
must be filled in by the final host linker, using relocation directives
to set the symbol values. On a little-endian machine, the linker will
only fill in little-endian values during relocation, so we are forced
to use little-endian symbol values.

To preserve most of the original portability of the symbol table
format, we make the table itself say whether it uses big- or
little-endian values. If the table begins with the magic sequence
        fe ff ff ff 00 00
then the actual table begins after those six bytes and contains
little-endian symbol values. Otherwise, the table is in the original
format and contains big-endian symbol values. The magic sequence
looks like an "end of table" entry (the fifth byte is zero), so legacy
readers will see a little-endian table as an empty table.

All the gc architectures are little-endian today, so the practical
effect of this CL is to make all the generated tables little-endian,
but if a big-endian system comes along, ld will not generate
the magic sequence, and the various readers will fall back to the
original big-endian interpretation.

R=ken2
CC=golang-dev
https://golang.org/cl/7066043
2013-01-04 17:03:57 -05:00
Daniel Morsing
f1e4ee3f49 cmd/5g, cmd/6g, cmd/8g: flush return parameters in case of panic.
Fixes #4066.

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/7040044
2013-01-04 17:07:21 +01:00
Lucio De Re
62dfa9c47d cmd/5g, cmd/5l, cmd/ld: Small adjustments for the Plan 9 native tools
A few USED(xxx) additions and a couple of deletions of variable
initialisations that go unused.  One questionable correction,
mirrored in 8l/asm.c, where the result of invocation of a function
shouldn't be used.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6736054
2013-01-04 11:02:49 -05:00
Russ Cox
a4e08183d5 cmd/dist: sse auto-detect
R=golang-dev, dsymonds, minux.ma, iant, alex.brainman
CC=golang-dev
https://golang.org/cl/7035055
2013-01-04 10:59:10 -05:00
Ian Lance Taylor
63bee953a2 runtime: always incorporate hash seed at start of hash computation
Otherwise we can get predictable collisions.

R=golang-dev, dave, patrick, rsc
CC=golang-dev
https://golang.org/cl/7051043
2013-01-04 07:53:42 -08:00
John Graham-Cumming
c09649890f log/syslog: remove RFC5424 version number for greater compatibility
RFC5424 specifies a version number (currently 1) after the facility and
severity in a syslog message (e.g. <7>1 TIMESTAMP ...).  This causes
rsyslog to fail to parse syslog message because the rest of the message
is not fully compliant with RFC5424.

For the widest compatibility, drop the version (messages are in the
RFC3164 BSD syslog format (e.g. <7>TIMESTAMP ...). Have tested this with
syslog-ng, rsyslog and syslogd.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7036050
2013-01-04 10:21:43 -05:00
Jan Ziak
89ec208ee8 runtime: introduce typedefs and delete struct keywords in mgc0.c
R=rsc
CC=golang-dev
https://golang.org/cl/7029055
2013-01-04 10:20:50 -05:00
Matthew Dempsky
98edf09e67 net/http: Sync TimeoutHandler godoc with code.
TimeoutHandler was changed from "ns int64" to "dt time.Duration" on
Nov 30, 2011, but the godoc still refers to "ns".

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7031050
2013-01-03 10:06:04 -08:00
Ian Lance Taylor
17eafcd05d CONTRIBUTORS: add Matthew Dempsky (Google CLA)
R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/7049043
2013-01-03 10:05:28 -08:00
Dave Cheney
14b654369d go/types: add more logging to gc import test
* Extended deadline to 30 seconds
* Added logging of the duration of each package import
* Fail the test immediately if directories cannot be read

R=gri, minux.ma
CC=golang-dev
https://golang.org/cl/7030055
2013-01-03 16:30:25 +11:00
Nigel Tao
699b99fa75 net: fix docs for type IP: s/array/slice/.
R=rsc
CC=golang-dev
https://golang.org/cl/6930047
2013-01-03 14:25:13 +11:00
Robert Griesemer
614b02d22a spec: clarify language about unary operator &
A composite literal may be parenthesized when
used as operand for the unary operator &.

R=rsc, iant, r, ken
CC=golang-dev
https://golang.org/cl/6996053
2013-01-02 18:11:49 -08:00
Rémy Oudompheng
cf77dd37e7 cmd/8g: extend elimination of temporaries to SSE2 code.
Before:
(erf.go:188)    TEXT     Erf+0(SB),$220
(erf.go:265)    TEXT     Erfc+0(SB),$204
(lgamma.go:174) TEXT     Lgamma+0(SB),$948

After:
(erf.go:188)    TEXT     Erf+0(SB),$84
(erf.go:265)    TEXT     Erfc+0(SB),$84
(lgamma.go:174) TEXT     Lgamma+0(SB),$44

SSE before vs. SSE after:

benchmark             old ns/op    new ns/op    delta
BenchmarkAcosh               81           49  -39.14%
BenchmarkAsinh              109          109   +0.00%
BenchmarkAtanh               73           74   +0.68%
BenchmarkLgamma             138           42  -69.20%
BenchmarkModf                24           15  -36.95%
BenchmarkSqrtGo             565          556   -1.59%

R=rsc
CC=golang-dev
https://golang.org/cl/7028048
2013-01-03 00:44:31 +01:00
Russ Cox
5e46d540c8 cmd/dist: use separate args for separate compiler flags
This makes dist safe for CL 7035043 (but keeps working now too).

R=golang-dev, remyoudompheng
CC=golang-dev
https://golang.org/cl/7029047
2013-01-02 17:52:54 -05:00
Brad Fitzpatrick
5e8ca201d1 net/http: make NewRequest pick a ContentLength from a *bytes.Reader too
It already did so for its sibling, *strings.Reader, as well as *bytes.Buffer.

R=edsrzf, dave, adg, kevlar, remyoudompheng, adg, rsc
CC=golang-dev
https://golang.org/cl/7031045
2013-01-02 14:40:27 -08:00
Thomas Kappler
cdec0850f8 encoding/json: don't panic marshaling anonymous non-struct field
Add a check for this case and don't try to follow the anonymous
type's non-existent fields.

Fixes #4474.

R=rsc
CC=golang-dev
https://golang.org/cl/6945065
2013-01-02 17:39:41 -05:00
Russ Cox
a29702f067 A+C: Thomas Kappler (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7038049
2013-01-02 17:39:20 -05:00
Rick Arnold
948f0b7a0b net/http: document Request.URL
Request.URL had no documentation before and some people were expecting all fields to be populated.

Fixes #3805.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7008046
2013-01-02 17:37:27 -05:00
Rémy Oudompheng
15f2c01f44 cmd/8g: fix possibly uninitialized variable in foptoas.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7045043
2013-01-02 23:20:52 +01:00
Rémy Oudompheng
9afb34b42e cmd/dist, cmd/8g: implement GO386=387/sse to choose FPU flavour.
A new environment variable GO386 is introduced to choose between
code generation targeting 387 or SSE2. No auto-detection is
performed and the setting defaults to 387 to preserve previous
behaviour.

The patch is a reorganization of CL6549052 by rsc.

Fixes #3912.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6962043
2013-01-02 22:55:23 +01:00
Russ Cox
64a0017d6e sync/atomic: document that users must deal with 64-bit alignment
Update #599.

R=dvyukov, iant, minux.ma
CC=golang-dev
https://golang.org/cl/7001056
2013-01-02 15:44:00 -05:00
Rémy Oudompheng
20c76f7f3f cmd/gc: mark wrapper methods for unnamed types as DUPOK.
Unnamed types like structs with embedded fields can have methods.
These methods are generated on-the-fly by the compiler and
it may happen for identical types in different packages.
The linker must accept these multiple definitions.

Fixes #4590.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/7030051
2013-01-02 21:42:26 +01:00
Russ Cox
ae2131ab3b cmd/gc: make redeclaration between import and func less confusing
Fixes #4510.

R=ken2
CC=golang-dev
https://golang.org/cl/7001054
2013-01-02 15:34:28 -05:00
Russ Cox
8850d14fe9 test/run: handle compiledir and errorcheckdir with multi-file packages
Multiple files with the same package all get compiled together.

R=golang-dev, iant, dave
CC=golang-dev
https://golang.org/cl/7005053
2013-01-02 15:31:49 -05:00
Russ Cox
7ced3f12bc api: add go/types to next.txt
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7035045
2013-01-02 15:28:30 -05:00
Robert Griesemer
a846d479b3 go/types: remove most remaining uses of ast.Object from exported API
Also: Return first error whether an error handler is set in the
      context or not (bug fix).

R=adonovan
CC=golang-dev
https://golang.org/cl/7024043
2013-01-02 09:27:33 -08:00
Dmitriy Vyukov
b2e9ca7f2e doc: add race detector manual
R=minux.ma, franciscossouza, rsc, adg, adg
CC=golang-dev
https://golang.org/cl/6948043
2013-01-02 16:38:47 +04:00
Andrew Gerrand
d5d046e306 doc: update standard copyright header
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7034044
2013-01-02 16:26:25 +11:00
Andrew Gerrand
53d3bbcb95 A+C: Kamil Kisiel (individual CLA)
Generated by addca.

R=gobot
CC=golang-dev
https://golang.org/cl/7038046
2013-01-02 16:04:32 +11:00
Kamil Kisiel
267a55397b cmd/godoc: ignore misnamed examples and print a warning
Fixes #4211.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6970051
2013-01-02 16:00:41 +11:00
Dave Cheney
c2d2bfcc49 runtime: fix freebsd/arm instruction cache flush
sysarch requires arguments to be passed on the stack, not in registers.

Credit to Shenghou Ma (minux) for the fix.

R=minux.ma, devon.odell
CC=golang-dev
https://golang.org/cl/7037043
2013-01-01 21:47:42 +11:00
Dave Cheney
52dc13b5f3 go/build: disable cgo on freebsd/arm
Under FreeBSD-CURRENT on arm, cgo enabled binaries segfault. Disable cgo support for the moment so we can have a freebsd/arm builder on the dashboard.

R=minux.ma, rsc, iant
CC=golang-dev
https://golang.org/cl/7031044
2013-01-01 21:46:18 +11:00
Russ Cox
6592456feb cmd/gc: do not generate code for var _ = ... unless necessary
Fixes #2443.

R=ken2
CC=golang-dev
https://golang.org/cl/6997048
2012-12-30 12:01:53 -05:00
Ryan Slade
a4600126d9 encoding/json: encode map key is of string kind, decode only of string type
Allows encoding and decoding of maps with key of string kind, not just string type.
Fixes #3519.

R=rsc, dave
CC=golang-dev
https://golang.org/cl/6943047
2012-12-30 15:40:42 +11:00
Russ Cox
a22389ec38 runtime: say 'fatal error' instead of 'throw'
Fixes #4597.

R=ken2
CC=golang-dev
https://golang.org/cl/7032043
2012-12-29 21:48:25 -05:00
Dave Cheney
0c6beb00fb cmd/dist: use -pipe during bootstrap
R=golang-dev, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7025044
2012-12-30 10:33:33 +11:00
Sébastien Paolacci
e786829e83 runtime: handle locked mmap failure on Linux
Used to then die on a nil pointer situation. Most Linux standard setups are rather
restrictive regarding the default amount of lockable memory.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6997049
2012-12-29 14:34:06 -05:00