fatih / vim-go

Go development plugin for Vim
https://www.patreon.com/bhcleek
Other
15.9k stars 1.45k forks source link

Development: `make lint` always fails using GNU grep 3.8 or later #3635

Closed matthewhughes934 closed 1 month ago

matthewhughes934 commented 5 months ago

Output of make lint

$ make lint
==> Running linting tools
Running vint ... SKIPPED
'vint' binary not found; use 'pip install vim-vint' to install it.
Running vim-vimlint ... FAILED
egrep: warning: egrep is obsolescent; using grep -E

Running vimhelplint ... PASSED
make: *** [Makefile:21: lint] Error 6

This failure is because the Running vim-vimlint step is marked as failed when any output is captured https://github.com/fatih/vim-go/blob/ca6c532753e70e4fb093e755773cc6f250a3b4b3/scripts/lint#L58

But vim-vimlint uses egrep when run https://github.com/syngan/vim-vimlint/blob/cec40c28f119a5f4b92ceb0b6aae525122a81244/bin/vimlint.sh#L106 since GNU grep 3.8 egrep is deprecated and emits a warning https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00001.html which is then captured, resulting in failure.

Since https://github.com/syngan/vim-vimlint has not been updated in 6 years I don't imagine we can patch there. Maybe the lint script could check the exit code of vimlin-lint instead?

bhcleek commented 5 months ago

Yes, I agree that it looks like we could shift to checking the exit code to be sure that it's 2. I also think it's worth submitting a PR to vim-vimlint to use grep -E instead of egrep in an attempt to avoid a more complete future breakage.

matthewhughes934 commented 5 months ago

I also think it's worth submitting a PR to vim-vimlint to use grep -E instead of egrep in an attempt to avoid a more complete future breakage.

:+1: https://github.com/syngan/vim-vimlint/pull/124 though I'm not too optimistic about it being reviewed/merged any time soon :sweat_smile:

bhcleek commented 3 months ago

I'm having a hard time duplicating this.

vim-go@bc579251da29:~$ make lint
==> Running linting tools
Running vint ... PASSED
Running vim-vimlint ... PASSED
Running vimhelplint ... PASSED
vim-go@bc579251da29:~$ grep --version
grep (GNU grep) 3.8
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others; see
<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
vim-go@bc579251da29:~$ egrep --version
grep (GNU grep) 3.8
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and others; see
<https://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
vim-go@bc579251da29:~$
matthewhughes934 commented 3 months ago

I'm having a hard time duplicating this.

Is your version of grep packaged by Debian/are you running on a Debian based distro? It looks like they have a patch to suppress that warning

Equivalently: does egrep --version emit a warning for you? For reference, I'm running on Arch:

$ docker run archlinux:latest egrep --version >/dev/null
egrep: warning: egrep is obsolescent; using grep -E
$ docker run debian:latest egrep --version >/dev/null
bhcleek commented 3 months ago

Ah, yup, that would do it. Thank you 🙇 .