英文:
package io/fs is not in GOROOT while building the go project
问题
我在Go方面没有太多经验,但我被指派执行一个Go项目
所以我需要构建这个Go项目,然后执行它。
当我构建Go项目时出现以下错误。似乎缺少一些依赖项(package和io/fs)。
transform/transform.go:13:2: package embed is not in GOROOT (/usr/local/Cellar/go/1.15.8/libexec/src/embed)
pkg/util/fs.go:4:2: package io/fs is not in GOROOT (/usr/local/Cellar/go/1.15.8/libexec/src/io/fs)
我的Go环境如下:
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/<XXXXX>/Library/Caches/go-build"
GOENV="/Users/<XXXXX>/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/<XXXXX>/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/<XXXXX>/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.15.8/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.8/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/<location to the project>/go.mod"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5h/9qptf0sx3c12226jnqt75q8r0000gp/T/go-build648466970=/tmp/go-build -gno-record-gcc-switches -fno-common"
请注意,这只是一个翻译,我无法为你解决构建错误。你可能需要检查你的依赖项和环境设置,确保所有的包和模块都正确安装和配置。
英文:
I don't have much experience in go but I have been tasked to execute a go project
So i need to build the go project and then execute it
Below is the error when i build the go project. Seems to be some dependency(package and io/fs) is missing
transform/transform.go:13:2: package embed is not in GOROOT (/usr/local/Cellar/go/1.15.8/libexec/src/embed)
pkg/util/fs.go:4:2: package io/fs is not in GOROOT (/usr/local/Cellar/go/1.15.8/libexec/src/io/fs)
my go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/<XXXXX>/Library/Caches/go-build"
GOENV="/Users/<XXXXX>/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/<XXXXX>/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/<XXXXX>/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.15.8/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.8/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/<location to the project>/go.mod"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5h/9qptf0sx3c12226jnqt75q8r0000gp/T/go-build648466970=/tmp/go-build -gno-record-gcc-switches -fno-common"
答案1
得分: 34
这个软件包需要 go v1.16,请升级您的go版本或使用适当的Docker构建器。
英文:
This package requires go v1.16, please upgrade your go version or use the appropriate docker builder.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论