go инструмент dist: FAILED: не репо Git; необходимо поместить файл ВЕРСИИ в $ GOROOT - PullRequest
0 голосов
/ 21 июня 2020

Я пытаюсь построить свою программу, используя кроссплатформенные шаги для воспроизведения проблемы:

apt-get install golang gox
sudo gox -build-toolchain

    The toolchain build can't be parallelized because compiling a single
Go source directory can only be done for one platform at a time. Therefore,
the toolchain for each platform will be built one at a time.

--> Toolchain: plan9/386
--> Toolchain: linux/amd64
--> Toolchain: darwin/386
--> Toolchain: freebsd/arm
--> Toolchain: openbsd/amd64
--> Toolchain: openbsd/386
--> Toolchain: darwin/amd64
--> Toolchain: linux/arm
--> Toolchain: freebsd/386
--> Toolchain: windows/amd64
--> Toolchain: freebsd/amd64
--> Toolchain: windows/386
--> Toolchain: netbsd/386
--> Toolchain: netbsd/arm
--> Toolchain: linux/386
--> Toolchain: netbsd/amd64

16 errors occurred:
plan9/386: Error building 'plan9/386': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

linux/amd64: Error building 'linux/amd64': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

darwin/386: Error building 'darwin/386': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

freebsd/arm: Error building 'freebsd/arm': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

openbsd/amd64: Error building 'openbsd/amd64': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

openbsd/386: Error building 'openbsd/386': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

darwin/amd64: Error building 'darwin/amd64': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

linux/arm: Error building 'linux/arm': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

freebsd/386: Error building 'freebsd/386': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

windows/amd64: Error building 'windows/amd64': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

freebsd/amd64: Error building 'freebsd/amd64': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

windows/386: Error building 'windows/386': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

netbsd/386: Error building 'netbsd/386': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

netbsd/arm: Error building 'netbsd/arm': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

linux/386: Error building 'linux/386': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

netbsd/amd64: Error building 'netbsd/amd64': go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT


uname -a
Linux kali 5.6.0-kali2-amd64 #1 SMP Debian 5.6.14-1kali1 (2020-05-25) x86_64 GNU/Linux

Поиск решения проблемы на Inte rnet не дал никаких результатов.

go версия go версия go1.14.3 linux / amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/crank/.cache/go-build"
GOENV="/home/crank/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/crank/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.14"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.14/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build051883282=/tmp/go-build -gno-record-gcc-switches"

VERSION файл в каталоге GOROOT = "/usr/lib/go-1.14 "присутствует.

cat /usr/lib/go-1.14/VERSION

go1.14.3

У меня те же проблемы, когда я пытаюсь в ручном режиме, когда я пытаюсь выполнить:

cd $(go env GOROOT)/src
sudo GOOS=windows GOARCH=amd64 CGO_ENABLED=0 ./make.bash --no-clean

Building Go cmd/dist using /usr/lib/go-1.14. (go1.14.3 linux/amd64)
go tool dist: FAILED: not a Git repo; must put a VERSION file in $GOROOT

Как исправить эту проблему? Как запустить кросс-компиляцию?

...