-
Notifications
You must be signed in to change notification settings - Fork 138
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
Fix fmt in ci #351
Merged
Merged
Fix fmt in ci #351
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To pick up goimports tool. Signed-off-by: Manuel Mendez <[email protected]>
Wasn't caught by CI when introduced. Signed-off-by: Manuel Mendez <[email protected]>
3 tasks
Codecov Report
@@ Coverage Diff @@
## master #351 +/- ##
=======================================
Coverage 23.79% 23.79%
=======================================
Files 14 14
Lines 1244 1244
=======================================
Hits 296 296
Misses 928 928
Partials 20 20
Continue to review full report at Codecov.
|
Imports should be grouped by either in stdlib or not as goimports does by default. goimports won't ungroup groups its comes across though, but there's no reason for us to have them in our project. Fixed with: sed -i '/^import (/,/^)/ { /^\s*$/ d}' **/*.go goimports -w . Signed-off-by: Manuel Mendez <[email protected]>
goimports is a superset of go fmt, it also ensures the imports are grouped and sorted nicely. Most importantly it has a `-d`/diff mode that we can use to test for changes more easily than what would be needed if we stayed with `go fmt`. Signed-off-by: Manuel Mendez <[email protected]>
Fail CI if goimports has any changes, otherwise our intent of having `go fmt`'d code isn't actually guaranteed. Signed-off-by: Manuel Mendez <[email protected]>
kqdeng
approved these changes
Oct 26, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Ensures all our code is
go fmt
(reallygoimports
clean) by checking in CI and failing if there's a change.Why is this needed
Fixes: #350
How Has This Been Tested?
goimports
is happy and tests aren't affected.How are existing users impacted? What migration steps/scripts do we need?
No impact.