forked from kubernetes-sigs/aws-load-balancer-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubernetes-sigs#1228 from M00nF1sh/i_1227
redact oidc
- Loading branch information
Showing
5 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package util | ||
|
||
import ( | ||
"bytes" | ||
"encoding/gob" | ||
) | ||
|
||
func DeepCopyInto(to interface{}, from interface{}) { | ||
buff := new(bytes.Buffer) | ||
enc := gob.NewEncoder(buff) | ||
dec := gob.NewDecoder(buff) | ||
_ = enc.Encode(from) | ||
_ = dec.Decode(to) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package util | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
type structA struct { | ||
Name string | ||
} | ||
|
||
type structB struct { | ||
Name string | ||
A *structA | ||
} | ||
|
||
func TestDeepCopyInto(t *testing.T) { | ||
obj := structB{ | ||
Name: "parent", | ||
A: &structA{ | ||
Name: "child-1", | ||
}, | ||
} | ||
objClone := structB{} | ||
DeepCopyInto(&objClone, obj) | ||
obj.A.Name = "child-2" | ||
|
||
assert.Equal(t, structB{ | ||
Name: "parent", | ||
A: &structA{ | ||
Name: "child-2", | ||
}, | ||
}, obj) | ||
assert.Equal(t, structB{ | ||
Name: "parent", | ||
A: &structA{ | ||
Name: "child-1", | ||
}, | ||
}, objClone) | ||
} |