-
Notifications
You must be signed in to change notification settings - Fork 79
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
feat!: enable golangci-lint #208
Conversation
Codecov Report
@@ Coverage Diff @@
## master #208 +/- ##
==========================================
- Coverage 80.93% 77.43% -3.50%
==========================================
Files 7 7
Lines 493 523 +30
==========================================
+ Hits 399 405 +6
- Misses 56 69 +13
- Partials 38 49 +11
|
enable: | ||
- exportloopref | ||
- gofumpt | ||
- misspell | ||
- nakedret | ||
- revive | ||
- prealloc |
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.
copied the celestia-app .golanci.yml
b/c it seems like a good starting point / uncontroversial
@@ -178,7 +178,13 @@ func (eds *ExtendedDataSquare) solveCrosswordRow( | |||
|
|||
// Insert rebuilt shares into square. | |||
for c, s := range rebuiltShares { | |||
eds.SetCell(uint(r), uint(c), s) |
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.
previously this was silently ignoring an error! Thanks to errcheck, we are forced to check the error return type and propagate it which resulted in:
--- FAIL: TestRepairExtendedDataSquare (0.00s)
--- FAIL: TestRepairExtendedDataSquare/leopard (0.00s)
--- FAIL: TestRepairExtendedDataSquare/leopard/MaximumErasures (0.00s)
/Users/rootulp/git/rootulp/celestia/rsmt2d/extendeddatacrossword_test.go:60: unexpected err while repairing data square: cannot set cell (3, 2) as it already has a value 05050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505, codec: :leopard
To resolve, 2b4078b checks if the cellToSet is nil prior to the attempt to SetCell
- release/** | ||
|
||
env: | ||
GO_VERSION: '1.20' |
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.
inconsistent until #211 merges
@@ -196,8 +196,12 @@ func (eds *ExtendedDataSquare) Col(y uint) [][]byte { | |||
} | |||
|
|||
// ColRoots returns the Merkle roots of all the columns in the square. | |||
func (eds *ExtendedDataSquare) ColRoots() [][]byte { | |||
return deepCopy(eds.getColRoots()) | |||
func (eds *ExtendedDataSquare) ColRoots() ([][]byte, error) { |
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.
[note for reviewers] this is public API breaking
@@ -207,8 +211,12 @@ func (eds *ExtendedDataSquare) Row(x uint) [][]byte { | |||
} | |||
|
|||
// RowRoots returns the Merkle roots of all the rows in the square. | |||
func (eds *ExtendedDataSquare) RowRoots() [][]byte { | |||
return deepCopy(eds.getRowRoots()) | |||
func (eds *ExtendedDataSquare) RowRoots() ([][]byte, error) { |
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.
[note for reviewers] this is public API breaking
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.
LGTM!
|
||
Run benchmarks | ||
1. [Install Go](https://go.dev/doc/install) 1.19+ |
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 line is incorrect after I created #211
It should've said 1.20+
Closes #204
Marked as breaking b/c the function signature for exported functions (
RowRoots
andColRoots
) was modified to include an error return parameter.Testing
golangci-lint run
passes locallygolangci-lint run
passes in CI here