Open bmccord2 opened 2 years ago
Vim-go is unlikely to support mingw64 explicitly; I don't have a Windows machine to test with, and arguably one would be better off using Vim built for Windows than trying to use one built specifically for mingw64.
I think the error message you're seeing is actually coming from gopls
and is merely being surfaced by vim-go. I'm not sure if there's anything that vim-go can do about this. I wonder if this would resolve itself if you configured your environment to use the mingw64 version of Go and then rebuilt the binaries that vim-go needs using :GoUpdateBinaries
.
mingw64 doesn't provide golang package because it is the same windows version. Last time I tried to figure out root cause it was a problem with a path notations: /
vs \
. But using same binaries from shell itself worked fine.
Yes, the problems is paths, but the systems ability to understand a path will depend on how it was compiled. In this case, it looks like gopls
was compiled outside of mingw, but is being used inside of mingw. Running vim in mingw and executing :GoUpdateBinaries gopls
may resolve this.
Yes, the problems is paths, but the systems ability to understand a path will depend on how it was compiled. In this case, it looks like
gopls
was compiled outside of mingw, but is being used inside of mingw. Running vim in mingw and executing:GoUpdateBinaries gopls
may resolve this.
Nope. Same error as at issue description.
I'm not sure how to solve this. The problem is the the path has /C:/c
where it should just be /c
. I think this may be a consequence of effectively trying to use a binaries in the mingw context that are compiled without using mingw, but I'm not sure, and I don't have a way to test.
It may be related to the Go version that's being used, or something else. Until we can find a solution, I'd recommend not using mingw's Vim on Windows with vim-go.
Maybe we can get to the bottom of this. Here's what I need:
let g:go_debug=['lsp']
and reproduce the problem. I need the contents of the __GOLSP_LOG__
window.:echo expand('%:p:h')
output for you?:echo expand('%:p')
output for you?:echo resolve('%:p:h)
output for you?:cd expand('%:p:h) | !go env GOMOD
output for you?I'd recommend not using mingw's Vim on Windows with vim-go.
Idea is to use vim within a shell. So, I'm not using vim-go :D
execute ..
File: D:\main.go
1) let g:go_debug=['lsp']
===== sent =====
Content-Length: 227
{"method":"textDocument/didChange","jsonrpc":"2.0","params":{"contentChanges":[{"text":"package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfmt.Println(\"vim-go\")\n}\n"}],"textDocument":{"uri":"file:///d/main.go","version":5}}}
2) echo expand('%:p:h')
/d
3) echo expand('%:p')
/d/main.go
4) echo resolve('%:p:h)
; mistake in the command, do You want echo resolve(expand('%:p:h'))
? Here it is
/d
5) cd expand('%:p:h') | !go env GOMOD
E344: Can't find directory "expand('/d')" in cdpath
E472: Command failed
Press ENTER or type command to continue
Hey sorry I haven't been active in this thread--I actually forgot I posted this issue. I ended up using VS Code for the golang development I needed to do and am not actively using golang at this time so I don't have much to offer in terms of debugging unfortunately
What did you do? (required: The issue will be closed when not provided)
Ran plugin with mingw64 (git bash for windows). I believe this problem likely would affect msys2 as well.
What did you expect to happen?
What happened instead?
When opening a file paths are not properly formed in plugin. I get a message like:
vim-go: failed to load view for file:///C:/c/path/to/my/project: invalid workspace folder path: The system cannot find the path specified.; check that the casing of the configured workspace folder path agrees with the casing reported by the operating system
Looked into the code a little bit,
has('Win32')
is used by the IsWin function in util.vim. This returns 0 for msys2/mingw64.has('Win32unix')
returns 1 as doeshas('unix')
.Also, GoInstallBinaries did not work without explicitly setting GOBIN variable as GOPATH/bin (not sure if this is related or not, I no longer have the error messages, but they complained about GOBIN).
Configuration (MUST fill this out):
vim-go version:
4d6962d8
vimrc
you used to reproduce:vimrc
```vim set nocompatible " be iMproved, required filetype off " required set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() "call vundle#begin('~/some/path/here') Plugin 'VundleVim/Vundle.vim' Plugin 'heavenshell/vim-pydocstring' Plugin 'wannesm/wmgraphviz.vim' Plugin 'vim-scripts/reload.vim' Plugin 'vim-scripts/vim-misc' Plugin 'romainl/Apprentice' Plugin 'iamcco/markdown-preview.nvim' Plugin 'fatih/vim-go' call vundle#end() " required filetype plugin indent on " required "filetype plugin on colorscheme default if &diff colorscheme molokai endif :set tabstop=4 :set shiftwidth=4 :set softtabstop=4 :set expandtab :set autoindent augroup myvimrchooks au! autocmd bufwritepost .vimrc source ~/.vimrc augroup END filetype plugin on autocmd FileType yaml setlocal shiftwidth=2 tabstop=2 softtabstop=2 nmapVim version (first three lines from
:version
):Go version (
go version
):go version go1.19 windows/amd64
Go environment
go env
Output:gopls version
gopls version
Output: