Skip to content

Commit c491478

Browse files
committed
🐛 Fix client.Apply and client.Merge to satisfy Patch
a79f6f1 changed the Patch interface but missed these two implementations. Their exported variable declarations will catch this next time.
1 parent a79f6f1 commit c491478

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pkg/client/patch.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,17 @@ import (
2020
"fmt"
2121

2222
jsonpatch "github.com/evanphx/json-patch"
23-
"k8s.io/apimachinery/pkg/runtime"
2423
"k8s.io/apimachinery/pkg/types"
2524
"k8s.io/apimachinery/pkg/util/json"
2625
)
2726

2827
var (
2928
// Apply uses server-side apply to patch the given object.
30-
Apply = applyPatch{}
29+
Apply Patch = applyPatch{}
3130

3231
// Merge uses the raw object as a merge patch, without modifications.
3332
// Use MergeFrom if you wish to compute a diff instead.
34-
Merge = mergePatch{}
33+
Merge Patch = mergePatch{}
3534
)
3635

3736
type patch struct {
@@ -89,7 +88,7 @@ type mergeFromPatch struct {
8988
opts MergeFromOptions
9089
}
9190

92-
// Type implements patch.
91+
// Type implements Patch.
9392
func (s *mergeFromPatch) Type() types.PatchType {
9493
return types.MergePatchType
9594
}
@@ -153,7 +152,7 @@ func (p mergePatch) Type() types.PatchType {
153152
}
154153

155154
// Data implements Patch.
156-
func (p mergePatch) Data(obj runtime.Object) ([]byte, error) {
155+
func (p mergePatch) Data(obj Object) ([]byte, error) {
157156
// NB(directxman12): we might technically want to be using an actual encoder
158157
// here (in case some more performant encoder is introduced) but this is
159158
// correct and sufficient for our uses (it's what the JSON serializer in
@@ -170,7 +169,7 @@ func (p applyPatch) Type() types.PatchType {
170169
}
171170

172171
// Data implements Patch.
173-
func (p applyPatch) Data(obj runtime.Object) ([]byte, error) {
172+
func (p applyPatch) Data(obj Object) ([]byte, error) {
174173
// NB(directxman12): we might technically want to be using an actual encoder
175174
// here (in case some more performant encoder is introduced) but this is
176175
// correct and sufficient for our uses (it's what the JSON serializer in

0 commit comments

Comments
 (0)