doc/codewalk: gofmt pig.go

R=golang-dev, bradfitz
CC=golang-dev
https://codereview.appspot.com/7221079
net/url: normalize scheme to lower case (http not HTTP)

Also document %2f vs / ambiguity in URL.Path.

Fixes issue 3913.
Fixes issue 3659.

R=golang-dev, bradfitz
CC=golang-dev
https://codereview.appspot.com/7225076
io: guarantee err == nil for full reads in ReadFull and ReadAtLeast

This is a backwards compatible API change that fixes broken code.

In Go 1.0, ReadFull(r, buf) could return either len(buf), nil or len(buf), non-nil.
Most code expects only the former, so do that and document the guarantee.

Code that was correct before is still correct.
Code that was incorrect before, by assuming the guarantee, is now correct too.

The same applies to ReadAtLeast.

Fixes issue 4544.

R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://codereview.appspot.com/7235074
cmd/vet: check for misplaced and malformed build tags

Fixes issue 4184.

R=golang-dev, bradfitz, minux.ma, cookieo9
CC=golang-dev
https://codereview.appspot.com/7251044
cmd/ld: support for linking with host linker

A step toward a fix for issue 4069.

To allow linking with arbitrary host object files, add a linker mode
that can generate a host object file instead of an executable.
Then the host linker can be invoked to generate the final executable.

This CL adds a new -hostobj flag that instructs the linker to write
a host object file instead of an executable.

That is, this works:

        go tool 6g x.go
        go tool 6l -hostobj -o x.o x.6
        ld -e _rt0_amd64_linux x.o
        ./a.out

as does:

        go tool 8g x.go
        go tool 8l -hostld ignored -o x.o x.8
        ld -m elf_i386 -e _rt0_386_linux x.o
        ./a.out

Because 5l was never updated to use the standard relocation scheme,
it will take more work to get this working on ARM.

This is a checkpoint of the basic functionality. It does not work
with cgo yet, and cgo is the main reason for the change.
The command-line interface will likely change too.
The gc linker has other information that needs to be returned to
the caller for use when invoking the host linker besides the single
object file.

R=iant, iant
CC=golang-dev
https://codereview.appspot.com/7060044
cmd/vet: add missing -all logic

R=golang-dev, cookieo9, bradfitz
CC=golang-dev
https://codereview.appspot.com/7260043
encoding/base64: fix test for ReadFull change

R=golang-dev
CC=golang-dev
https://codereview.appspot.com/7249045
exp/cookiejar: remove external storage

This CL removes the external storage of a cookie jar
and minimized the exported API as discussed in [1].

[1] https://groups.google.com/d/topic/golang-dev/ygDB3nbir00/discussion

Update issue 1960.

R=nigeltao
CC=golang-dev
https://codereview.appspot.com/7235065

Committer: Nigel Tao <nigeltao@golang.org>
test: add test that caused a gccgo compilation failure

Updates issue 4734.

R=golang-dev, adg
CC=golang-dev
https://codereview.appspot.com/7228079
cmd/8l: fix build

TBR=golang-dev
CC=golang-dev
https://codereview.appspot.com/7241061
cmd/dist: redirect acid output to file to separate from errors

If runtime's proc.c does not compile, cmd/dist used to show
the compile errors in a sea of acid output, making them impossible
to find. Change the command invocation to write the acid output
to a file, so that the errors are the only thing shown on failure.

R=golang-dev, iant
CC=golang-dev
https://codereview.appspot.com/7221082
cmd/dist: fix build

The Unix and Plan 9 readfile call breset(b) but Windows was not,
leaving dregs in the buffer.

TBR=golang-dev
CC=golang-dev
https://codereview.appspot.com/7229069
cmd/cgo: document //export preamble restriction

Fixes issue 3497.

R=golang-dev, iant
CC=golang-dev
https://codereview.appspot.com/7235075
cmd/cgo: fix line number annotations in generated C code

The old version was using go/ast's CommentGroup.Text method,
but that method drops leading blank lines from the result, so that
if the comment looked like one of

//
// syntax error
import "C"

/*
syntax error
*/
import "C"

then the line numbers for the syntax error would be off by the
number of leading blank lines (1 in each of the above cases).

The new text extractor preserves blank lines.

Fixes issue 4019.

R=golang-dev, iant
CC=golang-dev
https://codereview.appspot.com/7232071
cmd/go: clean cgo compiler errors

Cut out temporary cgo file in error message.
Show C.foo instead of _Ctype_foo.

Before:
x.go:20[/var/folders/00/05_b8000h01000cxqpysvccm000n9d/T/go-build242036121/command-line-arguments/_obj/x.cgo1.go:19]: cannot use tv.Usec (type int32) as type _Ctype___darwin_suseconds_t in assignment

After:
x.go:20: cannot use tv.Usec (type int32) as type C.__darwin_suseconds_t in assignment

Fixes issue 4255.

R=golang-dev, iant
CC=golang-dev
https://codereview.appspot.com/7231075
runtime: cgo-related fixes

* Separate internal and external LockOSThread, for cgo safety.
* Show goroutine that made faulting cgo call.
* Never start a panic due to a signal caused by a cgo call.

Fixes issue 3774.
Fixes issue 3775.
Fixes issue 3797.

R=golang-dev, iant
CC=golang-dev
https://codereview.appspot.com/7228081
cmd/6c, cmd/6g: add flag to support large-model code generation

Added the -pic flag to 6c and 6g to avoid assembler instructions that
cannot use RIP-relative adressing. This is needed to support the -shared mode
in 6l.

See also:
https://codereview.appspot.com/6926049
https://codereview.appspot.com/6822078

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/7064048

Committer: Russ Cox <rsc@golang.org>
bytes, strings: add TrimPrefix and TrimSuffix

Everybody either gets confused and thinks this is
TrimLeft/TrimRight or does this by hand which gets
repetitive looking.

R=rsc, kevlar
CC=golang-dev
https://codereview.appspot.com/7239044
sort: add Reverse as a function

This updates: https://codereview.appspot.com/6909059/
Fixes issue 4511.

R=minux.ma, rsc
CC=golang-dev
https://codereview.appspot.com/6932054

Committer: Russ Cox <rsc@golang.org>
sort: delete now-duplicate example, fix build

R=golang-dev, minux.ma
CC=golang-dev
https://codereview.appspot.com/7220075