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

CI: enforce fmt simplification #1699

Merged
merged 1 commit into from
Jul 12, 2022
Merged

Conversation

chappjc
Copy link
Member

@chappjc chappjc commented Jul 6, 2022

In catching up with recent PRs I noticed some churn because gofmt has a "simplify" option that removes some superfluous identifiers, but CI does not enforce its use and only some developers have it set. I don't see a way to enforce "not simple" so this PR enforces simple for consistency. This is done by enabling the gofmt linter in golangci-lint:

gofmt: Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true, auto-fix: true]

Developers may choose to add that as well, or just add -s to their gofmt flags.

This also modifies the the erc20 updatecontract.sh script so that it reorders the imports after rewriting the import lines with perl. Recent PRs have tried to modify contract.go, but since it is generated it should not be touched (except by the script that generates it).

Copy link
Contributor

@martonp martonp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be updated in run_tests.sh?

@chappjc
Copy link
Member Author

chappjc commented Jul 7, 2022

Shouldn't this be updated in run_tests.sh?

Yes! I don't know what happened to it. Whoops

@chappjc chappjc merged commit 1e9f733 into decred:master Jul 12, 2022
@chappjc chappjc deleted the enforce-simple branch July 12, 2022 16:21
@chappjc chappjc added this to the 0.5 milestone Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants