You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
https://go.dev/cl/840685 has at least 4 comments about
import reorganization and while I am fully to blame
for putting organizeImports on my :w in a central
config that the 4 machines I am authoring security
patches share, this should either be considered a bug
in gopls or a new opinion we accept in our source files.
cmd/go is already somewhat inconsistent in whether cmd/ imports are grouped with std.
as a random example, these two files in the same package have different formattings:
Activity
adonovan commentedon Oct 2, 2026
We encourage users to run organizeImports on save. We know how it ought to work, and we fix bugs when it doesn't.
What sequence of steps led to the unwanted behavior?
gabyhelp commentedon Oct 2, 2026
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
seankhliao commentedon Oct 2, 2026
cmd/go is already somewhat inconsistent in whether
cmd/imports are grouped with std.as a random example, these two files in the same package have different formattings:
https://go.googlesource.com/go/+/refs/heads/master/src/cmd/go/internal/work/action.go
https://go.googlesource.com/go/+/refs/heads/master/src/cmd/go/internal/work/cover.go
I think we need to commit to a particular style and make a mechanical format commit to align the files.
I have a mild preference for separating cmd/ from std/ imports (I think this is equivalent to passing
goimports -local cmd/).cc @golang/go-command
seankhliao commentedon Oct 2, 2026
e.g. this is what it looks like running
goimports -local cmd -w .forcmd/go(ignoring all the other cmd/ packages for now):https://go-review.googlesource.com/c/go/+/843865
note all the files it didn't change, and some files with mixed import grouping.