Conversation
codingllama
left a comment
There was a problem hiding this comment.
As said before, I'm happy with any deterministic formatting that machines can do and enforce for us.
Please run make fix-imports on teleport.e/ and update the reference here, otherwise it'll break.
Update it now? |
1ceced9 to
f658883
Compare
mdwn
left a comment
There was a problem hiding this comment.
I'm in, looks like a great idea!
r0mant
left a comment
There was a problem hiding this comment.
Couple of general notes:
- I would consider backporting this to at least all active release branches, otherwise backports will be a pain.
- Does this change local workflows in any way? I.e. do we need to install any extra Go tools that would auto-sort these imports or do we need to run
make fix-importseach time before opening a PR?
@r0mant |
gopls keeps existing import blocks by default, so it's not much noise. Without any extra configuration you'll likely have to move an import here and there. VSCode/gopls setup should be something like this (caveat, I don't use this): "gopls": {
"formatting.local": "github.com/gravitational/teleport",
"formatting.gofumpt": true, // optional
}, |
|
It gets a little weird with block comments between imports, but single-line comments after the import are fine and as long as the file is already correct with only 3 blocks of imports (standard, nonlocal, local), gopls with those settings should keep it correct according to gci. |
|
If you want to play around with, or just reformat select files, the equivalent invocation to the config is something like this: (Install to GOPATH using |
Change formatting pattern
8599d67 to
f572b28
Compare
Sort all imports in a deterministic way.
GCI linter generates deterministic Go imports when run with the
--runflag.Introduced
make fix-importsto make the process easier.TODO: