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
Make Ansible Operator parameter case conversion optional #3245
Make Ansible Operator parameter case conversion optional #3245
Conversation
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.
SGTM
@fabianvf Does this warrant a line in the CHANGELOG? Seems more like a feature than a bugfix.
@hasbro17 good call, added changelog fragment |
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.
Not sure if the CI failure is related, but LGTM on the docs and CHANGELOG fragment.
/lgtm |
@tengqm: changing LGTM is restricted to collaborators In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
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.
/lgtm
/approve
de14936
to
a752cdf
Compare
New changes are detected. LGTM label has been removed. |
627fe96
to
1dae72e
Compare
@@ -54,6 +54,7 @@ type Watch struct { | |||
WatchDependentResources bool `yaml:"watchDependentResources"` | |||
WatchClusterScopedResources bool `yaml:"watchClusterScopedResources"` | |||
Selector metav1.LabelSelector `yaml:"selector"` | |||
SnakeCaseParameters bool `yaml:"snakeCaseParameters"` |
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.
The issue faced in the lint is maligned
. To solve it you can just keep the bools at the ends. Move the Selector before of them.
To know more about it see: https://medium.com/@sebassegros/golang-dealing-with-maligned-structs-9b77bacf4b97
Running golangci-lint
pkg/ansible/watches/watches.go:44:12: struct of size 200 bytes could be of size 192 bytes (maligned)
type Watch struct {
^
Makefile:89: recipe for target 'lint' failed
make: *** [lint] Error 1
The command "make test-sanity" exited with 2.
cache.2
store build cache
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.
I'm speechless at this lint check.
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.
Hi @tengqm,
For further information see: https://medium.com/@sebassegros/golang-dealing-with-maligned-structs-9b77bacf4b97
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.
@camilamacedo86 Thanks for the pointer. I didn't realize that Go is so hypercritical and nitpicking ... and I'm not sure if it is always a good thing. But anyway.
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.
Just to clarifies, the maligned
is a lint check. It checks the usage of memory space of a structure and alert when we are using more spaces than required. Why it would be a bad thing at all?
However, in the cases that we decide to prioritize the code understatement instead of it, we can just say for the lint ignore the specific check in the specific place by using // nolint:maligned
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.
If it is always the right thing to do, the compiler should do this byte alignment transparently rather than forcing the developer to think about these details. There are other cases I want to order my fields for different purposes, e.g. semantic grouping, deriving Web UI for an input struct etc.
HI @fabianvf, it shows ok to go forward, just missing rebase. 👍 great work btw |
6aef654
to
44e8c3b
Compare
44e8c3b
to
881d089
Compare
Description of the change:
Adds the
snakeCaseParameters
(default true) parameter to the watches.yaml, which disables the camelCase -> snake_case conversionMotivation for the change:
For some users this causes more problems than it solves, and it definitely should be optional.
Closes #1770