alecthomas / gometalinter

DEPRECATED: Use https://github.com/golangci/golangci-lint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not reporting results from linters to VSCode

kmccmk9 opened this issue · comments

Hello, I have been struggling to get gometalinter running my supported and custom set of linters. I have run gometalinter in debug mode and have verified it does read my config file and it runs through all the linters in the "Enable" field. However, all of the errors and warnings are not being reported back to VSCode even though the output returns warnings and errors. The only "Problem" reported in VSCode is from Go itself. From previous attempts I know it should return either 37 or 38 depending on how it feels.

Error while running tool: C:\Users\kylec\go\bin\gometalinter.exe --config=.gometalinter.json --debug . --aggregate
DEBUG: [Jan 12 01:32:47.165] setenv PATH="C:\\Python27\\;C:\\Python27\\Scripts;C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\wbin;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Go\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\OpenSSH-Win64;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\nodejs\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\OpenSSH-Win32;C:\\Program Files (x86)\\Gpg4win\\..\\GnuPG\\bin;C:\\Ruby25-x64\\bin;C:\\Users\\kylec\\AppData\\Local\\Programs\\Python\\Python36-32\\Scripts\\;C:\\Users\\kylec\\AppData\\Local\\Programs\\Python\\Python36-32\\;C:\\Users\\kylec\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\kylec\\AppData\\Local\\Programs\\Fiddler;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Flutter\\bin;C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE;C:\\utils;C:\\Program Files (x86)\\Android\\android-sdk\\platform-tools;C:\\Users\\kylec\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files (x86)\\Inno Setup 5;C:\\Users\\kylec\\AppData\\Roaming\\npm;C:\\Users\\kylec\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\kylec\\go\\bin;C:\\Program Files\\MongoDB\\Server\\4.0\\bin;C:\\Users\\kylec\\AppData\\Local\\hyper\\app-2.1.0\\resources\\bin;C:\\Go\\bin"
DEBUG: [Jan 12 01:32:47.165] setenv GOROOT="C:\\Go\\"
DEBUG: [Jan 12 01:32:47.165] Current environment:
DEBUG: [Jan 12 01:32:47.165] PATH="C:\\Python27\\;C:\\Python27\\Scripts;C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\wbin;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Go\\bin;C:\\Program Files\\PuTTY\\;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\OpenSSH-Win64;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\nodejs\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\OpenSSH-Win32;C:\\Program Files (x86)\\Gpg4win\\..\\GnuPG\\bin;C:\\Ruby25-x64\\bin;C:\\Users\\kylec\\AppData\\Local\\Programs\\Python\\Python36-32\\Scripts\\;C:\\Users\\kylec\\AppData\\Local\\Programs\\Python\\Python36-32\\;C:\\Users\\kylec\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\kylec\\AppData\\Local\\Programs\\Fiddler;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Flutter\\bin;C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\IDE;C:\\utils;C:\\Program Files (x86)\\Android\\android-sdk\\platform-tools;C:\\Users\\kylec\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files (x86)\\Inno Setup 5;C:\\Users\\kylec\\AppData\\Roaming\\npm;C:\\Users\\kylec\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\kylec\\go\\bin;C:\\Program Files\\MongoDB\\Server\\4.0\\bin;C:\\Users\\kylec\\AppData\\Local\\hyper\\app-2.1.0\\resources\\bin;C:\\Go\\bin"
DEBUG: [Jan 12 01:32:47.165] GOPATH="C:\\Users\\kylec\\go"
DEBUG: [Jan 12 01:32:47.165] GOBIN=""
DEBUG: [Jan 12 01:32:47.166] GOROOT="C:\\Go\\"
DEBUG: [Jan 12 01:32:47.166] linting path .
DEBUG: [Jan 12 01:32:47.213] [nakedret.1]: executing C:\Users\kylec\go\bin\nakedret.exe .
DEBUG: [Jan 12 01:32:47.250] [nakedret.1]: nakedret hits 0: ^(?P<path>.*?\.go):(?P<line>\d+)\s*(?P<message>.*)$
DEBUG: [Jan 12 01:32:47.250] [nakedret.1]: nakedret linter took 36.8997ms
DEBUG: [Jan 12 01:32:47.257] [staticcheck.2]: executing C:\Users\kylec\go\bin\staticcheck.exe .
DEBUG: [Jan 12 01:32:47.290] [deadcode.3]: executing C:\Users\kylec\go\bin\deadcode.exe .
DEBUG: [Jan 12 01:32:47.309] [deadcode.3]: warning: C:\Users\kylec\go\bin\deadcode.exe returned exit status 2: deadcode: Models.go:3:1: Order is unused
deadcode: Models.go:12:1: ShelfModel is unused

DEBUG: [Jan 12 01:32:47.309] [deadcode.3]: deadcode hits 2: ^deadcode: (?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*)$
DEBUG: [Jan 12 01:32:47.310] nolint: parsing Models.go for directives
DEBUG: [Jan 12 01:32:47.311] [deadcode.3]: deadcode linter took 20.9562ms
DEBUG: [Jan 12 01:32:47.311] nolint: parsing Models.go took 1.0094ms
DEBUG: [Jan 12 01:32:47.322] [gochecknoinits.4]: executing C:\Users\kylec\go\bin\gochecknoinits.exe .
DEBUG: [Jan 12 01:32:47.346] [gochecknoinits.4]: gochecknoinits hits 0: ^(?P<path>.*?\.go):(?P<line>\d+) (?P<message>.*)
DEBUG: [Jan 12 01:32:47.346] [gochecknoinits.4]: gochecknoinits linter took 23.936ms
DEBUG: [Jan 12 01:32:47.354] [goconst.5]: executing C:\Users\kylec\go\bin\goconst.exe -min-occurrences 3 -min-length 3 .
DEBUG: [Jan 12 01:32:47.362] [gofmt.6]: executing C:\Go\bin\gofmt.exe -l -s AuthUser.go MessageHandler.go Models.go OrderHandler.go ShelfHandler.go UsersHandler.go main.go
DEBUG: [Jan 12 01:32:47.376] [goconst.5]: goconst hits 0: ^(?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*)$
DEBUG: [Jan 12 01:32:47.377] [goconst.5]: goconst linter took 23.9448ms
DEBUG: [Jan 12 01:32:47.387] [gofmt.6]: gofmt hits 7: ^(?P<path>.*?\.go)$
DEBUG: [Jan 12 01:32:47.388] nolint: parsing AuthUser.go for directives
DEBUG: [Jan 12 01:32:47.388] nolint: parsing AuthUser.go took 0s
DEBUG: [Jan 12 01:32:47.388] nolint: parsing MessageHandler.go for directives
DEBUG: [Jan 12 01:32:47.388] nolint: parsing MessageHandler.go took 0s
DEBUG: [Jan 12 01:32:47.389] nolint: parsing OrderHandler.go for directives
DEBUG: [Jan 12 01:32:47.390] nolint: parsing OrderHandler.go took 993.3µs
DEBUG: [Jan 12 01:32:47.390] nolint: parsing ShelfHandler.go for directives
DEBUG: [Jan 12 01:32:47.392] nolint: parsing ShelfHandler.go took 1.9893ms
DEBUG: [Jan 12 01:32:47.392] nolint: parsing UsersHandler.go for directives
DEBUG: [Jan 12 01:32:47.393] [gofmt.6]: gofmt linter took 30.9217ms
DEBUG: [Jan 12 01:32:47.394] nolint: parsing UsersHandler.go took 1.9919ms
DEBUG: [Jan 12 01:32:47.394] nolint: parsing main.go for directives
DEBUG: [Jan 12 01:32:47.395] nolint: parsing main.go took 997.3µs
DEBUG: [Jan 12 01:32:47.402] [golint.7]: executing C:\Users\kylec\go\bin\golint.exe -min_confidence 0.800000 .
DEBUG: [Jan 12 01:32:47.433] [gotypex.8]: executing C:\Users\kylec\go\bin\gotype.exe -e -x .
DEBUG: [Jan 12 01:32:47.441] [vetshadow.9]: executing C:\Go\bin\go.exe vet --shadow .
DEBUG: [Jan 12 01:32:47.458] [gotypex.8]: gotypex hits 0: ^(?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*)$
DEBUG: [Jan 12 01:32:47.458] [gotypex.8]: gotypex linter took 24.9276ms
DEBUG: [Jan 12 01:32:47.472] [gocyclo.10]: executing C:\Users\kylec\go\bin\gocyclo.exe -over 10 .
DEBUG: [Jan 12 01:32:47.496] [gocyclo.10]: gocyclo hits 0: ^(?P<cyclo>\d+)\s+\S+\s(?P<function>\S+)\s+(?P<path>.*?\.go):(?P<line>\d+):(\d+)$
DEBUG: [Jan 12 01:32:47.496] [gocyclo.10]: gocyclo linter took 23.9353ms
DEBUG: [Jan 12 01:32:47.502] [gotype.11]: executing C:\Users\kylec\go\bin\gotype.exe -e .
DEBUG: [Jan 12 01:32:47.531] [ineffassign.12]: executing C:\Users\kylec\go\bin\ineffassign.exe -n .
DEBUG: [Jan 12 01:32:47.533] [golint.7]: golint hits 20: ^(?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*)$
DEBUG: [Jan 12 01:32:47.537] [golint.7]: golint linter took 134.6384ms
DEBUG: [Jan 12 01:32:47.559] [ineffassign.12]: ineffassign hits 0: ^(?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*)$
DEBUG: [Jan 12 01:32:47.559] [ineffassign.12]: ineffassign linter took 27.9259ms
DEBUG: [Jan 12 01:32:47.563] [interfacer.13]: executing C:\Users\kylec\go\bin\interfacer.exe .
DEBUG: [Jan 12 01:32:47.594] [gochecknoglobals.14]: executing C:\Users\kylec\go\bin\gochecknoglobals.exe .
DEBUG: [Jan 12 01:32:47.617] [gochecknoglobals.14]: gochecknoglobals hits 0: ^(?P<path>.*?\.go):(?P<line>\d+) (?P<message>.*)
DEBUG: [Jan 12 01:32:47.617] [gochecknoglobals.14]: gochecknoglobals linter took 22.9389ms
DEBUG: [Jan 12 01:32:47.627] [gosec.15]: executing C:\Users\kylec\go\bin\gosec.exe -fmt=csv .
DEBUG: [Jan 12 01:32:47.663] [go-namecheck.16]: executing C:\Users\kylec\go\bin\go-namecheck.exe -rules .gonamecheck.json . .
DEBUG: [Jan 12 01:32:47.697] [goimports.17]: executing C:\Users\kylec\go\bin\goimports.exe -l AuthUser.go MessageHandler.go Models.go OrderHandler.go ShelfHandler.go UsersHandler.go main.go
DEBUG: [Jan 12 01:32:47.733] [goimports.17]: goimports hits 7: ^(?P<path>.*?\.go)$
DEBUG: [Jan 12 01:32:47.737] [goimports.17]: goimports linter took 40.8911ms
DEBUG: [Jan 12 01:32:47.737] [maligned.18]: executing C:\Users\kylec\go\bin\maligned.exe .
DEBUG: [Jan 12 01:32:47.748] [vet.19]: executing C:\Go\bin\go.exe vet .
DEBUG: [Jan 12 01:32:48.842] [vetshadow.9]: warning: C:\Go\bin\go.exe returned exit status 2: # _/D_/GitLab/shelf
.\main.go:48:6: reFoo declared and not used

