-
Notifications
You must be signed in to change notification settings - Fork 267
Conversation
This patch fixes the issue described at alecthomas#91 and implements the workaround described by alecthomas#91 (comment). Essentially `go test -i PKG_PATH` is executed against any path prior to `gotype` being executed against that same path when the `gometalinter` flag `-tests` is used. This ensures that the test dependencies are installed as go packages, enabling `gotype` to resolve the imports.
I appreciate the PR, but there are some problems.
It's a good point though that there is basically no way to compile check a test without either a) using gotype after installing all deps, or b) running the test. This is definitely not ideal. |
Hi @alecthomas, Thank you for the response. Regarding your comments; all valid. Some feedback though:
|
Hi @alecthomas, Let me be the first to admit that I'm definitely approaching this issue from the context of using |
Hmmm, so perhaps I just answered my own question. Perhaps the fix should be with Atom's |
What I was referring to here was that instead of special-casing gotype, change gometalinter so that it supports running multiple commands in sequence when linting. Then |
I'm honestly not sure. I think there are some fairly fundamental problems with the way go/types works when it comes to linters.
A lot of people seem to use gometalinter in CI, so I'm guessing they must |
Hi @alecthomas, I would absolutely use the suggested approach to CI, but it's an issue of |
Honestly, I think you provided the correct resolution path by virtue of your statement:
True, you said package as well, but in the second point you once again highlighted source code:
From these statements one could draw the conclusion that |
This patch fixes issue #91 and and implements this workaround.
Essentially
go test -i PKG_PATH
is executed against any path prior togotype
being executed against that same path when thegometalinter
flag-tests
is used. This ensures that the test dependencies are installed as go packages, enablinggotype
to resolve the imports.To verify the patch I executed the following steps:
Remove Previous Packages
Execute
gometalinter
Note in the output below the debug statements:
DEBUG: executing 'go test -i api/utils/schema'
DEBUG: executing 'go test -i .'
The fact that the linter executed successfully proves that the patch works as without this patch the
gotype
linter would have failed with an error regarding imports in the test sources.