在以下任何位置都找不到软件包“ bufio”

I have get go1.11.5 installed by downloading precompiled binary package directly on my ubuntu18.04. Now i want to install go1.12 by building from source, so i follow with Installing Go from source.

I set GOROOT_BOOTSTRAP=~/goroot_bootstrap

$ mkdir -p ~/goroot_bootstrap/bin
$ cp /usr/local/go/bin/go ~/goroot_bootstrap/bin/
$ echo "export GOROOT_BOOTSTRAP=~/goroot_bootstrap" >> ~/.bashrc
$ source ~/.bashrc

Then, get source

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

Build

$ cd ~/github.com/golang/go/src
$ ./all.bash

It failed, and tips:

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)
...

But if i set GOROOT_BOOTSTRAP=/usr/local/go, it will success.
Then, i read source code at 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

The bootstrap toolchains build cmd/dist with GOROOT="$GOROOT_BOOTSTRAP" at line 167.
If i have GOROOT_BOOTSTRAP=/usr/local/go set and success, which means building still depending old package such as bufio.

So, why it failed when setting GOROOT_BOOTSTRAP=~/goroot_bootstrap?
Do building depends old package if setting GOROOT_BOOTSTRAP=/usr/local/go?
Which one is the right method to install from source?

Any help will be grateful.

dongxieli3839
dongxieli3839 可能需要整个goroot
一年多之前 回复
dsy48837
dsy48837 用于初始构建工具的脚本会在$GOROOT_BOOTSTRAP中查找现有的Go工具链-您需要整个工具链,而不仅仅是go二进制文件
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