DEBUG: [Jan 12 01:32:48.842] [vetshadow.9]: vetshadow hits 1: ^(?:vet:.*?\.go:\s+(?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*))|((?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*))|(?:(?P<path>.*?\.go):(?P<line>\d+):\s*(?P<message>.*))$
DEBUG: [Jan 12 01:32:48.843] [vetshadow.9]: vetshadow linter took 1.4012537s
DEBUG: [Jan 12 01:32:49.225] [vet.19]: warning: C:\Go\bin\go.exe returned exit status 2: # _/D_/GitLab/shelf
.\main.go:48:6: reFoo declared and not used

DEBUG: [Jan 12 01:32:49.225] [vet.19]: vet hits 1: ^(?:vet:.*?\.go:\s+(?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*))|((?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*))|(?:(?P<path>.*?\.go):(?P<line>\d+):\s*(?P<message>.*))$
DEBUG: [Jan 12 01:32:49.225] [vet.19]: vet linter took 1.4760519s
DEBUG: [Jan 12 01:32:52.436] [go-namecheck.16]: go-namecheck hits 1: (?P<path>.*\.go)\:(?P<line>[0-9]*)\:(?P<col>[0-9]*)\:(?P<message>.*)
DEBUG: [Jan 12 01:32:52.436] [go-namecheck.16]: go-namecheck linter took 4.7732366s
DEBUG: [Jan 12 01:32:53.515] [staticcheck.2]: warning: C:\Users\kylec\go\bin\staticcheck.exe returned exit status 1: main.go:48:6: reFoo declared but not used (compile)

