-
Notifications
You must be signed in to change notification settings - Fork 2.9k
golangci-lint bump and deprecation cleanups #27473
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Obsoletes: containers#27407 Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lsm5 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 |
|
Sure, LGTM |
|
This exposed more deprecations. Working through those now. |
|
@containers/podman-maintainers PTAL. |
mtrmac
left a comment
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.
This is a drive-by, I didn’t actually look at any of the removed fields and I have, currently, no opinion on whether removing the uses is or isn’t correct.
pkg/specgen/generate/kube/seccomp.go
Outdated
| // check if it is prefaced with container.seccomp.security.alpha.kubernetes.io/ | ||
| prefixAndCtr := strings.Split(annKeyValue, "/") | ||
| if prefixAndCtr[0]+"/" != v1.SeccompContainerAnnotationKeyPrefix { | ||
| if prefixAndCtr[0]+"/" != "container.seccomp.security.alpha.kubernetes.io/" { |
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.
These kinds of changes are making things harder to maintain.
If the code needs to stay (I have absolutely no expertise here and no opinion on that), it’s better to use the named constants, and silence the linter with an explanation why the code still needs to stay.
This continues to use a deprecated feature, but it only makes it impossible to find references in any future analysis.
| if c.config.Rootfs != "" { | ||
| size, err := util.SizeOfPath(c.config.Rootfs) | ||
| return int64(size), err | ||
| size, err := directory.Size(c.config.Rootfs) |
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.
Isn’t this the last user? The function can be removed, then.
pkg/specgen/generate/kube/seccomp.go
Outdated
| // check if it is prefaced with container.seccomp.security.alpha.kubernetes.io/ | ||
| prefixAndCtr := strings.Split(annKeyValue, "/") | ||
| if prefixAndCtr[0]+"/" != v1.SeccompContainerAnnotationKeyPrefix { | ||
| if prefixAndCtr[0]+"/" != "container.seccomp.security.alpha.kubernetes.io/" { |
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.
That is just objectivity worse, what do we gain by inline this and keep the deprecated variable as well? If these annotations are no longer in use can we rework the seccomp logic to no longer use them instead?
same in the other cases here
| // if no network was specified use add the default | ||
| if len(s.Networks) == 0 { | ||
| // backwards config still allow the old cni networks list and convert to new format | ||
| if len(s.CNINetworks) > 0 { |
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.
logic wise it would be nice to do this and the other cni removal in the same commit instead of splitting the commits per file which doesn't seem to gain us anything here.
This seems safe since we drop cni support but if we do this then also directly remove the CNINetworks field from the struct definition. IF we own the code no point in having unused fields.
pkg/specgen/podspecgen.go
Outdated
| // Optional. | ||
| // | ||
| // Deprecated: as of podman 4.0 use "Networks" instead. | ||
| CNINetworks []string `json:"cni_networks,omitempty"` |
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 we remove CNI support just remove the fields completely
pkg/util/utils.go
Outdated
| // | ||
| // Deprecated: use github.com/containers/storage/pkg/directory.Size() instead. | ||
| func SizeOfPath(path string) (uint64, error) { |
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 you remove the one caller just remove this function from the code
| ctrConfig.Networks[net] = opts | ||
| } | ||
| ctrConfig.StaticIP = nil | ||
| ctrConfig.StaticMAC = nil |
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.
there are old fields, I don't think they have been in use since sqlite so they also should be removed from the struct
|
@Luap99 I'm not familiar with the seccomp stuff and I'd prefer not to take too long on this PR, so would you be ok if I reverted the seccomp stuff along with If not, maybe I'll just close this and/or let someone else pick up the golangci version update. |
|
I am totally fine with nolint comments on the seccomp things, I also have no idea what the expected k8s behaviours are there. Maybe file an issue for that then so we don't loose track. |
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
- Remove deprecated util.SizeOfPath Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
Ref: containers#27501 Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
4ea376c to
43e52f7
Compare
Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?