-
Notifications
You must be signed in to change notification settings - Fork 491
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
CI: Use deterministic import order linter/formatter (gci) #3734
Conversation
…refix(github.com/algorand)" -s "Prefix(github.com/algorand/go-algorand)"
Oh, this is modifying generated msgp code unfortunately.. would need an update on the generator side. |
@algojack do you know why https://github.com/algorand/go-algorand/actions/runs/1957829742 reported success even though the reviewdog-errors job in there printed out a linter warning? https://github.com/algorand/go-algorand/runs/5481641372?check_suite_focus=true |
@@ -333,7 +333,7 @@ func getPendingTransactionsTest(t *testing.T, format string, max uint64, expecte | |||
func TestPendingTransactionLogsEncoding(t *testing.T) { | |||
partitiontest.PartitionTest(t) | |||
|
|||
response := generated.PendingTransactionResponse{ | |||
response := generatedV2.PendingTransactionResponse{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change doesn't look as if it belongs in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was making the linter fail because there were two imports of the same package (one with an alias, the other without) and it was non-deterministic without this update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you apply this change to the msgp first and make the updates there, and only then try to apply this PR ?
btw - I like the PR. It's great that we have automated way to validate the import order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the change but where is the linter itself?
For the generated files (rest api router, msgp) need to modify the generators or add exclusion
answered on slack |
Updated msgp in algorand/msgp#14 — files it generates now match this PR's changes. |
Codecov Report
@@ Coverage Diff @@
## master #3734 +/- ##
=======================================
Coverage 55.24% 55.24%
=======================================
Files 398 398
Lines 50148 50148
=======================================
Hits 27706 27706
Misses 20133 20133
Partials 2309 2309 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but doubled import in one file
@@ -24,6 +24,8 @@ import ( | |||
"github.com/algorand/go-algorand/data/basics" | |||
"github.com/algorand/go-algorand/protocol" | |||
"strings" | |||
|
|||
"github.com/algorand/go-algorand/protocol" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doubled!
talked to @cce and this PR needs to be updated to newer version of golangci i believe, and tested that everything else still works with our version of go and new version of golangci. |
Will bring this back in a new PR against latest |
Summary
Uses the gci linter/formatter tool (included in golangci-lint) to fix & enforce breaking imports up into 4 sections: standard libraries, followed by external, followed by algorand-external, followed by local.
Test Plan
Existing tests should pass, reviewdog CI runner that calls golangci-lint should continue to work.