palantir / godel

Go tool for formatting, checking, building, distributing and publishing projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use "goimports" or "gofmt" rather than "ptimports" for "format" task

nmiyake opened this issue · comments

Currently, the format task runs gofmt and ptimports. The latter was a tool developed when godeps was still common and we wanted better import sorting.

With the vendor paradigm now being part of official/standard Go, there isn't much of a need to optimize godeps imports. Besides that, ptimports does the following:

  • Always converts imports to block form
  • Performs goimports spacing and also adds another block where project imports are placed

Although these are nice, I'm not sure that the marginal utility provided by these actions outweighs the benefits of using formatting that is more standard in the Go community. If gödel used gofmt or goimports by default, there would be far more repositories on which adding gödel and running the format task would not immediately modify most files.

Now that a plugin architecture exists, if a project really wants to run ptimports, they can add it as a plugin and do so. I think that also makes a strong case for switching the default format task to something more standard.

Fixed in 2.0.