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"
When I try to build a project.
The only thing that I did before poweroff which might have some effect was to install godoc using
sudo apt-get install golang-doc
I had install go directly by downloading go1.10.1.linux-amd64.tar.gz
file, not using apt-get
go env
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 version
go version go1.10.1 linux/amd64
I can still run comiled go code.
What could have gone wrong here? How can I fix it?
It may seem odd, but running export GOROOT=
fixed the issue for me.
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.
I was facing the same issue in my MAC M1.
Previously, I had downloaded it using "brew". I tried downloading it manually and reinstalling it. That worked for me.
go version: 1.18.2 Download: https://go.dev/dl/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With