go/build: allow ~ in middle of path, just not at beginning
go/build: allow ~ in middle of path, just not at beginning

CL 7799045 relaxed the restriction in cmd/go on ~ in GOPATH
to allow paths with ~ in the middle while continuing to
protect against the common mistake of using GOPATH='~/home'
instead of GOPATH=~/home.  Unfortunately go/build still
filters these paths out:

        $ GOPATH=/tmp/test~ing go build
        test.go:22:2: cannot find package "test" in any of:
                /usr/lib/go/test (from $GOROOT)
                ($GOPATH not set)

So relax the requirement in go/build, too.

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

Committer: Russ Cox <5ad239cb8a44f659eaaee0aa1ea5b94947abe557@golang.org>

pombredanne/go-deleteme,gnanderson/go,dsriram/golang,pombredanne/go-deleteme,tv42/old-go,apparentlymart/golang,tv42/old-go,dsriram/golang,dsriram/golang,tv42/old-go,dsriram/golang,tv42/old-go,pombredanne/go-deleteme,dsriram/golang,tv42/old-go,apparentlymart/golang,apparentlymart/golang,pombredanne/go-deleteme,apparentlymart/golang,gnanderson/go,pombredanne/go-deleteme,apparentlymart/golang,tv42/old-go,dsriram/golang,gnanderson/go,pombredanne/go-deleteme,tv42/old-go,gnanderson/go,apparentlymart/golang,gnanderson/go,gnanderson/go,pombredanne/go-deleteme,dsriram/golang,apparentlymart/golang,gnanderson/go