vim-go: could not find 'gopls' - go

After installing Plug 'fatih/vim-go' Plugin for golang i get few errors
steps:
When opening .go file with vim I get a error:
vim-go: could not find 'gopls' . Run :GoInstallBinaries to fix it
vim-go: could not determine appropriate working directory for go plus
When doing :GoInstallBinaries I get more errors like:
vim-go: guru not found. instaling golang.org..guru#master to folder C:\Users\*MYPC*\go\bin\
vim-go: Error instaling golang.org/x/tools/cmdfuru#master: The system cannot find the path specified.
vim-go: goplus not found. instaling golang.org..goplus#latest to folder C:\Users\*MYPC*\go\bin\
vim-go: Error instaling golang.org..goplus#latest: The system cannot find the path specified.
.
.
.
it does that 8 more times with godef,motion,errcheck,dlv,iferr,golint...
When i do :echo $PATH in Vim i have C:\Users*MYPC*\go\bin\
I am running gvim on Windows 10
golang in cmd or powershell work fine...

Just run go get golang.org/x/tools/gopls#latest, and problem solved!

Answer for WSL (Windows subsystem for Linux):
I tried to installed gopls manually, running go get golang.org/x/tools/gopls#latest but I was getting the following error:
XXXX#XXXX:~$ go get golang.org/x/tools/gopls#latest
go: can only use path#version syntax with 'go get' and 'go install' in module-aware mode
Changing the Go mode fixed the problem at this stage GO111MODULE=on, then I could run
go install golang.org/x/tools/gopls#latest
However, later on, when vim-go was trying to install the missing packages after running GoInstallBinaries I was getting errors that I couldn't use versions with go install. So what I did was reinstall Go (the latest version) on the system using these instructions. After doing that, vim-go was able to install the packages. I hope this answer saves time for future vim-go enthusiasts.

for mac was solved with
brew install gopls

In the vim-go setup instructions, there's a detail about running :GoInstallBinaries in vim after install. You probably missed it (I ran into this issue after I upgraded to a new go runtime)

Related

can't load package: package golang.org/dl/go1.10.7#latest: can only use path#version syntax with 'go get' when trying to install another go version

I'm following this link to install and manage multiple versions of go in my ubuntu container. When I try to execute the command go install golang.org/dl/go1.10.7#latest, I get this error
can't load package: package golang.org/dl/go1.10.7#latest: can only use path#version syntax with 'go get'
I also tried with go get golang.org/dl/go1.10.7#latest, this exits just after printing below line go: finding golang.org/dl latest without downloading.
I also tried skipping the latest tag in go install command, this exits without any message and the version not installed. Has anyone succeeded in installing different versions of golang in ubuntu container?
Open ~/.bash_profile then add:
$ export GOPATH=$HOME/go
$ export GOBIN=$HOME/go/bin
Then run:
source ~/.bash_profile
Try to run the command to install go:
go install golang.org/dl/go1.10.7#latest
Source: SettingGOPATH

Unable to install Go packages in Macbook with M1 chip

When I ran the command "go install github.com/go-delve/delve/cmd/dlv" in the delve folder, after downloading go-delve in my go path, the terminal showed the following result:
"go install github.com/go-delve/delve/cmd/dlv: mkdir /Desktop: read-only file system"
Terminal result put here
When I googled the same, I came across a website(https://www.dev2qa.com/how-to-fix-read-only-file-system-error-when-run-mkdir-command-on-macos/) which requires me to disable System Integrity Protection on my MacBook and it asks me to hold the option key or command + R immediately after Mac chimes in reboot after starting the MacBook, until I see a boot in a "console/terminal" mode.. But nothing happened when I tried doing that.
I am not knowing what to do. Please guide me through the right way to install dlv and other packages of go successfully on my Macbook.
make sure you use the right go version (1.16 or later, arm64)
$ go version
go version go1.17.1 darwin/arm64
make sure the env is right by this command
$ go env
check GOROOT GOPATH GOARCH GOBIN
try to install it directly
$ go install github.com/go-delve/delve/cmd/dlv#latest
your error occurs because you have no permission of /Desktop, and i'm sure install dlv don't need something like this, it will install to ~/go/bin

I'm trying to set up the emscripten SDK on Windows 10 but emcc can't be found

On linux there's no problem but I want to compile my code on windows. I follow the instructions exactly. Specifically, I open a command prompt and run the following in the same directory I cloned the emscripten git repo in to.
git pull
emsdk install latest
emsdk activate latest
emsdk_env.bat
There is suspiciously no output and emcc cannot be found. What could I be doing wrong here?
If you go to the command line and type python --version the version of python installed should come up.
If it doesn't, go to the directory in which python is installed and add this to your PATH.
Restart the command prompt and try python --version again. If you get the version of python, follow the steps you mentioned.
You should get some output.
Let me know if the problem still has not been resolved.
You need to install Python 2.7.12 or newer.
https://emscripten.org/docs/getting_started/downloads.html#windows

Anaconda Installation Error

I am trying to reinstall anaconda 64 bit on Windows 10 to use Python 3.6 and the installations works right till the end but it fails executing the post install script with following error.
You have some missing files, try to uninstall and download it again. Don't try to pause the files, it might cause these kind of errors.
I got it running after installing in a different directory. Just make sure you don't install it in the default location provided. I made a new directory in C-Drive and installed anaconda in it. My install location is C:\Anaconda3. And it worked finally

Debugging GO on VSCode using Delve

I want to debug GoLang on VSCode editor. In their documentation they say it is possible. I am following the following Link to install the debugging features on the IDE.
https://marketplace.visualstudio.com/items?itemName=lukehoban.Go
And to install Delve they ask to follow these instructions
https://github.com/derekparker/delve/blob/master/Documentation/installation/windows/install.md
Once installation is completed they ask to run the following code
$ mingw32-make install
But there is an error
mingw32-make: *** No rule to make target 'install'. Stop.
Does anybody know whats wrong with this? Has anything changed other than these instructions?
I managed to get this resolved. You don't want to install mingw for this. Instead run this code and make sure the dlv.exe which is created in any directory which is in your PATH variable in your computer.
$go get -u github.com/derekparker/delve/cmd/dlv
I also did an writeup about debugging Golang using VSCode and Delve. If you are interested you can read it here.
Run mingw32-make install command from directory created by git clone https://github.com/derekparker/delve command.

Resources