1
0
mirror of https://github.com/golang/go synced 2024-10-04 12:31:21 -06:00
Commit Graph

9565 Commits

Author SHA1 Message Date
Alex Brainman
2b8a7adde8 go/build: do not parse .syso files
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5786049
2012-03-08 17:06:53 +11:00
Robert Griesemer
f3c39d8f2b go/parser: avoid endless loop in case of internal error
Factored the error synchronization code into two functions
syncStmt and syncDecl. Because they may return w/o advancing
the scanner, there is potential for endless loops across
multiple parse functions; typically caused by an incorrect
token list in these functions (e.g., adding token.ELSE to
syncStmt will cause the parser to go into an endless loop
for test/syntax/semi7.go without this mechanism). This would
indicate a compiler bug, exposed only in an error situation
for very specific source files. Added a mechanism to force
scanner advance if an endless loop is detected. As a result,
error recovery will be less good in those cases, but the parser
reported a source error already and at least doesn't get stuck.

R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5784046
2012-03-07 21:28:50 -08:00
Russ Cox
d4fb568e04 cmd/gc: implement len(array) / cap(array) rule
The spec is looser than the current implementation.
The spec edit was made in CL 4444050 (May 2011)
but I never implemented it.

Fixes #3244.

R=ken2
CC=golang-dev
https://golang.org/cl/5785049
2012-03-07 22:43:28 -05:00
Russ Cox
43d71e7d7d cmd/cgo: silence const warnings
Fixes #3152.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5786047
2012-03-07 22:40:32 -05:00
Shenghou Ma
d56e0e7e94 doc: fix freebsd build
Also rename it to test.bash, for naming consistency.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5784045
2012-03-08 12:04:49 +09:00
Russ Cox
9069721b0e cmd/gc: delete old map delete in walk
R=ken2
CC=golang-dev
https://golang.org/cl/5783047
2012-03-07 22:03:35 -05:00
Russ Cox
b0996334c1 go/build, cmd/go: add support for .syso files
.syso files are system objects copied directly
into the package archive.

Fixes #1552.

R=alex.brainman, iant, r, minux.ma, remyoudompheng
CC=golang-dev
https://golang.org/cl/5778043
2012-03-07 22:03:18 -05:00
Francisco Souza
686d699ec6 io: minor change in io.WriteAt docs.
R=adg, bradfitz
CC=golang-dev
https://golang.org/cl/5787048
2012-03-08 12:49:13 +11:00
Robert Griesemer
5827dd052c go/scanner: better panic diagnostic
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5787045
2012-03-07 16:57:26 -08:00
Alex Brainman
0029b0d207 path/filepath: retrieve real file name in windows EvalSymlinks
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5756049
2012-03-08 10:00:25 +11:00
Shenghou Ma
90010f8f63 build: re-enable some broken tests in run.bash
Updates #2982.

R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5759064
2012-03-08 06:23:56 +08:00
Rémy Oudompheng
5c4d6ebb11 cmd/go: support -compiler for go list, fix isStale for gccgo.
Fixes #3228.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5784044
2012-03-07 23:15:55 +01:00
Dmitriy Vyukov
c8b1f85493 encoding/gob: fix memory corruption
Fixes #3175.

R=golang-dev, iant, rsc, r
CC=golang-dev
https://golang.org/cl/5758069
2012-03-08 08:53:08 +11:00
Russ Cox
b0beeb1501 runtime: fix freebsd crash
FreeBSD, alone among our supported operating systems,
required that usleep not be interrupted.  Don't require that.

Fixes #3217.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5781045
2012-03-07 15:30:54 -05:00
Robert Griesemer
c8981c718b go/parser: better error synchronization
gofmt reports now a single, accurate error for
the test case of issue 3106.

Also: Added test harness for general error
checking and two test cases for now.

Fixes #3106.

R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5755062
2012-03-07 12:24:20 -08:00
Russ Cox
babbf941c9 net, net/rpc, reflect, time: document concurrency guarantees
Fixes #1599.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5777043
2012-03-07 14:55:09 -05:00
Russ Cox
291636b99b testing: do not print 'no tests' when there are examples
I am not sure why RunTests and RunExamples are
exported, but I assume that because they are we
should not change the signature, so I added an
unexported global shared by Main and RunTests.

Fixes #3237.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5779043
2012-03-07 14:54:31 -05:00
Rémy Oudompheng
3dcedb620c runtime: try extending arena size in 32-bit allocator.
If it didn't reach the limit, we can try extending the arena
before resorting to random memory mappings and praying for the
kernel to be kind.

Fixes #3173.

R=rsc, rsc
CC=golang-dev
https://golang.org/cl/5725045
2012-03-07 14:21:45 -05:00
Brad Fitzpatrick
0210f4137b io: more docs on WriterAt
Updates #1599

R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/5774043
2012-03-07 10:54:04 -08:00
Mikkel Krautz
4aab8806e7 deps: allow crypto/x509 to use syscall
Allows the Windows part of CL 5700087 to land.

I had build tested CL 5753060 (which allows
crypto/x509 to use cgo and io/ioutil), and
didn't spot any errors on Windows.

Turns out I was wrong.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5753065
2012-03-07 13:51:05 -05:00
Robert Griesemer
9e8e4a9313 go/parser: better error sync. if commas are missing
This time for sure.
Runs all tests.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5752060
2012-03-07 10:19:32 -08:00
Robert Griesemer
3a065c5a73 godoc: update documentation
R=rsc
CC=golang-dev
https://golang.org/cl/5758057
2012-03-07 10:19:16 -08:00
Mikkel Krautz
a324a5ac20 crypto/x509: new home for root fetchers; build chains using Windows API
This moves the various CA root fetchers from crypto/tls into crypto/x509.

The move was brought about by issue 2997. Windows doesn't ship with all
its root certificates, but will instead download them as-needed when using
CryptoAPI for certificate verification.

This CL changes crypto/x509 to verify a certificate using the system root
CAs when VerifyOptions.RootCAs == nil. On Windows, this verification is
now implemented using Windows's CryptoAPI. All other root fetchers are
unchanged, and still use Go's own verification code.

The CL also fixes the hostname matching logic in crypto/tls/tls.go, in
order to be able to test whether hostname mismatches are honored by the
Windows verification code.

The move to crypto/x509 also allows other packages to use the OS-provided
root certificates, instead of hiding them inside the crypto/tls package.

Fixes #2997.

R=agl, golang-dev, alex.brainman, rsc, mikkel
CC=golang-dev
https://golang.org/cl/5700087
2012-03-07 13:12:35 -05:00
Russ Cox
807aadcd3e cmd/go: fix go test -compiler
The compiler must be changed with the Set method
so that the buildToolchain gets updated too.

Fixes #3231.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5768044
2012-03-07 12:09:43 -05:00
Russ Cox
a385f38dfa net: delete usableLocalPort from test
The old way to find a port was to listen :0 and then
look at what port it picked, close the listener, and then
immediately try to listen on that port.

On some Windows 7 machines that sequence fails at
the second listen, because the first one is still lingering
in the TCP/IP stack somewhere.  (Ironically, most of these
are used in tests of a "second listen", which in this case
ends up being the third listen.)