DEBUG: [Jan 12 01:32:53.515] [staticcheck.2]: staticcheck hits 1: ^(?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*)$
DEBUG: [Jan 12 01:32:53.515] [staticcheck.2]: staticcheck linter took 6.2582657s
DEBUG: [Jan 12 01:32:53.537] [gotype.11]: warning: C:\Users\kylec\go\bin\gotype.exe returned exit status 2: main.go:48:6: reFoo declared but not used

DEBUG: [Jan 12 01:32:53.537] [gotype.11]: gotype hits 1: ^(?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*)$
DEBUG: [Jan 12 01:32:53.537] [gotype.11]: gotype linter took 6.0348619s
DEBUG: [Jan 12 01:32:55.342] [maligned.18]: warning: C:\Users\kylec\go\bin\maligned.exe returned exit status 1: D:\GitLab\shelf\main.go:48:6: reFoo declared but not used
2019/01/11 20:32:55 couldn't load packages due to errors: .

DEBUG: [Jan 12 01:32:55.342] [maligned.18]: maligned hits 1: ^(?:[^:]+: )?(?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.+)$
DEBUG: [Jan 12 01:32:55.342] [maligned.18]: maligned linter took 7.6046668s
DEBUG: [Jan 12 01:32:56.806] [interfacer.13]: interfacer hits 1: ^(?P<path>.*?\.go):(?P<line>\d+):(?P<col>\d+):\s*(?P<message>.*)$
DEBUG: [Jan 12 01:32:56.806] [interfacer.13]: interfacer linter took 9.2432827s
DEBUG: [Jan 12 01:33:12.392] [gosec.15]: warning: C:\Users\kylec\go\bin\gosec.exe returned exit status 1: [gosec] 2019/01/11 20:32:47 including rules: default
[gosec] 2019/01/11 20:32:47 excluding rules: default
2019/01/11 20:33:12 . is not within the $GOPATH and cannot be processed

DEBUG: [Jan 12 01:33:12.392] [gosec.15]: gosec hits 0: ^(?P<path>.*?\.go),(?P<line>\d+)(-\d+)?,(?P<message>[^,]+,[^,]+,[^,]+)
DEBUG: [Jan 12 01:33:12.392] [gosec.15]: gosec linter took 24.7653497s

If gometalinter is running correctly, but vscode is not picking up the errors, then surely the problem lies with vscode?

If gometalinter is running correctly, but vscode is not picking up the errors, then surely the problem lies with vscode?

Hi, it is fair to work that as a possible source. I just wasn't sure if it was gometalinter not reporting it in such a fashion that vscode doesn't know how to interpret it. It also seems as though I'm in this weird state as gometalinter definitely runs from VSCode and sometimes it reports back and sometimes it doesn't. Again I'm not sure where the problem is. I also wasn't sure if this was a simple configuration issue. I was making this issue to bring awareness and see if others may be having a similar issue with inconsistencies. If you are pretty certain that it isn't the way the results are being reported back to VSCode I can surely explore other solutions, such as StackOverflow if it truly is configuration or even raising the issue with the VSCode community to see if it is a problem on their end.

UPDATE: Removing --debug allowed the results into VSCode. However, the custom linters are still not being reported back

If gometalinter is running correctly, but vscode is not picking up the errors, then surely the problem lies with vscode?

Ok I think I may have figured something out as I've been researching. Examing the following lines of output from go-metalinter. The main difference between the two lines from the custom linters and the built in linters is an extra spac in the front of the message. It makes me wonder if this is why the custom linters are not detected and reported in VSCode. Is this a regex issue or could metalinter possibly be adding an extra white character?


UsersHandler.go:28:1:warning: exported function DeleteAccount should have comment or be unexported (golint)
main.go:48:6:warning:  reFoo regexp.Regexp: use RE suffix instead of re prefix (go-namecheck)
main.go:48:6:warning:  reFoo declared but not used (go-consistent)
main.go:48:6:error: reFoo declared but not used (gotype)