joefitzgerald / go-plus

An Enhanced Go Experience For The Atom Editor
https://atom.io/packages/go-plus
Other
1.51k stars 128 forks source link

Format Tool Missing #41

Closed quamen closed 10 years ago

quamen commented 10 years ago

Hi,

I was wondering how to resolve an issue where go-plus isn't picking up the gofmt tool. It's definitely installed and available on my system.

☁  teamstats [update-readme] which gofmt
/usr/local/go/bin/gofmt

Any ideas?

joefitzgerald commented 10 years ago

Can you go to the Packages > Go Plus menu and select Display Go Information, then copy the output from the message panel and paste it here?

On my laptop, this is:

Using Go: go1.3 darwin/amd64 (@/usr/local/bin/go)
GOPATH: /Users/jfitzgerald/go
Cover Tool: /usr/local/Cellar/go/1.3/libexec/pkg/tool/darwin_amd64/cover
Vet Tool: /usr/local/Cellar/go/1.3/libexec/pkg/tool/darwin_amd64/vet
Format Tool: /Users/jfitzgerald/go/bin/goimports
Lint Tool: /Users/jfitzgerald/go/bin/golint
Oracle Tool: /Users/jfitzgerald/go/bin/oracle

Also can you confirm that you have launched atom from the command line (Atom > Install Shell Commands), instead of via Finder / Dock / Spotlight?

quamen commented 10 years ago

Also can you confirm that you have launched atom from the command line

Yes, I have launched from the command line.

Can you go to the Packages > Go Plus menu and select Display Go Information, then copy the output from the message panel and paste it here?

Using Go: go1.2 darwin/amd64 (@/usr/local/go/bin/go)
GOPATH: /Users/quamen/src/gocode
Cover Tool: /usr/local/go/pkg/tool/darwin_amd64/cover
Vet Tool: /usr/local/go/pkg/tool/darwin_amd64/vet
Format Tool: Not Found
Lint Tool: /Users/quamen/src/gocode/bin/golint
Oracle Tool: Not Found
joefitzgerald commented 10 years ago

Great, looks like it's found go just fine.

You have two options:

  1. Uncheck the Format With Go Imports preference >> should result in using gofmt
  2. Go to Packages > Go Plus > Get Missing Tools or Packages > Go Plus > Update Tools to get goimports
joefitzgerald commented 10 years ago

Actually, a third option is just to ensure you have goimports available on your GOPATH (in a bin subdirectory of one of your GOPATH segments). I.e. run go get -u code.google.com/p/go.tools/cmd/goimports.

I think I should potentially add a bit more information to the 'Not Found' message for the format tool to indicate that it's looking for goimports. The absence of that information probably threw you off in your investigation.

quamen commented 10 years ago

I took the third option, now everything is working as expected. Thanks for your help.

I think I should potentially add a bit more information to the 'Not Found' message for the format tool to indicate that it's looking for goimports. The absence of that information probably threw you off in your investigation.

I think that's a great idea, at the moment it doesn't give you any indication of what went wrong.

Thanks for your help sorting this out.

joefitzgerald commented 10 years ago

No worries mate (from a fellow Aussie, living in the US).

vanackere commented 10 years ago

Hi,

Regarding goimports : in my particular case for isolation purposes I use a separate GOPATH for each project, and therefore looking for goimports in $GOPATH/bin is not the right solution. Would it be possible to also search for goimports in the PATH if not found elsewhere ?

joefitzgerald commented 10 years ago

Yes, we could do this. Keep in mind you can have multiple GOPATH elements, and it will search each for goimports; so you could make your project - specific GOPATH element the most precedent one, and things should work as expected.

But yes, we should be searching the path too for goimports (and other GOPATH/bin items).

vanackere commented 10 years ago

Alright I did the modification locally and it works fine for me, I'll send you a pull request later today !

2014-07-23 14:08 GMT+02:00 Joe Fitzgerald notifications@github.com:

Yes, we could do this. Keep in mind you can have multiple GOPATH elements, and it will search each for goimports; so you could make your project - specific GOPATH element the most precedent one, and things should work as expected.

But yes, we should be searching the path too for goimports (and other GOPATH/bin items).

— Reply to this email directly or view it on GitHub https://github.com/joefitzgerald/go-plus/issues/41#issuecomment-49864956 .

joefitzgerald commented 10 years ago

@vanackere Thanks!

joefitzgerald commented 10 years ago

This is released in v2.0.1 just now.