Fix staticcheck failures for pkg/controller/replicaset and pkg/kubelet/dockershim

This commit is contained in:
chymy 2021-02-26 03:17:40 -05:00
parent a8ac0c98b9
commit c28be0baab
3 changed files with 2 additions and 10 deletions

View File

@ -1,6 +1,4 @@
cluster/images/etcd/migrate cluster/images/etcd/migrate
pkg/controller/replicaset
pkg/kubelet/dockershim
vendor/k8s.io/apimachinery/pkg/api/apitesting/roundtrip vendor/k8s.io/apimachinery/pkg/api/apitesting/roundtrip
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json 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) { func TestRelatedPodsLookup(t *testing.T) {
someRS := newReplicaSet(1, map[string]string{"foo": "bar"}) someRS := newReplicaSet(1, map[string]string{"foo": "bar"})
someRS.Name = "foo1" 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) 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 { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

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