Go 找不到包“;“bufio”;在任何

Go 找不到包“;“bufio”;在任何,go,installation,Go,Installation,我已经通过直接在我的ubuntu18.04上下载预编译二进制软件包安装了go1.11.5。现在我想通过从源代码构建来安装go1.12,所以我将继续 我设置GOROOT\u引导=~/GOROOT\u引导 $ mkdir -p ~/goroot_bootstrap/bin $ cp /usr/local/go/bin/go ~/goroot_bootstrap/bin/ $ echo "export GOROOT_BOOTSTRAP=~/goroot_bootstrap" >> ~/.b

我已经通过直接在我的ubuntu18.04上下载预编译二进制软件包安装了go1.11.5。现在我想通过从源代码构建来安装go1.12,所以我将继续

我设置GOROOT\u引导=~/GOROOT\u引导

$ mkdir -p ~/goroot_bootstrap/bin
$ cp /usr/local/go/bin/go ~/goroot_bootstrap/bin/
$ echo "export GOROOT_BOOTSTRAP=~/goroot_bootstrap" >> ~/.bashrc
$ source ~/.bashrc
然后,获取源代码

$ git clone -b release-branch.go1.12 https://github.com/golang/go.git ~/github.com/golang/go
建造

它失败了,提示:

Building Go cmd/dist using /home/pi/goroot_bootstrap.
cmd/dist/imports.go:12.2: cannot find package "bufio" in any of:
        /home/pi/goroot_bootstrap/src/bufio (from $GOROOT)
        /home/pi/go/src/bufio (from $GOPATH)
...
但是如果我设置GOROOT\u BOOTSTRAP=/usr/local/go,它就会成功。
然后,我在src/make.bash阅读源代码

166  rm -f cmd/dist/dist
167  GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist
引导工具链在第167行使用GOROOT=“$GOROOT\u bootstrap”构建cmd/dist。
如果我有GOROOT_BOOTSTRAP=/usr/local/go set和success,这意味着构建仍然依赖于旧的包,比如bufio

那么,为什么设置GOROOT\u BOOTSTRAP=~/GOROOT\u BOOTSTRAP时失败呢?
如果设置GOROOT\u BOOTSTRAP=/usr/local/go,构建是否依赖于旧包?
哪种方法是从源代码安装的正确方法


任何帮助都将不胜感激。

进行工具初始构建的脚本在$GOROOT\u引导中查找现有的Go工具链
——您需要整个工具链,而不仅仅是
Go
binary@JimB可能需要整个goroot
166  rm -f cmd/dist/dist
167  GOROOT="$GOROOT_BOOTSTRAP" GOOS="" GOARCH="" GO111MODULE=off "$GOROOT_BOOTSTRAP/bin/go" build -o cmd/dist/dist ./cmd/dist