[Solved] Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest FAILED和cannot install, GOBIN must be an ab

When configuring the go environment with vscode

Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest FAILED
"stderr": "cannot install, GOBIN must be an absolute path\n" // Prompt to set absolute path

Go components can be installed here, but go.exe installation in Bin cannot be found

We enter go env to view the environment configuration

set GO111MODULE=on
set GOARCH=amd64
set GOBIN=D:\Program Files\Go\bin  // Here is the path used to install the go component
set GOCACHE=C:\Users\44305\AppData\Local\go-build
set GOENV=C:\Users\44305\AppData\Roaming\go\env  // --------------------------------这里是env文件存放的位置
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\44305\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\44305\go
set GOPRIVATE=
set GOPROXY=https://goproxy.io,direct
set GOROOT=D:\Program Files\Go // ---------------Here is the location of the go installation
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.17.1
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\44305\AppData\Local\Temp\go-build352704544=/tmp/go-build -gno-record-gcc-switches

Use the command line to find that the settings still do not work. Finally, modify the file directly
1) the first step is to find the env file
set goenv = C:\users\44305\appdata\roaming\go\env// ——————————————- here is the location where the env file is stored

2) The second step is to open it with a notebook

3) the third step is to set the path here to the bin file in the following directory
set goroot = D:\program files\go// ——————– here is the location where go is installed

Finally, close vscode and then open it to install successfully

Tools environment: GOPATH=C:\Users\44305\go, GOBIN=D:\Program Files\Go\bin
Installing 8 tools at the configured GOBIN: D:\Program Files\Go\bin in module mode.
  go-outline
  gotests
  gomodifytags
  impl
  goplay
  dlv
  staticcheck
  gopls

Installing github.com/ramya-rao-a/go-outline@latest (D:\Program Files\Go\bin\go-outline.exe) SUCCEEDED
Installing github.com/cweill/gotests/gotests@latest (D:\Program Files\Go\bin\gotests.exe) SUCCEEDED
Installing github.com/fatih/gomodifytags@latest (D:\Program Files\Go\bin\gomodifytags.exe) SUCCEEDED
Installing github.com/josharian/impl@latest (D:\Program Files\Go\bin\impl.exe) SUCCEEDED
Installing github.com/haya14busa/goplay/cmd/goplay@latest (D:\Program Files\Go\bin\goplay.exe) SUCCEEDED
Installing github.com/go-delve/delve/cmd/dlv@latest (D:\Program Files\Go\bin\dlv.exe) SUCCEEDED
Installing honnef.co/go/tools/cmd/staticcheck@latest (D:\Program Files\Go\bin\staticcheck.exe) SUCCEEDED
Installing golang.org/x/tools/gopls@latest (D:\Program Files\Go\bin\gopls.exe) SUCCEEDED

All tools successfully installed. You are ready to Go. :)

Read More: