chore: gofumpt#11839
Conversation
tac0turtle
left a comment
There was a problem hiding this comment.
Love the clean up, went through parts of the PR not everything due to size. Would love a second approval before merging.
|
Can this be as well added in |
|
Didn't we have issues with this on Osmosis? What does this buy us over |
|
@alexanderbez yep, we did. I figure if we do it once in a while, we can get the benefits without the pain of having it in ci. In ci, it could cause pain because then everyone must
@ValarDragon mentioned it could be rough for first timers and I agree. Also, I think it makes the code look and feel nicer. Maybe do once in a while for a bit, and when the tooling/practice is more mature we add it to ci. For example if it ran automatically when users:
|
I also think this is the best idea for now (suggestion from the osmosis issue) |
|
@faddat do you want to add this in the release process? |
|
@marbar3778 Sure! |
|
@marbar3778 I've added gofumpt to the release process description document. |
There was a problem hiding this comment.
All changes checked. Approving as lgtm.
However, just a few nits. I think gofumpt made some formatting that is correct but not optimal due to the current formatting: when we were already line wrapping the arguments, gofumpt sometimes gets us one line with only one argument. IMHO we should then use only one line, or remove our manual wrapping and let gofumpt do its thing.
I think it'd be great to fix them before merging, as we are touching all those files anyway.
|
@julienrbrt -- I cannot exactly explain / justify changes maade by Overall, I like what it does for the appearance and standardization of code, and you can check it out in more detail here: https://github.com/mvdan/gofumpt Sorry bout that |
I understand, I use the tool as part of my workflow as well. For instance, in func NewQueryDelegatorTotalRewardsResponse(rewards []DelegationDelegatorReward,
total sdk.DecCoins) QueryDelegatorTotalRewardsResponse {
return QueryDelegatorTotalRewardsResponse{Rewards: rewards, Total: total}
}running func NewQueryDelegatorTotalRewardsResponse(rewards []DelegationDelegatorReward,
total sdk.DecCoins,
) QueryDelegatorTotalRewardsResponse {
return QueryDelegatorTotalRewardsResponse{Rewards: rewards, Total: total}
}which is weird. If before running func NewQueryDelegatorTotalRewardsResponse(rewards []DelegationDelegatorReward, total sdk.DecCoins) QueryDelegatorTotalRewardsResponse {
return QueryDelegatorTotalRewardsResponse{Rewards: rewards, Total: total}
}nothing will change, and we get, imo a better styling than with I think it worth it to do that manual improving where we see |
|
I think I agree @julienrbrt. I should either be one line or each arg in a separate line. What gofumpt produces, func NewQueryDelegatorTotalRewardsResponse(rewards []DelegationDelegatorReward,
total sdk.DecCoins,
) QueryDelegatorTotalRewardsResponse {
return QueryDelegatorTotalRewardsResponse{Rewards: rewards, Total: total}
}Is not great. I'd rather see: func NewQueryDelegatorTotalRewardsResponse(
rewards []DelegationDelegatorReward,
total sdk.DecCoins,
) QueryDelegatorTotalRewardsResponse {
return QueryDelegatorTotalRewardsResponse{Rewards: rewards, Total: total}
} |
|
@faddat Do you mind If I fix these nits myself in your branch? |
|
I don't mind at all :). I am also wondering how else we can improve. Your nits were real. aha! OK, now that I have re-read your comments, it makes sense. 1st update: 2nd update: |
|
Thanks for updating! |
* fumpt using main not master... * be more descriptive * fumpt * fix nits Co-authored-by: Julien Robert <julien@rbrt.fr>
Description
I generated this pr using gofumpt
go install mvdan.cc/gofumpt@latest
gofumpt -w -l .
I find that it really does a great job of keeping things clean and
readable. Is it something we want to use?
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!to the type prefix if API or client breaking changeCHANGELOG.mdReviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!in the type prefix if API or client breaking change