Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g:go_metalinter_command does not override the command. #1622

Closed
kyoh86 opened this issue Dec 19, 2017 · 6 comments
Closed

g:go_metalinter_command does not override the command. #1622

kyoh86 opened this issue Dec 19, 2017 · 6 comments
Assignees

Comments

@kyoh86
Copy link

kyoh86 commented Dec 19, 2017

What did you do? (required. The issue will be closed when not provided.)

Wrote let g:go_metalinter_command = "gometalinter --config=" . $HOME . "/.gometalinter/config.json"

What did you expect to happen?

gometalinter called with an argument, --config=$HOME/.gometalinter/config.json

What happened instead?

gometalinter called with arguments, --disable-all gometalinter --config=$HOME/.gometalinter/config.json

Configuration (MUST fill this out):

  • Vim version (first two lines from :version):
:version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Dec 17 2017 21:40:26)
macOS version
適用済パッチ: 1-1350
Compiled by Homebrew
Huge 版 without GUI.  機能の一覧 有効(+)/無効(-)
+acl               +cryptv            -footer            +mksession         +path_extra        +syntax            +viminfo
+arabic            +cscope            +fork()            +modify_fname      +perl              +tag_binary        +vreplace
+autocmd           +cursorbind        +gettext           +mouse             +persistent_undo   +tag_old_static    +wildignore
-autoservername    +cursorshape       -hangul_input      -mouseshape        +postscript        -tag_any_white     +wildmenu
-balloon_eval      +dialog_con        +iconv             +mouse_dec         +printer           +tcl               +windows
+balloon_eval_term +diff              +insert_expand     -mouse_gpm         +profile           +termguicolors     +writebackup
-browse            +digraphs          +job               -mouse_jsbterm     -python            +terminal          -X11
++builtin_terms    -dnd               +jumplist          +mouse_netterm     +python3           +terminfo          -xfontset
+byte_offset       -ebcdic            +keymap            +mouse_sgr         +quickfix          +termresponse      -xim
+channel           +emacs_tags        +lambda            -mouse_sysmouse    +reltime           +textobjects       -xpm
+cindent           +eval              +langmap           +mouse_urxvt       +rightleft         +timers            -xsmp
-clientserver      +ex_extra          +libcall           +mouse_xterm       +ruby              +title             -xterm_clipboard
+clipboard         +extra_search      +linebreak         +multi_byte        +scrollbind        -toolbar           -xterm_save
+cmdline_compl     +farsi             +lispindent        +multi_lang        +signs             +user_commands
+cmdline_hist      +file_in_path      +listcmds          -mzscheme          +smartindent       +vertsplit
+cmdline_info      +find_in_path      +localmap          +netbeans_intg     +startuptime       +virtualedit
+comments          +float             +lua               +num64             +statusline        +visual
+conceal           +folding           +menu              +packages          -sun_workshop      +visualextra
      システム vimrc: "$VIM/vimrc"
      ユーザー vimrc: "$HOME/.vimrc"
   第2ユーザー vimrc: "~/.vim/vimrc"
       ユーザー exrc: "$HOME/.exrc"
  デフォルトファイル: "$VIMRUNTIME/defaults.vim"
       省略時の $VIM: "/usr/local/share/vim"
コンパイル: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
リンク: clang   -L. -L/Users/yamada/.rbenv/versions/2.4.2/lib  -fstack-protector -L/usr/local/lib  -L/usr/local/lib -o vim        -lm  -
lncurses -liconv -lintl -framework AppKit  -L/usr/local/lib -llua -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2le
vel/CORE -lperl  -L/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin -lpython3.6m -framew
ork CoreFoundation -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -lruby-static -framework CoreFoundation -lgmp -
lobjc -L/Users/yamada/.rbenv/versions/2.4.2/lib
  • Go version (go version):
go version go1.9.2 darwin/amd64
  • Go environment (go env):
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/yamada/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.9.2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.9.2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/1z/271lqzy54m51c2y_bjt5n4h00000gn/T/go-build120480347=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
  • vim-go version:

commit: f4b4ba13f95883cbb4f7c43b871a480932614e0f

  • vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):
let g:go_metalinter_command = "gometalinter --config=" . $HOME . "/.gometalinter/config.json"
@wmatusiak
Copy link
Contributor

I can duplicate this.

As far as i see in code g:go_metalinter_deadline is used like g:go_metalinter_aditional_args.
Change this to @kyoh86 expected behavior is easy but will not work with autosave nicly.

For me bether solution is to change this to go:go_metalinter_aditional_args. Additionaly autosave should use it.

@kyoh86
Copy link
Author

kyoh86 commented Dec 31, 2017

I don't stick to replacing a command.
g:go_metalinter_aditional_args is better, I think so.

For your reference, ALE has some options for gometalinter like below.

let g:ale_go_gometalinter_options = "--config=" . $HOME . "/.gometalinter/config.json"
let g:ale_go_gometalinter_executable = 'gometalinter'

@kyoh86
Copy link
Author

kyoh86 commented Jan 8, 2018

I saw the function go#lint#Gometa, but it's ... confused...

  • goargs is not used anywhere.
  • ["--disable-all"] is pushed for args constantly.
  • Some variables named autosave but they seem to be on_save.
  • [--include='^%:p.*$'] is pushed for args only if the async mode is disabled.
  • On save, go_metalinter_command is never used.

It needs to be refactored.

@bhcleek
Copy link
Collaborator

bhcleek commented Jan 9, 2018

@kyoh86 some of the issues you noticed are resolved in #1640.

For the others:

  • --disable-all is used so that only the enabled linters will apply.
  • autosave is the name of the function argument that indicates whether the function has been called because running gometalinter on save is turned on.
  • the additional arguments to pass to gometalinter from g:go_metalinter_command is applied in all cases except for when running gometalinter automatically on save: https://github.com/fatih/vim-go/blob/master/autoload/go/lint.vim#L62

@kyoh86
Copy link
Author

kyoh86 commented Jan 9, 2018

except for when running gometalinter automatically on save

i know...but why is the case excepted?

@bhcleek
Copy link
Collaborator

bhcleek commented Jan 9, 2018

It's not clear to me if that was an intentional decision or not. The docs, though, say that g:go_metalinter_command only applies when :GoMetaLinter is called. I plan to revisit whether it should always apply soon.

@bhcleek bhcleek self-assigned this Jan 16, 2018
hori-ryota added a commit to hori-ryota/vim-go that referenced this issue Dec 21, 2018
bhcleek added a commit that referenced this issue Dec 29, 2018
…inter-command

Fix overriding metalinter command (fix #1622)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants