https://rancher.com/ logo
Title
c

cool-thailand-26552

11/25/2022, 8:13 AM
@rapid-van-91305 @astonishing-stone-14417 Is there a standard for organizing golang imports in order to avoid merge conflicts?
r

rapid-van-91305

11/25/2022, 8:15 AM
Standard is generally to the same versions of k8s.io packages for the CAPI version that is being used.
Or did you mean in terms of “require” sections?
c

cool-thailand-26552

11/25/2022, 8:15 AM
No, in the import section of each file I meant
r

rapid-van-91305

11/25/2022, 8:16 AM
Ah, in that case it depends on the project and your configuration of golangci-lint
c

cool-thailand-26552

11/25/2022, 8:17 AM
I think I simply have alphabetical, but any empty line would create a new block, alphabetical sorting is only inside a block
r

rapid-van-91305

11/25/2022, 8:17 AM
In CAPA for example we have 3 groups: • standard go packages • all other packages except capi/providers • all sigs.k8s.io/cluster-api packages
and then in each group alphabetical
c

cool-thailand-26552

11/25/2022, 8:18 AM
and project imports ? at the end ?
r

rapid-van-91305

11/25/2022, 8:19 AM
Project imports in CAPA are covered in the last group for us but as we are in a different gh org then yes last
I do like having project imports in the last group
c

cool-thailand-26552

11/25/2022, 8:20 AM
ok cool, should we write that if anyone wants to contribute?
r

rapid-van-91305

11/25/2022, 8:20 AM
Yes we can add to the contributing guide and also enfore via the linter
c

cool-thailand-26552

11/25/2022, 8:20 AM
Oh interesting
I will need to check how to do that on my worktree
c

cool-thailand-26552

11/25/2022, 8:21 AM
Is the linter capable of reorganizing automatically in an IDE like VScode ?
Nice! very simple at that!