GoClipse / goclipse

Eclipse IDE for the Go programming language:
http://goclipse.github.io/
Eclipse Public License 1.0
841 stars 290 forks source link

PATH doesn't seem to be propagated correctly #234

Closed mykelalvis closed 7 years ago

mykelalvis commented 7 years ago

On a clean installation of GoClipse 0.16.1.v201607061938 on OSX

Version: Neon.2 Release (4.6.2)
Build id: 20161208-0600

My project has a lint target which states the following when executed:

************  Building Go project: Hello  ************
  with GOPATH: /Users/malvis/go/src/github.com/mykelalvis/hello
>> Running: gometalinter -t ./...
  FAILED: Cannot run program "gometalinter" (in directory "/Users/malvis/go/src/github.com/mykelalvis/hello/src"): error=2, No such file or directory   Reason: Cannot run program "gometalinter" (in directory "/Users/malvis/go/src/github.com/mykelalvis/hello/src"): error=2, No such file or directory

I installed gometalinter (which does not appear to be detailed in the external tools install docs) (PR #233).

go get -u github.com/alecthomas/gometalinter

Running the lint target still results in Cannot run program

************  Building Go project: Hello  ************
  with GOPATH: /Users/malvis/go/src/github.com/mykelalvis/hello
>> Running: gometalinter -t ./...
  FAILED: Cannot run program "gometalinter" (in directory "/Users/malvis/go/src/github.com/mykelalvis/hello/src"): error=2, No such file or directory   Reason: Cannot run program "gometalinter" (in directory "/Users/malvis/go/src/github.com/mykelalvis/hello/src"): error=2, No such file or directory

When I change the lint target from gometalinter -t ./... to ${env_var:HOME}/go/bin/gometalinter -t ./... the following output is in the console

************  Building Go project: Hello  ************
  with GOPATH: /Users/malvis/go/src/github.com/mykelalvis/hello
>> Running: /Users/malvis/go/bin/gometalinter -t ./...
WARNING: exec: "errcheck": executable file not found in $PATH
WARNING: exec: "gosimple": executable file not found in $PATH
WARNING: exec: "staticcheck": executable file not found in $PATH
WARNING: exec: "unconvert": executable file not found in $PATH
WARNING: exec: "interfacer": executable file not found in $PATH
WARNING: exec: "varcheck": executable file not found in $PATH
WARNING: exec: "structcheck": executable file not found in $PATH
WARNING: exec: "aligncheck": executable file not found in $PATH
   ^^^ Terminated, exit code: 2 ^^^
************  Build terminated.  ************

Installing all the aforementioned linters:

gometalinter --install 

results in

************  Building Go project: Hello  ************
  with GOPATH: /Users/malvis/go/src/github.com/mykelalvis/hello
>> Running: /Users/malvis/go/bin/gometalinter -t ./...
   ^^^ Terminated, exit code: 0 ^^^
************  Build terminated.  ************

This appears to be some issue with the PATH of the executor of gometalinter.
This might be "as-expected", but it did not operate as I assumed it would.

bruno-medeiros commented 7 years ago

go get -u github.com/alecthomas/gometalinter

This merely installs gometalinter in $GOPATH/bin (assuming $GOPATH has only one directory), it doesn't add it to the PATH automatically by itself.

with GOPATH: /Users/malvis/go/src/github.com/mykelalvis/hello

BTW, this seems wrong, it looks like you have a Go workspace inside another Go workspace? It looks like GOPATH should be set to /Users/malvis/go