Instead of this race, just return the listener from the
function, replacing usableLocalPort+Listen with
usableListenPort.

Fixes #3219.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5769045
2012-03-07 12:06:22 -05:00
Russ Cox
b37841cc06 runtime/pprof: disable test on Leopard 64-bit
Fixes #3234.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5756078
2012-03-07 11:44:54 -05:00
Russ Cox
f4b40d92c8 cmd/cgo: document CGO_LDFLAGS and CGO_CFLAGS
Fixes #3203.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5769043
2012-03-07 11:44:47 -05:00
Russ Cox
318465b52a make.bash: fix old builds
Fixes #3222.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5761044
2012-03-07 11:38:05 -05:00
Russ Cox
afb1b0e6b7 undo CL 5754063 / e23b66fcfc94
Does not actually test so files.

««« original CL description
misc/cgo: re-enable testso

Also enabled it for darwin.

R=rsc
CC=golang-dev
https://golang.org/cl/5754063

»»»

R=golang-dev, minux.ma, r, f
CC=golang-dev
https://golang.org/cl/5756075
2012-03-07 10:15:20 -05:00
Mikio Hara
ae7a843471 net: use IANA reserved port to test dial timeout
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5757060
2012-03-07 16:28:40 +09:00
Russ Cox
4267974c0b cmd/gc: unnamed struct types can have methods
Fixes #3143.

R=ken2
CC=golang-dev
https://golang.org/cl/5752070
2012-03-07 02:27:15 -05:00
Russ Cox
987a580b9f cmd/gc: do not confuse unexported methods of same name
Fixes #3146.

R=ken2
CC=golang-dev
https://golang.org/cl/5756074
2012-03-07 01:55:17 -05:00
Alex Brainman
5aee1f3a0f exp/wingui: getting relocated to
go get code.google.com/p/gowingui

R=golang-dev, minux.ma, r
CC=golang-dev
https://golang.org/cl/5752067
2012-03-07 17:48:09 +11:00
Shenghou Ma
6a426169f5 cmd/go: always provide .exe suffix on windows
Fixes #3190.

R=rsc, tjyang2001, rsc
CC=golang-dev
https://golang.org/cl/5759056
2012-03-07 14:25:24 +08:00
Shenghou Ma
c086bc1d7d cmd/dist: fix build for Linux/ARM
find() returns -1 when not found.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5752068
2012-03-07 14:24:28 +08:00
Mikio Hara
e2b207bc4f sync/atomic: disable store and load test on a single processor machine
Fixes #3226.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5756073
2012-03-07 14:51:20 +09:00
Russ Cox
c804efb5de net: fix TestDialTimeout on windows builder
I don't know what's out there, but something
is answering to 127.0.71.111:80 on our builder,
so use a different port.

Also insert a check that the dial fails, which
would have diagnosed this problem.

Fixes #3016.

R=golang-dev, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/5754062
2012-03-07 00:41:24 -05:00
Francisco Souza
152a1aa610 misc/cgo: re-enable testso
Also enabled it for darwin.

R=rsc
CC=golang-dev
https://golang.org/cl/5754063
2012-03-07 00:40:16 -05:00
Russ Cox
c10650979f net: disable another external network test
I don't know enough about multicast.
Should this be disabled on all systems, not just Windows?

R=golang-dev
CC=golang-dev
https://golang.org/cl/5754060
2012-03-07 00:02:07 -05:00
Russ Cox
85ae6a18b5 cmd/go: fix run errors
$ go run
go run: no go files listed
$ go run ../../pkg/math/bits.go
go run: cannot run non-main package
$

Fixes #3168.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5755064
2012-03-07 00:01:57 -05:00
Shenghou Ma
881966d2a5 cmd/go, cmd/godoc, net: fix typo
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5757050
2012-03-07 12:41:43 +08:00
Russ Cox
7c7966a426 net: disable use of external listen along with other external network uses
By default the all.bash tests must not ever announce
on an external address.  It's not just an OS X issue.

R=golang-dev, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5753067
2012-03-06 23:35:31 -05:00
Russ Cox
c3f4319a24 misc/cgo: re-enable some tests
The testso directory still needs to be enabled.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5731048
2012-03-06 23:27:30 -05:00
Russ Cox
0bc18811b5 fmt, log: stop using unicode
$ go list -f '{{.ImportPath}} {{.Deps}}' fmt log
fmt [errors io math os reflect runtime strconv sync sync/atomic syscall time unicode/utf8 unsafe]
log [errors fmt io math os reflect runtime strconv sync sync/atomic syscall time unicode/utf8 unsafe]

R=bradfitz, rogpeppe, r, r, rsc
CC=golang-dev
https://golang.org/cl/5753055
2012-03-06 23:27:11 -05:00
Rob Pike
8f61631c74 go/build: delete Makefile
We can write syslist.go by hand.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5757057
2012-03-07 14:10:49 +11:00
Rob Pike
544a72cc86 exp/wingui: remove reference to Make.inc
R=golang-dev, bradfitz, alex.brainman
CC=golang-dev
https://golang.org/cl/5757058
2012-03-07 14:06:16 +11:00
Rob Pike
905cb4881b all: remove some references to Make.inc etc.
There are a few more but these are the easiest ones.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5756067
2012-03-07 13:51:49 +11:00
Rob Pike
f91326b7b1 strconv: remove dependence on unicode and strings
We need a compact, reasonably efficient IsPrint. That adds about 2K of data,
plus a modest amount of code, but now strconv is a near-leaf package.

R=r, bradfitz, adg, rsc, minux.ma
CC=golang-dev
https://golang.org/cl/5756050
2012-03-07 13:50:31 +11:00
Brad Fitzpatrick
502e29f485 database/sql: add docs about connection state, pooling
Fixes #3223

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5755063
2012-03-06 17:44:47 -08:00
Alex Brainman
7a3c6c950b os: fix SameFile to work for directories on windows
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5756064
2012-03-07 11:01:23 +11:00
Adam Langley
3ea3a7c9a5 deps: allow crypto/x509 cgo and io/ioutil.
In order to land 5700087 (which moves the knowledge of how to get the
root certificates for the system from crypto/tls to crypto/x509), we
need to relax the restrictions on crypto/x509. Afterwards, we can
probably tighten them up in crypto/tls.

R=golang-dev, rsc, krautz
CC=golang-dev
https://golang.org/cl/5753060
2012-03-06 17:18:09 -05:00
Brad Fitzpatrick
48eacd90a8 database/sql: fix typo bug resulting in double-Prepare
Bug reported by Blake Mizerany found while writing
his new Postgres driver.

R=golang-dev, blake.mizerany
CC=golang-dev
https://golang.org/cl/5754057
2012-03-06 14:10:58 -08:00
Rob Pike
aeefe0fa6e path/filepath: disable AbsTest on windows
SameFile has a bug.

