Closed ottob closed 8 years ago
In the console I get:
sublimelinter: using default GOPATH
SublimeLinter: chdir not set or invalid, using /Users/ottob/go/src/bitbucket.org/evard/evard/CLINIC/mq
SublimeLinter: gometalinter output:
output lines from from golint and vetshadow...
Are you starting Sublime from a terminal? If not, Sublime may not have the correct environment variables set. Try that.
Also try adding --debug
to the "args", and enable SublimeLinter debugging from the command palette. That might show something useful in the console (Ctrl+`
on OSX).
I have tried to launch it from terminal, no difference.
And nothing helpful with --debug
and SublimeLinter debugging enabled either, I was already running with that.
sublimelinter: using default GOPATH
Is there any way for me to check from the Sublime console what the env GOPATH variable is set to?
Could it be that vet output is filtered somehow since it returns errors? vetshadow and golint both return warnings it seems.
Try updating the package, I had some local debugging changes that printed the GOPATH. vet output should not be filtered, it's more likely that it is failing to run for some reason.
The system GOPATH looks correct:
sublimelinter: using system GOPATH=/Users/ottob/go
SublimeLinter: chdir not set or invalid, using /Users/ottob/go/src/myrepo.xyz/mq
SublimeLinter: gometalinter output:
journalevent.go:24:6:warning: exported type SendJournalEventJob should have comment or be unexported (golint)
journalevent.go:182::warning: declaration of err shadows declaration at journalevent.go:165: (vetshadow)
Isn't it strange that I get output from vetshadow and not vet? They run the same tool, no?
Yes, that is quite odd... is it possible you have two versions of gometalinter installed?
Nope, only one gometalinter. And I just did a go get -u
so its up to date.
My entire SublimeLinter config:
{
"user": {
"debug": true,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "manual",
"linters": {
"gometalinter": {
"@disable": false,
"args": "--vendor --disable-all -E vetshadow -E vet -E golint --debug",
"excludes": []
},
"jscs": {
"@disable": false,
"args": [
"--config=~/go/src/myrepo.xyz/FE/.jscsrc"
],
"excludes": []
},
"jshint": {
"@disable": false,
"args": [
"--config=~/go/src/myrepo.xyz/FE/.jshintrc"
],
"excludes": []
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"passive_warnings": false,
"paths": {
"linux": [],
"osx": [],
"windows": []
},
"python_paths": {
"linux": [],
"osx": [],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"php": "html",
"python django": "python"
},
"warning_color": "DDB700",
"wrap_find": true
}
}
I'm not sure what else it could be, unfortunately :\
Is there any way to get more output from gometalinter? I see no difference in the console output in Sublime if I pass --debug
. And I tried to set the args to "--vendor --disable-all -E vetshadow -E vet -E golint --debug 2>&1 | /usr/bin/tee /tmp/gometalinter.log"
but that doesn't seem to work either.
Yeah, that would be nice but I couldn't figure out how to do it either.
I think SublimeLinter itself must be swallowing lines that don't match :\
ok, Ill try to dig into SublimeLinter :smile:
Any luck?
It has something to do with vendoring. Im running go1.6 with most of my code vendored (using https://github.com/FiloSottile/gvt).
I instrumented gometalinter so the output from the linters are logged. And when I run gometalinter from terminal I get output like:
DEBUG: vet linter output email.go:56: OUR.REPO/vendor/github.com/mattbaird/gochimp.Var composite literal uses unkeyed fields
journalevent.go:143: OUR.REPO/vendor/github.com/stvp/rollbar.Field composite literal uses unkeyed fields
mq.go:65: github.com/kr/beanstalk.Tube composite literal uses unkeyed fields
And when I run it from Sublime:
DEBUG: vet linter output mq.go:65: github.com/kr/beanstalk.Tube composite literal uses unkeyed fields
github.com/kr/beanstalk is the only package that I have installed without vendoring. If I remove it from $GOPATH/src/github.com/kr/beanstalk
and $GOPATH/pkg/darwin_amd64/github.com/kr/beanstalk
I get no output at all from go vet when run from Sublime.
Then I added a linter that just printed my env. And both from terminal and Sublime GO15VENDOREXPERIMENT=1
is set. When I ran it from Sublime the PWD
env var was not set. So I added os.Setenv("PWD", "SAME_PWD_AS_WHEN_I_RUN_FROM_TERMINAL")
to executeLinter() and verified that the linters got this variable. But still no changes :(
I have put up a minimal reproducible repo here: https://github.com/ottob/gometavendor
Try to run gometalinter on main.go from Terminal and from within Sublime and see if you get the same output with go1.6.
Any clues?
I'll give it a try, thanks for finding a test case. Nothing springs to mind unfortunately :(
I suspect this pull request might coincidentally solve your problem. Give it a try.
It did! And created another one :smile:
WARNING: exec: "go": executable file not found in $PATH
WARNING: exec: "go": executable file not found in $PATH
WARNING: exec: "golint": executable file not found in $PATH
But perhaps there is a way to pass the PATH from Sublime into subprocess.Popen?
It works if I open Sublime from the terminal.
That's well documented in the SublimeLinter docs.
Yes, but the path reported by SublimeLinter as SublimeLinter: computed PATH
is correct. But that is not passed to gometalinter when you run subprocess.check_output.
You mean in the that PR? Ah, ok.
Yes. Perhaps we should keep the discussion there.
Running from terminal:
gometalinter --vendor --disable-all -E vet -E vetshadow -E golint
I get output including vet:journalevent.go:143::error: blaha/vendor/github.com/stvp/rollbar.Field composite literal uses unkeyed fields (vet)
But when I run SublimeLinter with this setting:Then I only get output from the vetshadow and golint linters:
Nothing from the vet linter. Any idea why?