What version of Go are you using (go version)?
1.14
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
MacOS
What did you do?
ran go fmt ./.. on my codebase
What did you expect to see?
The builtin go fmt formats imports identically to goimports
What did you see instead?
go fmt works differently than goimports
Downloading of goimports is necessary to work in certain repos and adhere to their style guide. One impetus of having go fmt built in is to not have these sorts of disagreements, and instead just rally around a single tool. The existence and continued support for goimports goes against this philosophy. In addition, there is poor visibility in the public eye of goimports. Its not discoverable via the command line, as it isn't built in like vet and fmt. The only way people learn of this other tool is via blog posts or poking around Github.
I propose that the builtin go fmt sorts imports in the same way as goimports starting with next Go versioned release, and development of goimports ceases.
If we want to maintain two different sets of rules, I think a good compromise would be to add a -imports flag to the builtin go fmt so that we aren't maintaining two tools for one job
What version of Go are you using (
go version)?1.14
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?MacOS
What did you do?
ran
go fmt ./..on my codebaseWhat did you expect to see?
The builtin
go fmtformats imports identically togoimportsWhat did you see instead?
go fmtworks differently thangoimportsDownloading of
goimportsis necessary to work in certain repos and adhere to their style guide. One impetus of havinggo fmtbuilt in is to not have these sorts of disagreements, and instead just rally around a single tool. The existence and continued support forgoimportsgoes against this philosophy. In addition, there is poor visibility in the public eye ofgoimports. Its not discoverable via the command line, as it isn't built in likevetandfmt. The only way people learn of this other tool is via blog posts or poking around Github.I propose that the builtin
go fmtsorts imports in the same way asgoimportsstarting with next Go versioned release, and development ofgoimportsceases.If we want to maintain two different sets of rules, I think a good compromise would be to add a
-importsflag to the builtingo fmtso that we aren't maintaining two tools for one job