R=golang-dev
TBR=rsc
CC=golang-dev
https://golang.org/cl/5754055
2012-03-07 08:14:12 +11:00
Rob Pike
2184137cf3 path/filepath/path_test.go: repair and enable TestAbs
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5759051
2012-03-07 07:54:56 +11:00
Robert Griesemer
39b186da6c go/parser: fix build (temporarily disable recent change)
R=golang-dev
CC=golang-dev
https://golang.org/cl/5752059
2012-03-06 11:23:27 -08:00
Robert Griesemer
67cbe9431f go/parser: better error sync. if commas are missing
R=rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5756045
2012-03-06 11:05:16 -08:00
Adam Langley
4f25e4be02 crypto/tls: make the package description more accurate and less aspirational.
Fixes #3216.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5755056
2012-03-06 12:49:29 -05:00
Shenghou Ma
db80edde7d time: during short test, do not bother tickers take longer than expected
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5752058
2012-03-07 01:10:55 +08:00
Ian Lance Taylor
aabbcda816 runtime: remove unused runtime·signame and runtime·newError
R=golang-dev
CC=golang-dev
https://golang.org/cl/5756044
2012-03-06 09:07:00 -08:00
Maxim Pimenov
eb2163ffbb cmd/go: honour buildflags in go run
Either documentation or implementation
of go run's flags is wrong currently.
This change assumes the documentation
to be right.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5752054
2012-03-06 09:33:35 -05:00
Rémy Oudompheng
9eda2b9977 net: do not use reflect for DNS messages.
Fixes #3201.

R=bradfitz, bradfitz, rsc
CC=golang-dev, remy
https://golang.org/cl/5753045
2012-03-06 08:02:39 +01:00
Mikio Hara
9442c4429a net: add skip message to test
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5753048
2012-03-06 15:41:17 +09:00
Brad Fitzpatrick
932c8ddba1 cmd/go: allow go get with arbitrary URLs
This CL permits using arbitrary, non-VCS-qualified URLs as
aliases for fully VCS-qualified and/or well-known code hosting
sites.

Example 1) A VCS-qualified URL can now be shorter.

Before:
$ go get camlistore.org/r/p/camlistore.git/pkg/blobref
After:
$ go get camlistore.org/pkg/blobref

Example 2) A custom domain can be used as the import,
referencing a well-known code hosting site.

Before:
$ go get github.com/bradfitz/sonden
After:
$ go get bradfitz.com/pkg/sonden

The mechanism used is a <meta> tag in the HTML document
retrieved from fetching:

    https://<import>?go-get=1  (preferred)
    http://<import>?go-get=1   (fallback)

The meta tag should look like:

<meta name="go-import" content="import-alias-prefix vcs full-repo-root">

The full-repo-root must be a full URL root to a repository containing
a scheme and *not* containing a ".vcs" qualifier.

The vcs is one of "git", "hg", "svn", etc.

The import-alias-prefix must be a prefix or exact match of the
package being fetched with "go get".

If there are multiple meta tags, only the one with a prefix
matching the import path is used. It is an error if multiple
go-import values match the import prefix.

