-
Notifications
You must be signed in to change notification settings - Fork 121
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: Fix code errors reported by golangci-lint #57
Conversation
Let me know if we want to address the field alignment issue or golang upgrade issue. |
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! Seems like the unusedwrite
lint errors are pretty notable and should be caught by the linter. I'm thinking it's worthwhile to update the golangci-lint version to the latest.
As for fieldalignment
errors, I'm not sure if the gain from reordering struct fields is worth it here. I know that some of our structs have fields organized in a specific matter based on topic/function. Checking the existing .golangci.yaml
, we have the maligned
check disabled which is what fieldalignment
replaced in the newer golangci-lint versions. So maybe we also disable govet fieldalignment check?
@njhill WDYT?
Upgraded golangci and disabled fieldalignment. |
Thanks! |
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.
controllers/modelmesh/etcd.go
Outdated
for i, volumeMount := range container.VolumeMounts { | ||
if volumeMount.Name == etcdVolume { | ||
volumeMountExists = true | ||
volumeMount.ReadOnly = true | ||
volumeMount.MountPath = etcdMountPath | ||
container.VolumeMounts[i].ReadOnly = true | ||
container.VolumeMounts[i].MountPath = etcdMountPath |
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.
May as well avoid the struct copy altogether and also change to:
for i, _ := range container.VolumeMounts {
if container.VolumeMounts[i].Name == etcdVolume {
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.
OK, addressed.
7857be5
to
29e65b2
Compare
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 @pugangxa!
For future reference, it's best not to modify existing commits that have already been reviewed (apart from rebasing them), just push new commits.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: njhill, pugangxa The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
Motivation
In #53 reported some issues, checked and fixed the ones that are code errors
Modifications
Fix bug
Result
The code error is fixed, but