简体   繁体   中英

go tool: no such tool "link"

After upgrading Go from 1.13 to 1.15.11 using (go1.15.11.windows-amd64.msi) cannot use Go Build.. getting error

After command

go build -o test_plugin.exe cmd/main.go

Getting error: go tool: no such tool "link"

My system is Windows 10 - 64 bits

c:\Program Files\Go>go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\asik\AppData\Local\go-build
set GOENV=C:\Users\asik\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\asik\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\asik\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\ASIK~1\AppData\Local\Temp\go-build756567874=/tmp/go-build -gno-record-gcc-switches


Go>go tool

addr2line
api
asm
buildid
cgo
compile
cover
dist
doc
fix
go_bootstrap
nm
objdump
oldlink
pack
pprof
test2json
trace
vet

Do I need link, is there another tool we need to use for compiling source code into an.exe? Found the following similar question posted go build error: go tool: no such tool “link”

My system is 64bit and I installed go for a 64 bit, still getting the error. Please advise!

Thanks

Running this command:

go build -x file.go

Gives this result:

"c:\\go\\pkg\\tool\\windows_amd64\\link.exe" -o "$WORK\\b001\\exe\\a.out.exe"
-importcfg "$WORK\\b001\\importcfg.link" -buildmode=pie
-buildid=a3yQYdmCUBlKRJRnXOtI/-ILbUkUHpKsIsmcOlKCY/LTj3Pux0FskrMdFjMcGk/a3yQYdmCUBlKRJRnXOtI
-extld=gcc "$WORK\\b001\\_pkg_.a"

I would check to see if that file is in that location. You should not need to add it to the PATH . If that fails, I would just download this:

https://golang.org/dl/go1.16.3.windows-amd64.zip

and extract so that you are left with a path like C:\go\bin\go.exe .

That is because you didn't deleted the previous installation and there are some conflicting. This happens in linux when I don't remove the previous $GOROOT(c:\go fir windows) folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM