««« original CL description
cmd/go: respect $GOBIN always
Before, we only consulted $GOBIN for source code
found in $GOROOT, but that's confusing to explain
and less useful. The new behavior lets users set
GOBIN=$HOME/bin and have all go-compiled binaries
installed there.
Russ Cox [Mon, 12 Mar 2012 20:49:12 +0000 (16:49 -0400)]
cmd/go: respect $GOBIN always
Before, we only consulted $GOBIN for source code
found in $GOROOT, but that's confusing to explain
and less useful. The new behavior lets users set
GOBIN=$HOME/bin and have all go-compiled binaries
installed there.
The /doc hack is wrong. The code to handle this case was
already there and just needs a simple fix:
// We didn't find any directories containing Go files.
// If some directory returned successfully, use that.
- if len(all) == 0 && first != nil {
+ if !haveGo {
for _, d := range first {
haveName[d.Name()] = true
all = append(all, d)
Brad Fitzpatrick [Mon, 12 Mar 2012 06:07:38 +0000 (23:07 -0700)]
misc/dist: use archive/tar to generate tarballs
For people untarring with -p or as root, preserving file permissions.
This way we don't make tars owned by adg/eng or adg/staff or whatever
machine Andrew was on. Instead, we always build tarballs owned by predictable
users.
Shenghou Ma [Mon, 12 Mar 2012 02:20:25 +0000 (13:20 +1100)]
misc/dist: minimum target requirement is 10.6 for Darwin
As we've dropped support for Mac OS X 10.5, I think the generated .pkg
should reflect that decision.
But this CL make it impossible to generate pkg on Mac OS X 10.6, at least
for me.
Russ Cox [Sun, 11 Mar 2012 19:53:42 +0000 (15:53 -0400)]
cmd/go: local import fixes
1) The -D argument should always be a pseudo-import path,
like _/Users/rsc/foo/bar, never a standard import path,
because we want local imports to always resolve to pseudo-paths.
2) Disallow local imports in non-local packages. Otherwise
everything works but you get two copies of a package
(the real one and the "local" one) in your binary.
Gwenael Treguier [Sat, 10 Mar 2012 23:21:44 +0000 (15:21 -0800)]
database/sql: ensure Stmts are correctly closed.
To make sure that there is no resource leak,
I suggest to fix the 'fakedb' driver such as it fails when any
Stmt is not closed.
First, add a check in fakeConn.Close().
Then, fix all missing Stmt.Close()/Rows.Close().
I am not sure that the strategy choose in fakeConn.Prepare/prepare* is ok.
The weak point in this patch is the change in Tx.Query:
- Tests pass without this change,
- I found it by manually analyzing the code,
- I just try to make Tx.Query look like DB.Query.
Brad Fitzpatrick [Sat, 10 Mar 2012 18:00:02 +0000 (10:00 -0800)]
database/sql: fix double connection free on Stmt.Query error
In a transaction, on a Stmt.Query error, it was possible for a
connection to be added to a db's freelist twice. Should use
the local releaseConn function instead.
Thanks to Gwenael Treguier for the failing test.
Also in this CL: propagate driver errors through releaseConn
into *DB.putConn, which conditionally ignores the freelist
addition if the driver signaled ErrBadConn, introduced in a
previous CL.
Brad Fitzpatrick [Fri, 9 Mar 2012 22:45:40 +0000 (14:45 -0800)]
archive/zip: verify CRC32s in non-streamed files
We should check the CRC32s of files on EOF, even if there's no
data descriptor (in streamed files), as long as there's a non-zero
CRC32 in the file header / TOC.
Brad Fitzpatrick [Fri, 9 Mar 2012 22:12:02 +0000 (14:12 -0800)]
archive/zip: write data descriptor signature for OS X; fix bugs reading it
We now always write the "optional" streaming data descriptor
signature, which turns out to be required for OS X.
Also, handle reading the data descriptor with or without the
signature, per the spec's recommendation. Fix data descriptor
reading bugs found in the process.
Shenghou Ma [Fri, 9 Mar 2012 19:42:23 +0000 (03:42 +0800)]
cmd/dist, cmd/go: move CGO_ENABLED from 'go tool dist env' to 'go env'
So that we don't duplicate knowledge about which OS/ARCH combination
supports cgo.
Also updated src/run.bash and src/sudo.bash to use 'go env'.
Russ Cox [Thu, 8 Mar 2012 19:03:56 +0000 (14:03 -0500)]
runtime: inline calls to notok
When a very low-level system call that should never fail
does fail, we call notok, which crashes the program.
Often, we are then left with only the program counter as
information about the crash, and it is in notok.
Instead, inline calls to notok (it is just one instruction
on most systems) so that the program counter will
tell us which system call is unhappy.
Shenghou Ma [Thu, 8 Mar 2012 17:31:09 +0000 (01:31 +0800)]
doc: various update to command documents
1. consistent usage section (go tool xxx)
2. reformat cmd/ld document with minor correction
document which -H flags are valid on which ld
document -d flag can't be used on Windows.
document -Hwindowsgui
Francisco Souza [Thu, 8 Mar 2012 17:13:41 +0000 (12:13 -0500)]
misc/cgo: re-enable testso
The test.bash file generates .so file using gcc, builds the executable
using the go tool and then run it with the $LD_LIBRARY_PATH variable
pointing to the directory where the .so file lives.
Russ Cox [Thu, 8 Mar 2012 13:39:20 +0000 (08:39 -0500)]
cmd/godoc: add support for serving templates
doc: convert to use godoc built-in templates
tmpltohtml is gone, to avoid having a second copy of the code.
Instead, godoc -url /doc/go1.html will print the actual HTML
served for that URL. "make" will generate files named go1.rawhtml
etc, which can be fed through tidy.
It can be hard to tell from the codereview diffs, but all the
tmpl files have been renamed to be html files and then
have "Template": true added.
Russ Cox [Thu, 8 Mar 2012 13:32:38 +0000 (08:32 -0500)]
cmd/go: rebuild external test package dependencies
Was missing recompilation of packages imported only
by external test packages (package foo_test), primarily
because Root was not set, so those packages looked like
they were from a different Go tree, so they were not
recompiled if they already existed.
Also clean things up so that only one call to computeStale
is needed.
Fixes #3238.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5786048
Robert Griesemer [Thu, 8 Mar 2012 05:28:50 +0000 (21:28 -0800)]
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.
Russ Cox [Wed, 7 Mar 2012 19:54:31 +0000 (14:54 -0500)]
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.
Ian Lance Taylor [Wed, 7 Mar 2012 19:16:58 +0000 (11:16 -0800)]
test: fix testlib to not pass an empty argument to 6g
This change is necessary to make the run shell script work
again, but it is not sufficient as bug424.go's execution line
does not name the package that it imports.