If the import-alias-prefix is not an exact match for the import,
another HTTP fetch is performed, at the declared root (which does
*not* need to be the domain's root).

For example, assuming that "camlistore.org/pkg/blobref" declares
in its HTML head:

<meta name="go-import" content="camlistore.org git https://camlistore.org/r/p/camlistore" />

... then:

$ go get camlistore.org/pkg/blobref

... looks at the following URLs:

   https://camlistore.org/pkg/blobref?go-get=1
   http://camlistore.org/pkg/blobref?go-get=1
   https://camlistore.org/?go-get=1
   http://camlistore.org/?go-get=1

Ultimately it finds, at the root (camlistore.org/), the same go-import:

<meta name="go-import" content="camlistore.org git https://camlistore.org/r/p/camlistore" />

... and proceeds to trust it, checking out git //camlistore.org/r/p/camlistore at
the import path of "camlistore.org" on disk.

Fixes #3099

R=r, rsc, gary.burd, eikeon, untheoretic, n13m3y3r, rsc
CC=golang-dev
https://golang.org/cl/5660051
2012-03-05 22:36:15 -08:00
Alex Brainman
36708a40e0 cmd/dist: use correct hg tag for go version
When looking for suitable tag always start
from current version, not the tip.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5731059
2012-03-06 17:21:39 +11:00
Russ Cox
347cc981f0 cmd/go: add -compiler
go/build: add Context.Compiler

Fixes #3157.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5756047
2012-03-06 00:36:24 -05:00
Russ Cox
e9d5a641d7 strconv: add table-based isPrint
Not used yet for simpler merge.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5756048
2012-03-06 00:36:12 -05:00
Brad Fitzpatrick
9ff00c8fc9 go/build: fix windows and plan9 builds
Bit of a band-aid fix.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5757045
2012-03-05 21:33:44 -08:00
Rob Pike
eab4261946 strconv: remove dependency on bytes
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5759044
2012-03-06 15:25:42 +11:00
Russ Cox
88e86936be go/build: add dependency test
This exercises the Import function but more importantly
gives us a place to write down the policy for dependencies
within the Go tree.  It also forces us to look at the dependencies,
which may lead to adjustments.

Surprises:
 - go/doc imports text/template, for HTMLEscape (could fix)
 - it is impossible to use math/big without fmt (unfixable)
 - it is impossible to use crypto/rand without math/big (unfixable)

R=golang-dev, bradfitz, gri, r
CC=golang-dev
https://golang.org/cl/5732062
2012-03-05 23:13:00 -05:00
Rob Pike
98c1baff6f unicode/utf16: delete dependence on package unicode
In the test, verify the copied constants are correct.
Also put the test into package utf16 rather than utf16_test;
the old location was probably due creating the test from
utf8, but the separation is not needed here.

R=golang-dev, bradfitz, rsc, rsc, r
CC=golang-dev
https://golang.org/cl/5752047
2012-03-06 14:58:08 +11:00
Russ Cox
866317af5e cmd/godoc: fixes
These appear to have been left out of the CL I submitted earlier.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5759043
2012-03-05 22:47:35 -05:00
Russ Cox
5e41fe0e45 build: use run.go for running tests
Also, tweak run.go to use no more than 2x the
number of CPUs, and only one on ARM.

53.85u 13.33s 53.69r 	 ./run
50.68u 12.13s 18.85r 	 go run run.go

Fixes #2833.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5754047
2012-03-05 22:47:23 -05:00
Russ Cox
4e110af169 runtime: add Compiler
R=iant, r, gri
CC=golang-dev
https://golang.org/cl/5720073
2012-03-05 22:28:02 -05:00
Russ Cox
0a6fdcf63b net: silence another epoll print
R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/5752048
2012-03-05 22:07:22 -05:00
Mikio Hara
195ccd5dac net: fix windows build
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5755045
2012-03-06 10:07:08 +09:00
Mikio Hara
d4e1383285 net: improve server and file tests
* Splits into three server tests.
  - TestStreamConnServer for tcp, tcp4, tcp6 and unix networks
  - TestSeqpacketConnServer for unixpacket networks
  - TestDatagramPacketConnServer for udp, udp4, udp6 and unixgram networks
* Adds both PacketConn and Conn test clients to datagram packet conn tests.
* Fixes wildcard listen test cases on dual IP stack platform.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5701066
2012-03-06 09:43:45 +09:00
Rob Pike
d9832987ba unicode/utf8: remove dependence on unicode.
The dependency was there only to pull in two constants.
Now we define them locally and verify equality in the test.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5754046
2012-03-06 11:14:45 +11:00
Ian Lance Taylor
46031400d0 reflect: fix comment spacing
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5757043
2012-03-05 15:51:58 -08:00
David Symonds
63e383cff8 expvar: add locking to String, and use RWMutex properly throughout.
R=bradfitz
CC=golang-dev
https://golang.org/cl/5754043
2012-03-06 09:13:26 +11:00
Rémy Oudompheng
aa1aaee7fd runtime: wait for main goroutine before setting GOMAXPROCS.
Fixes #3182.

R=golang-dev, dvyukov, rsc
CC=golang-dev, remy
https://golang.org/cl/5732057
2012-03-05 16:40:27 -05:00
Brad Fitzpatrick
610b5b2fd8 net: remove all direct fmt and bytes imports
Once dnsMsg stops using reflect, we lose even more
indirect dependencies.

R=rsc
CC=golang-dev
https://golang.org/cl/5751043
2012-03-05 13:36:05 -08:00
Russ Cox
6e3a7930eb cmd/gc: if $GOROOT_FINAL is set, rewrite file names in object files
GOROOT_FINAL is a build parameter that means "eventually
the Go tree will be installed here".  Make the file name information
match that eventual location.

Fixes #3180.

R=ken, ken
CC=golang-dev
https://golang.org/cl/5742043
2012-03-05 16:13:33 -05:00
Russ Cox
c0a842e57f runtime/debug: fix test when source cannot be found
This happens with GOROOT_FINAL=/somewhere/else

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5727069
2012-03-05 16:13:15 -05:00
Brad Fitzpatrick
7300b43c2b net: remove more use of fmt
Also add a TODO for the broken *dnsMsg String method.

R=golang-dev, rsc, borman
CC=golang-dev
https://golang.org/cl/5720075
2012-03-05 12:20:58 -08:00
Brad Fitzpatrick
82a9294d1b net: don't import bytes or fmt in mac.go
Also add some more MAC tests.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5728065
2012-03-05 11:43:28 -08:00
Russ Cox
eb5db57d1a cmd/go: sync type Package and go list doc
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5730061
2012-03-05 14:41:30 -05:00
Shenghou Ma
6e211225d7 syscall: fix mkall.sh, mksyscall_linux.pl, and regen for Linux/ARM
CL 3075041 says ARM is not little-endian, but my test suggests otherwise.
My test program is:

    package main
    import ("fmt"; "syscall"; "os")
    func main() {
       err := syscall.Fallocate(1, 1/*FALLOC_FL_KEEP_SIZE*/, 0, int64(40960));
       fmt.Fprintln(os.Stderr, err)
    }

Without this CL, ./test > testfile will show: file too large; and strace shows:
    fallocate(1, 01, 0, 175921860444160)    = -1 EFBIG (File too large)
With this CL, ./test > testfile will show: <nil>; and strace shows:
    fallocate(1, 01, 0, 40960)              = 0

Quoting rsc:
"[It turns out that] ARM syscall ABI requires 64-bit arguments to use an
(even, odd) register pair, not an (odd, even) pair. Switching to "big-endian"
worked because it ended up using the high 32-bits (always zero in the tests
we had) as the padding word, because the 64-bit argument was the last one,
and because we fill in zeros for the rest of the system call arguments, up to
six. So it happened to work."

I updated mksyscall_linux.pl to accommodate the register pair ABI requirement,
and removed all hand-tweaked syscall routines in favor of the auto-generated
ones. These including: Ftruncate, Truncate, Pread and Pwrite.

Some recent Linux/ARM distributions do not bundle kernel asm headers,
so instead we always get latest asm/unistd.h from git.kernel.org (just like
what we do for FreeBSD).

R=ken, r, rsc, r, dave, iant
CC=golang-dev
https://golang.org/cl/5726051
2012-03-06 03:12:11 +08:00
Brad Fitzpatrick
1042d7d5ef expvar: add missing locking in String methods
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5726062
2012-03-05 11:09:50 -08:00
Rémy Oudompheng
c073a1602a cmd/go: honor buildflags in go test.
Fixes #3196.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5725044
2012-03-05 19:58:04 +01:00
Russ Cox
cae604f734 cmd/gc: must not inline panic, recover
R=lvd, gri
CC=golang-dev
https://golang.org/cl/5731061
2012-03-05 13:51:44 -05:00
Russ Cox
5ab9d2befd cmd/gc: show duplicate key in error
R=ken2
CC=golang-dev
https://golang.org/cl/5728064
2012-03-05 13:47:36 -05:00
Paul Borman
1b311776c4 csv: clarify what a negative FieldsPerRecord means
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5729068
2012-03-05 13:34:12 -05:00
Russ Cox
8dbd9d746d encoding/json: document that nil slice encodes as null
Fixes #3189.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5730058
2012-03-05 13:29:22 -05:00
Russ Cox
8e5b34e580 godoc: quiet log spam
Fixes #3191.
Sorry.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5726059
2012-03-05 13:29:13 -05:00
Adam Langley
ed35d5e0fb crypto/x509: enforce path length constraint.
An X.509 path length constrains the number of certificate that may
follow in the chain. This is a little simplistic for a first pass as it
doesn't check self-signed certificates (which don't count towards the
length), but it's conservatively simplistic.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5727057
2012-03-05 12:08:42 -05:00
Adam Langley
52d6ca2f86 crypto/x509: don't include empty additional primes in PKCS#1 private key.
asn1 didn't have an omitempty tag, so the list of additional primes in
an RSA private key was serialised as an empty SEQUENCE, even for
version 1 structures. This tripped up external code that didn't handle
v2.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5729062
2012-03-05 12:04:18 -05:00
Adam Langley
6aed613030 encoding/asn1: handle UTCTime before the year 2000
UTCTime only has a two digit date field and year values from 50 should
be 1950, not 2050.

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5729063
2012-03-05 11:31:24 -05:00
Mikio Hara
b5dc8724cb net: make Dial and Listen behavior consistent across over platforms
This CL changes the behavior of Dial and Listen API family.

Previous Dial and Listen allow a combo of "tcp6" and IPv4 or IPv6
IPv4-mapped address as its argument, but it also makes slightly
different behaviors between Linux and other platforms. This CL fixes
such differences across over platforms by tweaking IP-level socket
option IPV6_V6ONLY. Consequently new Dial and Listen API family will
reject arguments consists of "tcp6" and IPv4 or IPv6 IPv4-mapped
address.

This CL also adds a bit clarified unicast listener tests.

Fixes #2581.

R=rsc, minux.ma
CC=golang-dev
https://golang.org/cl/5677086
2012-03-06 00:13:10 +09:00
Russ Cox
fae0d35043 godoc: support $GOPATH, simplify file system code
The motivation for this CL is to support $GOPATH well.
Since we already have a FileSystem interface, implement a
Plan 9-style name space.  Bind each of the $GOPATH src
directories onto the $GOROOT src/pkg directory: now
everything is laid out exactly like a normal $GOROOT and
needs very little special case code.

