Merge pull request #93871 from habibrosyad/patch-92402-4

fix vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured staticcheck
This commit is contained in:
Kubernetes Prow Robot 2020-08-27 04:47:30 -07:00 committed by GitHub
commit 07110b7b34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 11 deletions

View File

@ -15,7 +15,6 @@ test/integration/scheduler_perf
test/integration/ttlcontroller
vendor/k8s.io/apimachinery/pkg/api/apitesting/roundtrip
vendor/k8s.io/apimachinery/pkg/api/meta
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructuredscheme
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation
vendor/k8s.io/apimachinery/pkg/conversion

View File

@ -282,14 +282,6 @@ func getNestedString(obj map[string]interface{}, fields ...string) string {
return val
}
func getNestedInt64(obj map[string]interface{}, fields ...string) int64 {
val, found, err := NestedInt64(obj, fields...)
if !found || err != nil {
return 0
}
return val
}
func getNestedInt64Pointer(obj map[string]interface{}, fields ...string) *int64 {
val, found, err := NestedInt64(obj, fields...)
if !found || err != nil {

View File

@ -71,7 +71,7 @@ func TestEmptyCreationTimestampIsOmitted(t *testing.T) {
// set an initial creationTimestamp and ensure the field exists
u.SetCreationTimestamp(now)
metadata := u.Object["metadata"].(map[string]interface{})
creationTimestamp, exists := metadata["creationTimestamp"]
_, exists := metadata["creationTimestamp"]
if !exists {
t.Fatalf("unexpected missing creationTimestamp")
}
@ -79,7 +79,7 @@ func TestEmptyCreationTimestampIsOmitted(t *testing.T) {
// set an empty timestamp and ensure the field no longer exists
u.SetCreationTimestamp(metav1.Time{})
metadata = u.Object["metadata"].(map[string]interface{})
creationTimestamp, exists = metadata["creationTimestamp"]
creationTimestamp, exists := metadata["creationTimestamp"]
if exists {
t.Errorf("unexpected creation timestamp field: %q", creationTimestamp)
}