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>

d0f/go-zh,glycerine/jeaten-go-arrayof-structof,scirelli/scirelli-go,d0f/go-zh,webfd/go-zh,mhennings/marcohennings-go,webfd/go-zh,glycerine/jeaten-go-arrayof-structof,glycerine/jeaten-go-arrayof-structof,scirelli/scirelli-go,webfd/go-zh,rdp/rogerpack2005-golang,sanjosh/sanjos100-tipc,d0f/go-zh,webfd/go-zh,webfd/go-zh,glycerine/jeaten-go-arrayof-structof,webfd/go-zh,sanjosh/sanjos100-tipc,bryanxu/go-zh,glycerine/jeaten-go-arrayof-structof,scirelli/scirelli-go,sanjosh/sanjos100-tipc,sanjosh/sanjos100-tipc,glycerine/jeaten-go-arrayof-structof,scirelli/scirelli-go,bryanxu/go-zh,bryanxu/go-zh,mhennings/marcohennings-go,d0f/go-zh,rdp/rogerpack2005-golang,d0f/go-zh,rdp/rogerpack2005-golang,rdp/rogerpack2005-golang,bryanxu/go-zh,mhennings/marcohennings-go,bryanxu/go-zh,bryanxu/go-zh,bryanxu/go-zh,mhennings/marcohennings-go,d0f/go-zh,mhennings/marcohennings-go,sanjosh/sanjos100-tipc,glycerine/jeaten-go-arrayof-structof,scirelli/scirelli-go,scirelli/scirelli-go,webfd/go-zh,scirelli/scirelli-go,sanjosh/sanjos100-tipc,mhennings/marcohennings-go,sanjosh/sanjos100-tipc,glycerine/jeaten-go-arrayof-structof,rdp/rogerpack2005-golang,mhennings/marcohennings-go,rdp/rogerpack2005-golang,d0f/go-zh,bryanxu/go-zh,rdp/rogerpack2005-golang,mhennings/marcohennings-go,rdp/rogerpack2005-golang,sanjosh/sanjos100-tipc,webfd/go-zh,scirelli/scirelli-go,d0f/go-zh