mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 21:21:14 +00:00
Use one copy of EnforcePtr
This commit is contained in:
@@ -51,7 +51,7 @@ import (
|
||||
//
|
||||
func (s *Scheme) EncodeToVersion(obj interface{}, destVersion string) (data []byte, err error) {
|
||||
obj = maybeCopy(obj)
|
||||
v, _ := enforcePtr(obj) // maybeCopy guarantees a pointer
|
||||
v, _ := EnforcePtr(obj) // maybeCopy guarantees a pointer
|
||||
if _, registered := s.typeToVersion[v.Type()]; !registered {
|
||||
return nil, fmt.Errorf("type %v is not registered and it will be impossible to Decode it, therefore Encode will refuse to encode it.", v.Type())
|
||||
}
|
||||
|
Reference in New Issue
Block a user