Commit 7f8fd32e authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #46418 from zjj2wry/ux

Automatic merge from submit-queue fix err message typo and small change in UX **What this PR does / why we need it**: 1. small ux change 2. fix typo: convertable to convertible **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents 1e1040b5 ce4c793b
...@@ -28,8 +28,7 @@ import ( ...@@ -28,8 +28,7 @@ import (
// object. (Will modify internalObject.) (Assumes JSON serialization.) // object. (Will modify internalObject.) (Assumes JSON serialization.)
// TODO: verify that the correct external version is chosen on encode... // TODO: verify that the correct external version is chosen on encode...
func CheckCodec(c Codec, internalType Object, externalTypes ...schema.GroupVersionKind) error { func CheckCodec(c Codec, internalType Object, externalTypes ...schema.GroupVersionKind) error {
_, err := Encode(c, internalType) if _, err := Encode(c, internalType); err != nil {
if err != nil {
return fmt.Errorf("Internal type not encodable: %v", err) return fmt.Errorf("Internal type not encodable: %v", err)
} }
for _, et := range externalTypes { for _, et := range externalTypes {
...@@ -41,9 +40,8 @@ func CheckCodec(c Codec, internalType Object, externalTypes ...schema.GroupVersi ...@@ -41,9 +40,8 @@ func CheckCodec(c Codec, internalType Object, externalTypes ...schema.GroupVersi
if reflect.TypeOf(obj) != reflect.TypeOf(internalType) { if reflect.TypeOf(obj) != reflect.TypeOf(internalType) {
return fmt.Errorf("decode of external type %s produced: %#v", et, obj) return fmt.Errorf("decode of external type %s produced: %#v", et, obj)
} }
err = DecodeInto(c, exBytes, internalType) if err = DecodeInto(c, exBytes, internalType); err != nil {
if err != nil { return fmt.Errorf("external type %s not convertible to internal type: %v", et, err)
return fmt.Errorf("external type %s not convertable to internal type: %v", et, err)
} }
} }
return nil return nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment