This commit does two things in pkg package:

1. Remove unused ptr functions.
2. Replace ptr functions with k8s.io/utils/pointer
This commit is contained in:
WanLinghao
2019-02-23 13:06:47 +08:00
parent 4a1da48d11
commit d0138ca3fe
20 changed files with 75 additions and 97 deletions

View File

@@ -55,6 +55,7 @@ go_test(
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
"//vendor/k8s.io/utils/pointer:go_default_library",
],
)

View File

@@ -28,10 +28,9 @@ import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
utilpointer "k8s.io/utils/pointer"
)
func boolptr(b bool) *bool { return &b }
func TestGetJobFromTemplate(t *testing.T) {
// getJobFromTemplate() needs to take the job template and copy the labels and annotations
// and other fields, and add a created-by reference.
@@ -134,7 +133,7 @@ func TestGetParentUIDFromJob(t *testing.T) {
{
Kind: "CronJob",
UID: types.UID("5ef034e0-1890-11e6-8935-42010af0003e"),
Controller: boolptr(true),
Controller: utilpointer.BoolPtr(true),
},
})
@@ -158,19 +157,19 @@ func TestGroupJobsByParent(t *testing.T) {
ownerReference1 := metav1.OwnerReference{
Kind: "CronJob",
UID: uid1,
Controller: boolptr(true),
Controller: utilpointer.BoolPtr(true),
}
ownerReference2 := metav1.OwnerReference{
Kind: "CronJob",
UID: uid2,
Controller: boolptr(true),
Controller: utilpointer.BoolPtr(true),
}
ownerReference3 := metav1.OwnerReference{
Kind: "CronJob",
UID: uid3,
Controller: boolptr(true),
Controller: utilpointer.BoolPtr(true),
}
{