The filter files are no longer used (by us), so I think they
can just be deleted.  Similarly, the Mapping code and the
FileSystem interface were two different ways to accomplish
the same end, so delete the Mapping code.

Within the implementation, since FileSystem is defined to be
slash-separated, use package path consistently, leaving
path/filepath only for manipulating operating system paths.

I kept the -path flag, but I think it can be deleted too.

Fixes #2234.
Fixes #3046.

R=gri, r, r, rsc
CC=golang-dev
https://golang.org/cl/5711058
2012-03-05 10:02:46 -05:00
Stefan Nilsson
a347fdb035 encoding/binary: improve package comment.
The current package comment doesn't mention varints and
protocol buffers. Also, the first sentence is incomprehensible
without further context as "fixed-size values" is undefined.

R=rsc
CC=golang-dev
https://golang.org/cl/5715048
2012-03-05 10:02:30 -05:00
Volker Dobler
06e18ca5a3 strings: Rename example to match function name.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5729065
2012-03-05 22:19:51 +11:00
Andrew Gerrand
7e8ed8f616 cmd: update formatting of usage messages
R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/5738045
2012-03-05 14:23:00 +11:00
Rob Pike
f5a1dd888d doc/progs: update for go 1
Fixes #3076.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5727056
2012-03-05 12:49:31 +11:00
Rob Pike
2c0a46d604 cmd/go: fix grammar error in help messages
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5729061
2012-03-05 11:52:31 +11:00
Scott Lawrence
30f9c99e3e html/template: fix comment typo
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5730051
2012-03-05 10:58:43 +11:00
Mikio Hara
4d35583661 net: move MAC address parser into distinct file
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5727054
2012-03-05 07:42:07 +09:00
Andrew Gerrand
dd29609244 godoc: fix codewalks
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5732056
2012-03-04 11:53:07 +11:00
Rob Pike
227a04d771 text/template: one more test case
Missed a case for variadic functions with too few arguments.
The code passes, and with the right error, but might as well record the test case.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5732050
2012-03-04 08:06:26 +11:00
Rob Pike
f1d3ff1660 text/template: clean up function values
The recent addition of automatic function invocation generated
some troublesome ambiguities. Restore the previous behavior
and compensate by providing a "call" builtin to make it easy to
do what the automatic invocation did, but in a clear and explicit
manner.

Fixes #3140.

At least for now.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/5720065
2012-03-03 23:14:20 +11:00
Russ Cox
604f375110 cmd/go: fix relative imports again
I tried before to make relative imports work by simply
invoking the compiler in the right directory, so that
an import of ./foo could be resolved by ./foo.a.
This required creating a separate tree of package binaries
that included the full path to the source directory, so that
/home/gopher/bar.go would be compiled in
tmpdir/work/local/home/gopher and perhaps find
a ./foo.a in that directory.

This model breaks on Windows because : appears in path
names but cannot be used in subdirectory names, and I
missed one or two places where it needed to be removed.

The model breaks more fundamentally when compiling
a test of a package that lives outside the Go path, because
we effectively use a ./ import in the generated testmain,
but there we want to be able to resolve the ./ import
of the test package to one directory and all the other ./
imports to a different directory.  Piggybacking on the compiler's
current working directory is then no longer possible.

Instead, introduce a new compiler option -D prefix that
makes the compiler turn a ./ import into prefix+that,
so that import "./foo" with -D a/b/c turns into import
"a/b/c/foo".  Then we can invent a package hierarchy
"_/" with subdirectories named for file system paths:
import "./foo" in the directory /home/gopher becomes
import "_/home/gopher/foo", and since that final path
is just an ordinary import now, all the ordinary processing
works, without special cases.

We will have to change the name of the hierarchy if we
ever decide to introduce a standard package with import
path "_", but that seems unlikely, and the detail is known
only in temporary packages that get thrown away at the
end of a build.

Fixes #3169.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5732045
2012-03-02 22:16:02 -05:00
Shenghou Ma
a142ed99d5 fix build for FreeBSD/amd64
R=rsc, golang-dev, iant
CC=golang-dev
https://golang.org/cl/5732043
2012-03-03 04:47:42 +08:00
Shenghou Ma
5aea33742a ld: allow more -L options
Dynamically allocate the libdir array, so we won't need to bother it again.
        Enhances CL 5727043.

R=rsc
CC=golang-dev
https://golang.org/cl/5731043
2012-03-03 04:14:31 +08:00
Robert Griesemer
6474eda490 go/printer: simpler exprList code, more tests
Except for the tests, this is mostly deleting code:

- removed several exprListModes:
  blankStart: easily done explicitly, and trailing blanks
    are cleaned up by the trimmer post-pass
  blankEnd: never used
  commaSep: all exprLists calls had this set

- added test cases for multi-line returns
(for a later fix of issue 1207)

- no formatting changes

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5672062
2012-03-02 11:16:05 -08:00
Robert Griesemer
de7361bf98 all: more typos
R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/5720044
2012-03-02 11:15:45 -08:00
Shenghou Ma
a3caf073a5 net: during short test, don't bother timeout longer than expected
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5716053
2012-03-03 00:50:18 +08:00
Rémy Oudompheng
1feecdd633 cmd/go: avoid repeated include dirs.
Fixes #3171.

R=golang-dev, rsc
CC=golang-dev, remy
https://golang.org/cl/5724045
2012-03-02 11:31:13 -05:00
Russ Cox
d08a8848bb cmd/go: fix test import dependency bug
Fixes a problem Rob is having with goprotobuf.
Cannot add a test because the same case is more broken
when using ./ imports.  That still needs to be fixed,
and is one aspect of issue 3169.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5725043
2012-03-02 11:27:36 -05:00
Rémy Oudompheng
11e7eabb7e cmd/go: fixes for gccgo.
Also remove useless "install" argument to pkgpath now that go/build
defines package install locations.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5714059
2012-03-02 08:36:53 +01:00
Gustavo Niemeyer
7e19e53391 build: add GO_ prefix to LDFLAGS and GCFLAGS
Build environments will often define stock LDFLAGS
that are not compatible with the gc ld, causing
non-obvious failures midway through the build.

R=golang-dev, rsc, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5724044
2012-03-02 02:45:01 -03:00
Alex Brainman
d1bd332a67 os: sleep 5ms after process has exited on windows
Fixes #2866.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5719047
2012-03-02 16:35:42 +11:00
Alex Brainman
c3fbc9a5e8 os: implement UserTime/SystemTime on windows
Fixes #3145.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5721044
2012-03-02 14:47:40 +11:00
Rob Pike
36d9ee4aec os: fix grammar in ProcessState comment
Asymptotic convergence.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5719045
2012-03-02 14:07:26 +11:00
Russ Cox
30db6d41cd os: centralize documentation of Process and ProcessState
Also change Wait to say "exit" instead of "exit or stop".

I notice that Pid is not implemented on all systems.
Should we fix that?

Fixes #3138.

