-
Notifications
You must be signed in to change notification settings - Fork 152
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
gofmt issue fixes as per goreportcard (#1274) #1749
Conversation
67b85d6
to
5793775
Compare
# 2. Build exempted files using build tags | ||
# Note: Future build tags should be included. | ||
echo "Running gofmt..." | ||
golangci-lint run --timeout ${TIMEOUT} --disable-all --enable gofmt --build-tags integration |
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.
@Bhargav-InfraCloud If we add this, we don't need the previous call (Line no 25), right?
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.
It would require both, actually. The first one (line 25) runs 7 default linters (errcheck
, gosimple
, govet
, ineffassign
, staticcheck
, typecheck
& unused
) with 4 enabled (maligned
, whitespace
, gocognit
& unparam
).
The second (line 32) only runs gofmt
which is the core of this change.
Ideally, gofmt
could've been added to the first. But in doing so, the extra conditions (skipping the directory and excluding ctx error) will get applied to this which is not wise. And also, gofmt
without --build-tags integration
would ignore 2 files dropping the % in report. Enable it in first directly and it would throw a lot of unexpected linter errors (not required as of now).
As I suggested in PR, using .golangci-yaml
can solve this issue, where we can specify all the configs and run it only once. But that would be for future PR if agreed upon.
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.
Thanks @Bhargav-InfraCloud could you please file an issue to switch to .golanci-yaml
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.
Opened #1761
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.
Thank you for the contribution @Bhargav-InfraCloud 🙏🏼
LGTM. Will let @PrasadG193 +2 this
Fix the go formatting issues reported by gojp/goreportcardare. Add 'gofmt' in golint.sh to warn for future commits. Signed-off-by: Bhargav Ravuri <bhargav.ravuri@infracloud.io>
f225581
to
faf37e5
Compare
@pavannd1 @PrasadG193 The pipeline probably was failing because of commit e956100 or b48647f that I merged from master into this branch without checking the github action's status. I've now rebased with latest successful commit. Can you please trigger the pipeline again? |
Thanks again @PrasadG193 @pavannd1 😊 |
Signed-off-by: Bhargav Ravuri bhargav.ravuri@infracloud.io
Change Overview
gofmt
in golint.sh to warn for future commits.Pull request type
Please check the type of change your PR introduces:
Issues
Test Plan
make golint
.goreportcard-cli -v
. It should print stats similar to:Note:
% ofgofmt
should be higher than what it was before this commit.Message for maintainers
.golangci.yml
configured to make most out of it.