突然有了工具:没有这样的工具可以“编译". [英] All of a sudden go tool: no such tool "compile"

查看:49
本文介绍了突然有了工具:没有这样的工具可以“编译".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Ubuntu桌面上安装了go,在关闭计算机之前,它运行良好.

I had installed go on my Ubuntu desktop and it worked fine before I switch off the computer.

现在,当我启动机器并恢复该项目的工作时,我得到了

Now as I started my machine and resumed my work on the project, I get this

$ go build
go tool: no such tool "compile"
go tool: no such tool "compile"
go tool: no such tool "compile"
go tool: no such tool "compile"
go tool: no such tool "compile"

当我尝试构建项目时.

在关闭电源之前,我可能要做的唯一一件事就是使用

The only thing that I did before poweroff which might have some effect was to install godoc using

sudo apt-get install golang-doc

我直接通过下载 go1.10.1.linux-amd64.tar.gz 文件而不是使用 apt-get

I had install go directly by downloading go1.10.1.linux-amd64.tar.gz file, not using apt-get

转到环境

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/me/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/me/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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-build255010769=/tmp/go-build -gno-record-gcc-switches"

$ go版本

go version go1.10.1 linux/amd64

我仍然可以运行编译后的go代码.

I can still run comiled go code.

这里可能出了什么问题?我该如何解决?

What could have gone wrong here? How can I fix it?

推荐答案

compile 程序应位于您的 go env GOTOOLDIR ="/usr/local/go/pkg/tool/linux_amd64"目录.如果没有,请下载Go,删除/usr/local/go ,然后重新安装Go.

The compile program should be in your go env GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" directory. If not, download Go, delete /usr/local/go, and reinstall Go.

这篇关于突然有了工具:没有这样的工具可以“编译".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