R=golang-dev, alex.brainman, r
CC=golang-dev
https://golang.org/cl/5710056
2012-03-01 21:56:54 -05:00
Russ Cox
d49475e078 go/build: fix build
Presumably something about the very large go/build
doc comment breaks the build constraint parser in
cmd/dist.  I don't feel like debugging C code right now,
so move it into its own file.  If cmd/dist decides doc.go
is not part of the package, it will still build correctly.

R=golang-dev
TBR=golang-dev
CC=golang-dev
https://golang.org/cl/5722043
2012-03-01 19:42:39 -05:00
Russ Cox
9316070419 go/build: document GOPATH
Fixes #2332.

R=golang-dev, remyoudompheng, gri, r, r
CC=golang-dev
https://golang.org/cl/5710055
2012-03-01 18:26:53 -05:00
Gustavo Niemeyer
e8c970e5f7 cmd/go: fix verbose command displaying
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5715050
2012-03-01 20:14:21 -03:00
Gustavo Niemeyer
04450d8a26 cmd/go: fix -I flag for gc command
R=rsc, remyoudompheng
CC=golang-dev
https://golang.org/cl/5711056
2012-03-01 20:13:04 -03:00
Robert Griesemer
7c6654aa70 all: fixed various typos
(Semi-automatically detected.)

R=golang-dev, remyoudompheng, r
CC=golang-dev
https://golang.org/cl/5715052
2012-03-01 14:56:05 -08:00
Russ Cox
af95499619 reflect: expand doc for Value.Interface
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5716057
2012-03-01 17:55:47 -05:00
Russ Cox
3c3c5f38a0 cmd/dist: Unix grammar fix
Fixes #3165.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/5712051
2012-03-01 13:38:05 -05:00
Gustavo Niemeyer
b5d4cffd15 encoding/xml: fix xml test tag usage
No real problem.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5717049
2012-03-01 15:20:13 -03:00
Dmitriy Vyukov
2295554db6 sync: add Once example
R=golang-dev, rsc, bradfitz
CC=golang-dev
https://golang.org/cl/5715046
2012-03-01 22:16:20 +04:00
Dmitriy Vyukov
986df83e0d sync: remove old WaitGroup example
The docs look awkward - there is a paragraph
"For example:" with a plain text example,
and straight below it a real Example.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5717048
2012-03-01 21:26:08 +04:00
Russ Cox
b03a5f66e8 cmd/go: fixes
* Install tools into tool dir always
  (Fixes issue 3049.  Fixes issue 2868.  Fixes issue 2925.)
* Make packages depend on compiler, linker (Fixes issue 3036.)
* Do not recompile packages across roots (Fixes issue 3149.)
* Allow use of binary-only packages (Fixes issue 2775.)
* Avoid duplicate cgo dependencies (Fixes issue 3001.)
* Show less in go get -x.  (Fixes issue 2926.)
* Do not force repo root for existing checkout (Fixes issue 2969.)
* Show full syntax error list always (Fixes issue 2811.)
* Clean arguments before processing (Fixes issue 3034.)
* Add flags for compiler, linker arguments (Fixes issue 2996.)
* Pass flags in make.bash (Fixes issue 3091.)
* Unify build flags, defined in one place.
* Clean up error messages (Fixes issue 3075.  Fixes issue 2923.)
* Support local import paths (Fixes issue 3118.)
* Allow top-level package outside $GOPATH (Fixes issue 3009.)

In addition to these fixes, all commands now take a list of
go files as a way to specify a single package, just as go build and
go run always have.  This means you can:

        go list -json x.go
        go fix x.go
        go vet x.go
        go test x_test.go

Preliminary tests in test.bash.
Mainly testing things that the ordinary build does not.
I don't mind if the script doesn't run on Windows.

I expect that gccgo support is now broken, and I hope that
people will feel free to file issues and/or send CLs to fix it.  :-)

R=golang-dev, dsymonds, r, rogpeppe
CC=golang-dev
https://golang.org/cl/5708054
2012-03-01 12:12:22 -05:00
Russ Cox
ebe1664d27 go/build: replace FindTree, ScanDir, Tree, DirInfo with Import, Package
This is an API change, but one I have been promising would
happen when it was clear what the go command needed.

This is basically a complete replacement of what used to be here.

build.Tree is gone.

build.DirInfo is expanded and now called build.Package.

build.FindTree is now build.Import(package, srcDir, build.FindOnly).
The returned *Package contains information that FindTree returned,
but applicable only to a single package.

build.ScanDir is now build.ImportDir.

build.FindTree+build.ScanDir is now build.Import.

The new Import API allows specifying the source directory,
in order to resolve local imports (import "./foo") and also allows
scanning of packages outside of $GOPATH.  They will come back
with less information in the Package, but they will still work.

The old go/build API exposed both too much and too little.
This API is much closer to what the go command needs,
and it works well enough in the other places where it is
used.  Path is gone, so it can no longer be misused.  (Fixes issue 2749.)

This CL updates clients of go/build other than the go command.
The go command changes are in a separate CL, to be submitted
at the same time.

R=golang-dev, r, alex.brainman, adg
CC=golang-dev
https://golang.org/cl/5713043
2012-03-01 12:12:09 -05:00
Russ Cox
a72b87efa9 reflect: make Value.Interface return immutable data
Fixes #3134.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5713049
2012-03-01 11:48:27 -05:00
Russ Cox
dc159fabff runtime: run init on main thread
Fixes #3125.

R=golang-dev, r, minux.ma
CC=golang-dev
https://golang.org/cl/5714049
2012-03-01 11:48:17 -05:00
Russ Cox
03769efe41 cmd/dist: recognize CC="ccache clang" as clang
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5711052
2012-03-01 11:46:13 -05:00
Anthony Martin
d88af88dfb 5g, 8g: remove documentation dregs
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5714051
2012-02-29 22:56:50 -08:00
David Symonds
289a1638aa html/template: encoding/json does more escaping now, so update the html/template test that uses it.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5714052
2012-03-01 17:52:05 +11:00
David Symonds
99e45e49b7 encoding/json: escape output from Marshalers.
Fixes #3127.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5707054
2012-03-01 17:41:59 +11:00
Alex Brainman
ed238ca4e5 os: release process handle at the end of windows (*Process).Wait
Fixes #3154.

R=golang-dev, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5707052
2012-03-01 17:36:35 +11:00
David Symonds
1f0f459a16 encoding/gob: more hardening for lengths of input strings.
Fixes #3160.

R=r
CC=golang-dev
https://golang.org/cl/5716046
2012-03-01 15:57:54 +11:00
Rob Pike
dd001b5931 text/template: add examples that use multiple templates
Fixes #2742.

R=golang-dev, peterthrun, adg
CC=golang-dev
https://golang.org/cl/5699083
2012-03-01 14:55:18 +11:00
Robert Griesemer
fd5718ce82 go/printer, gofmt: improved comment placement
Applied gofmt -w src misc (no changes).

Fixes #3147.

R=r, rsc
CC=golang-dev
https://golang.org/cl/5710046
2012-02-29 17:25:15 -08:00
Rob Pike
5a5279e128 io: Pipes and ReadAt are safe to use concurrently.
Updates #1599.

