Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imports sorting should be deterministic #438

Closed
phisco opened this issue Jul 20, 2022 · 4 comments · Fixed by #440
Closed

Imports sorting should be deterministic #438

phisco opened this issue Jul 20, 2022 · 4 comments · Fixed by #440

Comments

@phisco
Copy link
Contributor

phisco commented Jul 20, 2022

We have always been implicitly enforcing a specific sorting for imports, but without the linter actually checking it, many files are adopting different standards.
A pr was merged and got into the latest relese of golangci-lint, reenabling gci autofix. So I suggest enabling gci as a linter and setting any required configuration.

The implicit standard we have been following I think was (standard libraries, everything else, local packages) separated by a line, but feel free to suggest any other standard we should enforce from now on.

@phisco phisco self-assigned this Jul 20, 2022
@mnencia
Copy link
Member

mnencia commented Jul 20, 2022

I like the idea. We need to merge #437 before implementing this. Otherwise, it will trigger gosec alerts, as explained in #436.

@mnencia
Copy link
Member

mnencia commented Jul 20, 2022

This issue on gci would be good to solve before implementing this enhancement daixiang0/gci#65

@armru
Copy link
Member

armru commented Aug 1, 2022

we are waiting for a release that contains daixiang0/gci#88

@phisco phisco assigned sxd and unassigned phisco Aug 1, 2022
@sxd sxd removed their assignment Aug 1, 2022
@mnencia
Copy link
Member

mnencia commented Aug 2, 2022

It is released and available in the latest golangci-lint version 1.147.3

mnencia added a commit that referenced this issue Aug 2, 2022
Closes #438

Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>

Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit that referenced this issue Aug 2, 2022
Closes #438

Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>

Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit that referenced this issue Aug 4, 2022
Closes #438

Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>

Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia added a commit that referenced this issue Dec 29, 2022
Closes #438

Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>

Co-authored-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants