Installation of nvim-go fails with "Undefined variable: g:go#debug" - go

I'm switching to neovim and try to get nvim-go running. My Plug section in my init.vim looks like this:
call plug#begin('~/.vim/plugged')
Plug 'zchee/nvim-go', { 'do': 'make'}
Plug 'sebdah/vim-delve'
call plug#end()
If I open nvim and run PlugInstall, I get the following errors:
Error detected while processing
/home/domma/.vim/plugged/nvim-go/plugin/nvim-go. vim: line 20:
E121: Undefined variable: g:go#debug
I checked the file and the error makes sense. But I have no idea where this variable comes from, how it should be set. How can I fix this?

Temporary edit the line in /home/domma/.vim/plugged/nvim-go/plugin/nvim-go.vim: line 20
if g:go#debug -> if exists('g:go#debug')

Related

Vim Error "An error occurred while processing function ~AND" "E716: Key not present in Dictionary~" Solution

■Error Description.
Error detected while processing function <SNR>35_debounceTimeTimerCallback[1]..
<SNR>35_tapSourceCallback[4]..<SNR>35_tapSourceCallback[1]..<lambda>30[1]..<SNR
>55_set_signs[10]..<SNR>55_place_signs:
line 5:
E716: Key not present in Dictionary: linecount + 1
■Cause of error content output
I have set up an environment for Go development using the Vim editor on VirtusalBox.
■Contents of .vimrc
call plug#begin('~/.vim/plugged')
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
call plug#end()
I am unsure of the solution, can you please let me know?
It could be a bug of vim-lsp.
This pull request was merged to master 3 days ago. Removing the following lines from ~/.vim/plugged/vim-lsp/autoload/lsp/internal/diagnostics/signs.vim worked for me.
" Some language servers report an unexpected EOF one line past the end
if l:line == getbufinfo(a:bufnr)[0].linecount + 1
let l:line = l:line - 1
endif
You can see a list of the files that have been sourced by Vim with :help :scriptnames:
:scr
The XX in all the <SNR>XXs in the stack trace refers to script number XX in the output of the command above.
For example, this is the output of :scr in $ vim --clean on my machine:
1: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/defaults.vim
2: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/filetype.vim
3: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/ftplugin.vim
4: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/indent.vim
5: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/syntax.vim
6: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/synload.vim
7: ~/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/syncolor.vim
If I get a stack trace mentioning <SNR>4, I know the problem is in the ~/Applications/MacVim.app/Contents/Resources/vim/runtime/indent.vim file that comes with Vim. In this fictitious case, I would probably debug it a little bit further and open an issue on Vim's issue tracker.
In your case, the problem is very likely to happen in one of your plugins. Once you have identified it, you should head off to its issue tracker.

How can I handle the error in load_svmlight_file?

when I run this code in mac:
x_train, y_train = load_svmlight_file("mq2008.train")
I get this error in bash:
-bash: syntax error near unexpected token `('
and if I run it in shell, I face this error:
NameError: name 'load_svmlight_file' is not defined
How can I solve this problem?
Welcome to StackOverflow!
IMO, you have a Python code and trying to replicate its output. If so, you should first load all Python-related imports first. This is what it means to NameError here, Python interpreter is not able to understand what it is, because this function is not part of its existing definitions it has.
If I may suggest, please spend some time to get the hands-on-learning of Python.

Error with ruby script in windows platform

I want to run ruby code in windows 10 platform. I have already installed ruby (rubyinstaller-devkit-2.4.5-1-x64) and tried to run on command prompt, but I got errors on my result. Previously it worked fine on terminal (MAC). Can someone help me on this? Thank you very much
Dir. for each ($path + "/input/") do |entry|
if entry.match(/.*osc$/)
fix_missing_logo(entry)
process(entry)
FileUtils.move $path + "/input/" + entry, $path + "/backup/"
end
error:
Traceback (most recent call last): convert.rb:332:in <main>':
undefined methodeach' for main:Object (NoMethodError)
That's not how Dir works. It should be calling each like this:
Dir.new($path + "/input/").each do |entry|
# ...
end
As a note, please try and stay away from global variables. In Ruby $ means global variable, it's not like PHP where that means just any old variable. Global variables cause all sorts of problems, like their origin and ownership being unclear, and of name collisions.

Error encountered when running batch file - was unexpected at this time

I have encountered an error when running a batch file. It goes like this, I run test-setup.cmd which calls another batch file test-env.cmd
test-setup.cmd calls by using this line:
call %SCRIPT_HOME%\test-env.cmd
where SCRIPT_HOME is set up as SCRIPT_HOME=%~dp0
test-env.cmd has this line:
if [%TEST_HOME%] == [] set TEST_HOME=D:\Program Files\Test\test-02.2.3.Final
After running the test-setup.cmd a message appears like this:
Files\Test\test-02.2.3.Final was unexpected at this time
Note that I have setup the TEST_HOME in the system environment variables.
Please help, thank you.
The syntax of your if command is incorrect. It would work if %TEST_HOME% didn't contain any spaces, but since it does you must use double quotes:
if "%TEST_HOME%" == "" set TEST_HOME=D:\Program Files\Test\test-02.2.3.Final
Mind you, since you're just testing to see whether the variable exists, it would be a lot more efficient to do that directly:
if not defined TEST_HOME set TEST_HOME=D:\Program Files\Test\test-02.2.3.Final

How to debug `Error while processing function` in `vim` and `nvim`?

TL;DR
How to find where exactly vim or nvim error started (which file?) when I'm interested in fixing the actual issue and not just removing the bad plugin? Anything better than strace and guesswork to find the error origin?
Issue
I often add a plugin to my vim or nvim config and end up getting errors on hooks (buffer open, close, write):
"test.py" [New] 0L, 0C written
Error detected while processing function 343[12]..272:
line 8:
E716: Key not present in Dictionary: _exec
E116: Invalid arguments for function get(a:args, 'exec', a:1['_exec'])
E15: Invalid expression: get(a:args, 'exec', a:1['_exec'])
The problem is, I have no idea where those come from, only get some line number of unknown file and I know it's not my vim/nvim config file.
Somewhere, you have a plugin that has defined a dictionary with anonymous-functions (check the help related to this tag).
For the curious ones, it's done this way:
let d = {}
function! d.whatever() abort
throw "blah"
endfunction
When you execute this function, you'll get the kind of error you're currently observing. That's why I stopped working this way to prefer:
let d = {}
function s:whatever() abort
throw "blah"
endfunction
let d.whatever = function('s:whatever') " a workaround is required for older versions of vim
" At least this way I'll get a `<SNR>42_whatever` in the exception throwpoint, and thus a scriptname.
That's the why. Now, back to your problem, AFAIK, the only things you'll be able to know are the two functions that have been called:
in line 12 of :function {343}, you've called
:function {272} which contains an error at line 8.
Thanks to these two commands (may be prefixed with :verbose, I don't remember exactly), you'll get the source code of the two functions, which you should be able to use in order to grep your plugins to know where it appears.

Resources