R=golang-dev, bradfitz, rsc, r
CC=golang-dev
https://golang.org/cl/5708056
2012-03-01 11:24:13 +11:00
Johan Euphrosine
6652b0b866 doc: add The Laws of Reflection article
Originally published on The Go Programming Language Blog, September 6, 2011.

http://blog.golang.org/2011/09/laws-of-reflection.html

Update #2547

R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/5689054
2012-03-01 10:05:51 +11:00
Mikio Hara
7301065fcc net: make -external flag for tests default to true
go test -short # like in the build; no external stuff
go test # long tests, + external
go test -external=false # long tests, no external

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5696079
2012-03-01 07:39:03 +09:00
Anthony Martin
564a1f3358 gc: fix string comparisons for new bool rules
The two string comparison optimizations were
missing the implicit cast from ideal bool.

Fixes #3119.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5696071
2012-02-29 13:55:50 -08:00
Russ Cox
fc268acf05 path/filepath: steer people away from HasPrefix
The strikes against it are:

1. It does not take path boundaries into account.
2. It assumes that Windows==case-insensitive file system
and non-Windows==case-sensitive file system, neither of
which is always true.
3. Comparing ToLower against ToLower is not a correct
implementation of a case-insensitive string comparison.
4. If it returns true on Windows you still don't know how long
the matching prefix is in bytes, so you can't compute what
the suffix is.

R=golang-dev, r, dsymonds, r
CC=golang-dev
https://golang.org/cl/5712045
2012-02-29 16:37:40 -05:00
Brad Fitzpatrick
8c5290502f time: skip a often-flaky test in short mode
In -test.short mode, skip measuring the upper bound of time
sleeps. The API only guarantees minimum bounds on sleeps,
anyway, so this isn't a bug we're ignoring as much as it is
simply observing bad builder virtualization and/or loaded
machines.

We keep the test in full mode where developers will
presumably be running on a lightly-loaded, native, fast
machine.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5713044
2012-02-29 13:14:05 -08:00
Russ Cox
7aba72baaa os: diagnose chdir error during StartProcess
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5711044
2012-02-29 15:53:57 -05:00
Russ Cox
b47cef394b path/filepath: note that SplitList is different from strings.Split
R=golang-dev, r, bradfitz, gustavo
CC=golang-dev
https://golang.org/cl/5712044
2012-02-29 15:50:46 -05:00
Russ Cox
d0d251f858 gc: disallow absolute import paths
They are broken and hard to make work.

They have never worked: if you import "/tmp/x"
from "/home/rsc/p.c" then the compiler rewrites
this into import "/home/rsc/tmp/x", which is
clearly wrong.

Also we just disallowed the : character in import
paths, so import "c:/foo" is already not allowed.

Finally, in order to support absolute paths well in
a build tool we'd have to provide a mechanism to
instruct the compiler to resolve absolute imports
by looking in some other tree (where the binaries live)
and provide a mapping from absolute path to location
in that tree.  This CL avoids adding that complexity.

This is not part of the language spec (and should not be),
so no spec change is needed.

If we need to make them work later, we can.

R=ken2
CC=golang-dev
https://golang.org/cl/5712043
2012-02-29 15:28:36 -05:00
Brad Fitzpatrick
8f0bfc5a29 net/http/httptest: make Server.Close wait for outstanding requests to finish
Might fix issue 3050

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5708066
2012-02-29 12:18:26 -08:00
Shenghou Ma
357b257cd1 runtime/pprof: skip test on 64-bit Mac OS X 10.6
R=rsc, bsiegert
CC=golang-dev
https://golang.org/cl/5709060
2012-03-01 03:11:37 +08:00
Shenghou Ma
df3a841021 doc: elaborate available checks for cmd/vet
R=golang-dev, r, ality, r
CC=golang-dev
https://golang.org/cl/5709053
2012-03-01 02:22:35 +08:00
Brad Fitzpatrick
3684ae9da0 net/http: make a test more paranoid & reliable on Windows, maybe.
Part of diagnosing issue 3050.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5707056
2012-02-29 09:53:20 -08:00
Brad Fitzpatrick
f5df930618 net/http: fix ProxyFromEnvironment bug, docs, add tests
Fixes #2919 I believe. (gets as far as sending a CONNECT
request to my little dummy logging proxy that doesn't actually
support CONNECT now.)  Untested with a real CONNECT-supporting
proxy, though.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5708055
2012-02-29 09:52:52 -08:00
Brad Fitzpatrick
02b124e59a net/http/httputil: make https DumpRequestOut less racy
It's still racy in that it mutates req.Body, though.  *shrug*

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5709054
2012-02-29 09:52:28 -08:00
Robert Hencke
fc79058199 gob: trivial print fix
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5707062
2012-02-29 08:45:57 -08:00
Robert Griesemer
b1b0ed1e60 go/printer: replace multiline logic
This CL mostly deletes code.

Using existing position information is
just as good to determine if a new section
is needed; no need to track exact multi-
line information. Eliminates the need to
carry around a multiLine parameter with
practically every function.

Applied gofmt -w src misc resulting in only
a minor change to godoc.go. In return, a couple
of test cases are now formatted better.

Not Go1-required, but nice-to-have as it will
simplify fixes going forward.

R=rsc
CC=golang-dev
https://golang.org/cl/5706055
2012-02-29 08:38:31 -08:00
Luuk van Dijk
fb2706113f pkg/runtime: 2 sanity checks in the runtime-gdb.py prettyprinters.
Don't try to print obviously corrupt slices or interfaces.
Doesn't actually solve 3047 or 2818, but seems a good idea anyway.

R=rsc, bsiegert
CC=golang-dev
https://golang.org/cl/5708061
2012-02-29 16:42:25 +01:00
Mikio Hara
ecdd9f2376 net: minor fixes to test
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5707058
2012-02-29 12:34:05 +09:00
Rob Pike
ee149d9a6b io: document that i/o is not necessarily safe for parallel access.
Updates #1599.

R=golang-dev, adg, dsymonds
CC=golang-dev
https://golang.org/cl/5704052
2012-02-29 13:30:08 +11:00
Brad Fitzpatrick
1b1039a1c1 net/http/httputil: fix DumpRequestOut on https URLs
Don't try to do an SSL negotiation with a *bytes.Buffer.

Fixes #3135

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5709050
2012-02-28 16:03:32 -08:00
Mikio Hara
e266d6064c net: fix comment on Dial with unixgram
We should use DialUnix or ListenPacket for unixgram networks
because Dial doesn't take a local UnixAddr.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5706043
2012-02-29 07:45:38 +09:00
Russ Cox
38a03de6a1 go/build: move code around
Only copy+paste here.
Will make next code review's diffs a bit smaller.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5704050
2012-02-28 16:34:41 -05:00
Russ Cox
6e2ae0a12c runtime/pprof: support OS X CPU profiling
Work around profiling kernel bug with signal masks.
Still broken on 64-bit Snow Leopard kernel,
but I think we can ignore that one and let people
upgrade to Lion.

Add new trivial tools addr2line and objdump to take
the place of the GNU tools of the same name, since
those are not installed on OS X.

Adapt pprof to invoke 'go tool addr2line' and
'go tool objdump' if the system tools do not exist.

Clean up disassembly of base register on amd64.

