Closed xanderflood closed 5 years ago
Note: literally seconds after posting this, I realized that I can do this instead:
golang.GoVet("-vettool=/Users/newuser/go/bin/shadow"),
and it works perfectly. Still curious if this is the best way or if I was just missing something with the other approach.
Assuming you mean golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
: I think you need to pass the package path. When I run it via the usercmd palette (ctrl+.,ctrl+c and type shadow
) it prints a help
message.
This works for me:
&golang.Linter{Name: "shadow", Args: []string{"."}, Label: "Go/Shadow"},
That works perfectly, thanks! And I didn't know about the command pallette, so that's a big help as well.
I'm having an issue setting up shadow detection. I've installed the
shadow
tool locally, and can use it from the command line to see that I have a shadowed variable in the file I'm currently looking at. It produces output like other go linters:/path/to/file.go:52:8: declaration of "err" shadows declaration at line 49
I added this line to my
margo.go
file:&golang.Linter{Name: "shadow", Label: "Go/Shadow"},
When I save, I see margo restarting in the logs. When I save my other file, though, nothing happens. There's no red underlining and the new message doesn't appear in the "GoSublime: Show Issues" view. If I change
shadow
tohadow
, an error message appears in the logs each time I save, but when it's spelled correctly, nothing appears, which I took to mean that GoSublime is successfully finding and starting theshadow
executable.Is
golang.Linter
the correct reducer to use here? Is there additional work that needs to be done to make sure that the messages fromshadow
are funneled into the "Show Issues" view? Thanks for your help!