Skip to content

U1000: Potential False Positive On Embedding Type Aliased Interfaces In Structs #1365

@MadhavJivrajani

Description

@MadhavJivrajani

What Happened

We bumped the version of staticcheck (v0.4.0) in Kubernetes to incorporate go1.20 related changes. PR: kubernetes/kubernetes#115537

We are also using go1.20 on master (ref: kubernetes/kubernetes#114502)

Due to improvements to linters, a few things were flagged, out of which one of the flagged instances seems to be a false positive.
Here are the failure logs from the failed run: https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/115537/pull-kubernetes-verify/1622491177255178240

Here is part of the code that was flagged:

https://github.com/kubernetes/kubernetes/blob/19eddfc5675c3a9206e33333719bcf719bb99928/test/integration/apiserver/discovery/discovery_test.go#L55-L71

Before adding the comments to exclude the warnings, from the logs:

test/integration/apiserver/discovery/discovery_test.go:55:6: type `kubeClientSet` is unused (unused)
[1015](https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/115537/pull-kubernetes-verify/1622491177255178240#1:build-log.txt%3A1015)
type kubeClientSet = kubernetes.Interface
[1016](https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/115537/pull-kubernetes-verify/1622491177255178240#1:build-log.txt%3A1016)
     ^

Considering that the type aliases are in fact used, is this warning valid or is it a false positive? Please note that this warning did not surface on a version before v0.4.0.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions