Skip to content

Commit 5a8400a

Browse files
authored
Merge pull request #1410 from cbandy/client-patch
🐛 Fix client.Apply and client.Merge to satisfy Patch
2 parents 08efa13 + c491478 commit 5a8400a

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,19 +20,18 @@ 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
"k8s.io/apimachinery/pkg/util/strategicpatch"
2726
)
2827

2928
var (
3029
// Apply uses server-side apply to patch the given object.
31-
Apply = applyPatch{}
30+
Apply Patch = applyPatch{}
3231

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

3837
type patch struct {
@@ -92,7 +91,7 @@ type mergeFromPatch struct {
9291
opts MergeFromOptions
9392
}
9493

95-
// Type implements patch.
94+
// Type implements Patch.
9695
func (s *mergeFromPatch) Type() types.PatchType {
9796
return s.patchType
9897
}
@@ -188,7 +187,7 @@ func (p mergePatch) Type() types.PatchType {
188187
}
189188

190189
// Data implements Patch.
191-
func (p mergePatch) Data(obj runtime.Object) ([]byte, error) {
190+
func (p mergePatch) Data(obj Object) ([]byte, error) {
192191
// NB(directxman12): we might technically want to be using an actual encoder
193192
// here (in case some more performant encoder is introduced) but this is
194193
// correct and sufficient for our uses (it's what the JSON serializer in
@@ -205,7 +204,7 @@ func (p applyPatch) Type() types.PatchType {
205204
}
206205

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

0 commit comments

Comments
 (0)