Fixes #2008.

R=golang-dev, bradfitz, mikioh.mikioh, r, iant
CC=golang-dev
https://golang.org/cl/5697066
2012-02-28 16:18:24 -05:00
Rémy Oudompheng
c10f50859e all: remove various unused unexported functions and constants.
R=golang-dev, minux.ma, rsc
CC=golang-dev, remy
https://golang.org/cl/5702050
2012-02-28 21:48:03 +01:00
Rob Pike
250fa82122 net/rpc: API changes, all documentation
except for hiding one type that is only used internally.

Fixes #2944.

R=golang-dev, rsc, kevlar
CC=golang-dev
https://golang.org/cl/5707044
2012-02-29 07:34:28 +11:00
Shenghou Ma
26daf6a03f cmd/dist: force line-buffering stdout/stderr on Unix
If stdout and stderr are indeed the same file (not a tty), which is
        often the case, fully-buffered stdout will make it harder to see
        progresses, for example, ./make.bash 2>&1 | tee log

R=r, rsc
CC=golang-dev
https://golang.org/cl/5700070
2012-02-29 02:22:28 +08:00
Mikkel Krautz
fb1a5fcacf crypto/tls: force OS X target version to 10.6 for API compatibility
This is a band-aid until we can use weak imports with cgo.

Fixes #3131.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5700083
2012-02-28 11:34:48 -05:00
Shenghou Ma
e0aa36147d encoding/gob: fix "// +build" comment for debug.go
R=golang-dev, rsc, adg, r, r
CC=golang-dev
https://golang.org/cl/5693060
2012-02-28 13:39:42 +08:00
Robert Griesemer
e952e241ae gotype: provide -comments flag
When debugging ASTs, it's useful to also
see the comments on occasion. Usage:

gotype -ast -comments file.go

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5703043
2012-02-27 21:35:26 -08:00
Rob Pike
26c2443d80 text/template: add example showing use of custom function
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5694100
2012-02-28 15:50:41 +11:00
Rob Pike
180541b2b1 text/template: fix redefinition bugs
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5696087
2012-02-28 14:23:57 +11:00
Rob Pike
7201b0c27c tutorial: delete
Instead we'll point people at the Tour and beef up code.html.

Fixes #3107.

R=golang-dev, bradfitz, r, adg
CC=golang-dev
https://golang.org/cl/5697077
2012-02-28 13:35:58 +11:00
Mikio Hara
d9c5626047 net: no panic on placeholders for netbsd
Perhaps it might be better than panic.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5701064
2012-02-28 10:58:01 +09:00
David Symonds
9dd746c4cb encoding/json: drop MarshalForHTML; gofix calls to Marshal.
I've elected to omit escaping the output of Marshalers for now.
I haven't thought through the implications of that;
I suspect that double escaping might be the undoing of that idea.

Fixes #3127.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5694098
2012-02-28 11:41:16 +11:00
Benny Siegert
740d503866 net: add stubs for NetBSD
This fixes the build of package net for GOOS=NetBSD.
Of course, a real implementation would be even better.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5693065
2012-02-28 11:28:10 +11:00
Benny Siegert
8c7b832ad5 os: fix NetBSD build
os.fileStat.Sys is no longer exported.

R=golang-dev, m4dh4tt3r, r
CC=golang-dev
https://golang.org/cl/5696074
2012-02-28 11:26:01 +11:00
Brad Fitzpatrick
fa33fdbc7d encoding/binary: better example
leave that joke to Java.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5695080
2012-02-28 10:15:23 +11:00
Andrew Gerrand
ce51e10749 archive/zip: use encoding/binary again, add readBuf helper
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5699097
2012-02-28 09:41:30 +11:00
Anthony Martin
eafe86c2df go/printer: fix printing of variadic function calls
Fixes #3130.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5697062
2012-02-27 13:56:43 -08:00
Rob Pike
5573fa3bc5 cmd/go: mention examples in docs for -test.run
Missed in my last round. These things sure appear
in a lot of places.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5699096
2012-02-28 08:55:25 +11:00
Rob Pike
ec15046a8d cmd/go: drop -example, apply -run to examples
Once more, with feeling.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5698080
2012-02-28 08:33:06 +11:00
Robert Griesemer
b495e5c538 strings: make Count example show results
Thanks to dr.volker.dobler for tracking this down.

Filed a long-term issue (3142) which may eventually
resolve this problem w/o the need for a manual fix.

R=iant
CC=golang-dev
https://golang.org/cl/5698078
2012-02-27 12:22:10 -08:00
Robert Griesemer
ab169c6e3f godoc: don't show directories w/o packages in flat dir mode
The main change is simple: Both the Directory and DirEntry
struct have an extra field 'HasPkg' indicating whether the
directory contains any package files. The remaining changes
are more comments and adjustments to the template files.

Fixes #3121.

R=golang-dev, bradfitz, sameer
CC=golang-dev
https://golang.org/cl/5699072
2012-02-27 11:18:00 -08:00
Anthony Martin
0706d00cb8 go/printer: fix test for new import path restrictions
Import paths with spaces are now invalid.

The builders would've caught this if they were running
the long tests.  I've removed the check for short tests
in this package since the current tests are fast enough
already.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5694082
2012-02-27 10:01:45 -08:00
Shenghou Ma
56ae9032b2 cmd/go: test -i should not disable -c
Fixes #3104.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5699088
2012-02-27 12:33:14 -05:00
Andrew Gerrand
eb825b58cc archive/zip: use smarter putUintXX functions to hide offsets
R=bradfitz, r, dsymonds, kyle
CC=golang-dev
https://golang.org/cl/5701055
2012-02-27 17:37:59 +11:00
Andrew Gerrand
228f44a1f5 archive/zip: stop using encoding/binary
R=golang-dev, r, bradfitz
CC=golang-dev
https://golang.org/cl/5694085
2012-02-27 16:29:22 +11:00
Rob Pike
28668c3a28 cmd/go: run examples even if -run is set if -example is also set
Allows one to disable everything but the example being debugged.
This time for sure.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5700079
2012-02-27 16:23:22 +11:00
Rob Pike
5876b4eb28 testing: add -test.example flag to control execution of examples
Also, don't run examples if -test.run is set.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5697069
2012-02-27 12:49:10 +11:00
Alex Brainman
c7482b9196 os: implement sameFile on windows
Fixes #2511.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5687072
2012-02-27 12:29:33 +11:00
Mikkel Krautz
e4db4e9b58 crypto/x509: fix typo in Verify documentation
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5695070
2012-02-27 11:49:06 +11:00
Mike Rosset
4762e9d98c html/template: use correct method signature, in introduction example.
R=golang-dev, nigeltao
CC=golang-dev
https://golang.org/cl/5695067
2012-02-27 11:31:38 +11:00
Rob Pike
b49dcb9d37 cmd/go: explain x... vs. x/... in help importpath
Fixes #3110.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5696083
2012-02-27 09:51:58 +11:00
Brad Fitzpatrick
761f946617 net/http/cgi: add an empty response test
New test for http://code.google.com/p/go/source/detail?r=a73ba18

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5701046
2012-02-26 14:46:22 -08:00