Merge pull request #99487 from chymy/fix-staticcheck0226

Fix staticcheck failures for pkg/controller/replicaset and pkg/kubelet/dockershim
This commit is contained in:
Kubernetes Prow Robot 2021-04-08 14:28:17 -07:00 committed by GitHub
commit 86fdf7b56e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 10 deletions

View File

@ -1,6 +1,4 @@
cluster/images/etcd/migrate
pkg/controller/replicaset
pkg/kubelet/dockershim
vendor/k8s.io/apimachinery/pkg/api/apitesting/roundtrip
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json

View File

@ -504,13 +504,6 @@ func TestPodControllerLookup(t *testing.T) {
}
}
// byName sorts pods by their names.
type byName []*v1.Pod
func (pods byName) Len() int { return len(pods) }
func (pods byName) Swap(i, j int) { pods[i], pods[j] = pods[j], pods[i] }
func (pods byName) Less(i, j int) bool { return pods[i].Name < pods[j].Name }
func TestRelatedPodsLookup(t *testing.T) {
someRS := newReplicaSet(1, map[string]string{"foo": "bar"})
someRS.Name = "foo1"
@ -1222,7 +1215,7 @@ func TestExpectationsOnRecreate(t *testing.T) {
t.Fatalf("Deleting RS didn't result in new item in the queue: %v", err)
}
rsExp, exists, err = manager.expectations.GetExpectations(oldRSKey)
_, exists, err = manager.expectations.GetExpectations(oldRSKey)
if err != nil {
t.Fatal(err)
}

View File

@ -180,6 +180,7 @@ func (ds *dockerService) CreateContainer(_ context.Context, r *runtimeapi.Create
}
hc.Resources.Devices = devices
//lint:ignore SA1019 backwards compatibility
securityOpts, err := ds.getSecurityOpts(config.GetLinux().GetSecurityContext().GetSeccompProfilePath(), securityOptSeparator)
if err != nil {
return nil, fmt.Errorf("failed to generate security options for container %q: %v", config.Metadata.Name, err)