{"action":"created","issue":{"url":"https://api.github.com/repos/alecthomas/gometalinter/issues/478","repository_url":"https://api.github.com/repos/alecthomas/gometalinter","labels_url":"https://api.github.com/repos/alecthomas/gometalinter/issues/478/labels{/name}","comments_url":"https://api.github.com/repos/alecthomas/gometalinter/issues/478/comments","events_url":"https://api.github.com/repos/alecthomas/gometalinter/issues/478/events","html_url":"https://github.com/alecthomas/gometalinter/issues/478","id":325999261,"node_id":"MDU6SXNzdWUzMjU5OTkyNjE=","number":478,"title":"gometalinter can't work on multi-GOPATH","user":{"login":"flw-cn","id":5546718,"node_id":"MDQ6VXNlcjU1NDY3MTg=","avatar_url":"https://avatars0.githubusercontent.com/u/5546718?v=4","gravatar_id":"","url":"https://api.github.com/users/flw-cn","html_url":"https://github.com/flw-cn","followers_url":"https://api.github.com/users/flw-cn/followers","following_url":"https://api.github.com/users/flw-cn/following{/other_user}","gists_url":"https://api.github.com/users/flw-cn/gists{/gist_id}","starred_url":"https://api.github.com/users/flw-cn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flw-cn/subscriptions","organizations_url":"https://api.github.com/users/flw-cn/orgs","repos_url":"https://api.github.com/users/flw-cn/repos","events_url":"https://api.github.com/users/flw-cn/events{/privacy}","received_events_url":"https://api.github.com/users/flw-cn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-24T07:37:57Z","updated_at":"2018-09-06T00:59:05Z","closed_at":null,"author_association":"NONE","body":"`gometalinter` can't work on multi-GOPATH.\r\n\r\nif my code is put in the second GOPATH, gometalinter will generate an error file path to call the linters. only a few linters(like `gotype` and `gotypex`) can work fine.\r\n\r\nI tried to troubleshoot about this and found it is due to a bug at [here](https://github.com/alecthomas/gometalinter/blob/master/partition.go#L148), but it looks not very easy to be fixed.  I hope somebody can fix it.\r\n\r\nFurthermore, it would be better if we could make it works outside of GOPATH too.  For example, for rapid greenfield prototyping of stuff via some sort of `vim-foo-then-go-run`-based workflow.\r\n\r\n```shell\r\n$ pwd\r\n/Users/flw/.go2/src/hello\r\n\r\n$ go env GOPATH\r\n/Users/flw/.go:/Users/flw/.go2\r\n\r\n$ go get -u github.com/alecthomas/gometalinter\r\n\r\n$ which gometalinter\r\n/Users/flw/.go/bin/gometalinter\r\n\r\n$ gometalinter --install\r\nInstalling:\r\n  deadcode\r\n  dupl\r\n  errcheck\r\n  gas\r\n  goconst\r\n  gocyclo\r\n  goimports\r\n  golint\r\n  gosimple\r\n  gotype\r\n  gotypex\r\n  ineffassign\r\n  interfacer\r\n  lll\r\n  maligned\r\n  megacheck\r\n  misspell\r\n  nakedret\r\n  safesql\r\n  staticcheck\r\n  structcheck\r\n  unconvert\r\n  unparam\r\n  unused\r\n  varcheck\r\n\r\n$ cat hello.go\r\npackage main\r\n\r\nimport \"fmt\"\r\n\r\nfunc main() {\r\n        foo = 1\r\n        fmt.Println(\"vim-go\")\r\n}\r\n\r\n$ gometalinter --disable-all --enable=vet `pwd`/hello.go\r\n\r\n$ go vet `pwd`/hello.go\r\n# command-line-arguments\r\n./hello.go:6:2: undefined: foo\r\n\r\n$ gometalinter --debug --disable-all --enable=vet `pwd`/hello.go\r\nDEBUG: [May 24 07:07:27.407] setenv PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/opt/go/libexec/bin:/Users/flw/.go/bin:/Users/flw/.go2/bin:/Users/flw/bin\"\r\nDEBUG: [May 24 07:07:27.427] setenv GOROOT=\"/usr/local/Cellar/go/1.10.2/libexec\"\r\nDEBUG: [May 24 07:07:27.428] Current environment:\r\nDEBUG: [May 24 07:07:27.428] PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/opt/go/libexec/bin:/Users/flw/.go/bin:/Users/flw/.go2/bin:/Users/flw/bin\"\r\nDEBUG: [May 24 07:07:27.428] GOPATH=\"/Users/flw/.go:/Users/flw/.go2\"\r\nDEBUG: [May 24 07:07:27.428] GOBIN=\"\"\r\nDEBUG: [May 24 07:07:27.428] GOROOT=\"/usr/local/Cellar/go/1.10.2/libexec\"\r\nDEBUG: [May 24 07:07:27.428] linting path /Users/flw/.go2/src/hello/hello.go\r\nDEBUG: [May 24 07:07:27.434] [vet.1]: executing /usr/local/bin/go vet ../../.go2/src/hello/hello.go\r\nDEBUG: [May 24 07:07:27.453] [vet.1]: warning: /usr/local/bin/go returned exit status 1: stat ../../.go2/src/hello/hello.go: no such file or directory\r\n\r\nDEBUG: [May 24 07:07:27.453] [vet.1]: vet hits 0: ^(?: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>.*))$\r\nDEBUG: [May 24 07:07:27.453] [vet.1]: vet linter took 19.434185ms\r\nDEBUG: [May 24 07:07:27.453] total elapsed time 25.43364ms\r\n\r\n$\r\n```"},"comment":{"url":"https://api.github.com/repos/alecthomas/gometalinter/issues/comments/418928686","html_url":"https://github.com/alecthomas/gometalinter/issues/478#issuecomment-418928686","issue_url":"https://api.github.com/repos/alecthomas/gometalinter/issues/478","id":418928686,"node_id":"MDEyOklzc3VlQ29tbWVudDQxODkyODY4Ng==","user":{"login":"alecthomas","id":41767,"node_id":"MDQ6VXNlcjQxNzY3","avatar_url":"https://avatars3.githubusercontent.com/u/41767?v=4","gravatar_id":"","url":"https://api.github.com/users/alecthomas","html_url":"https://github.com/alecthomas","followers_url":"https://api.github.com/users/alecthomas/followers","following_url":"https://api.github.com/users/alecthomas/following{/other_user}","gists_url":"https://api.github.com/users/alecthomas/gists{/gist_id}","starred_url":"https://api.github.com/users/alecthomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alecthomas/subscriptions","organizations_url":"https://api.github.com/users/alecthomas/orgs","repos_url":"https://api.github.com/users/alecthomas/repos","events_url":"https://api.github.com/users/alecthomas/events{/privacy}","received_events_url":"https://api.github.com/users/alecthomas/received_events","type":"User","site_admin":false},"created_at":"2018-09-06T00:59:05Z","updated_at":"2018-09-06T00:59:05Z","author_association":"OWNER","body":"gometalinter doesn't operate on files, only directories, so this won't work:\r\n\r\n    $ gometalinter --disable-all --enable=vet `pwd`/hello.go\r\n\r\nBut this should:\r\n\r\n   $ gometalinter --disable-all --enable=vet ./"}}
{"actor":{"display_login":"alecthomas"}}