Update typeurl to v2.2.2

Fixes panic when typeurl is not found

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan 2024-11-04 22:29:24 -08:00
parent 18caa33fdc
commit ff09b428e1
No known key found for this signature in database
GPG Key ID: F58C5D0A4405ACDB
4 changed files with 10 additions and 12 deletions

2
go.mod
View File

@ -27,7 +27,7 @@ require (
github.com/containerd/platforms v1.0.0-rc.0
github.com/containerd/plugin v1.0.0
github.com/containerd/ttrpc v1.2.6
github.com/containerd/typeurl/v2 v2.2.1
github.com/containerd/typeurl/v2 v2.2.2
github.com/containerd/zfs/v2 v2.0.0-rc.0
github.com/containernetworking/cni v1.2.3
github.com/containernetworking/plugins v1.5.1

4
go.sum
View File

@ -698,8 +698,8 @@ github.com/containerd/plugin v1.0.0/go.mod h1:hQfJe5nmWfImiqT1q8Si3jLv3ynMUIBB47
github.com/containerd/ttrpc v1.2.2/go.mod h1:sIT6l32Ph/H9cvnJsfXM5drIVzTr5A2flTf1G5tYZak=
github.com/containerd/ttrpc v1.2.6 h1:zG+Kn5EZ6MUYCS1t2Hmt2J4tMVaLSFEJVOraDQwNPC4=
github.com/containerd/ttrpc v1.2.6/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQrAbN1q9o=
github.com/containerd/typeurl/v2 v2.2.1 h1:/X1Kgcz4sKS/NTKQvvRS0pEVpUYqmPTwGQontm9pl0w=
github.com/containerd/typeurl/v2 v2.2.1/go.mod h1:95ljDnPfD3bAbDJRugOiShd/DlAAsxGtUBhJxIn7SCk=
github.com/containerd/typeurl/v2 v2.2.2 h1:3jN/k2ysKuPCsln5Qv8bzR9cxal8XjkxPogJfSNO31k=
github.com/containerd/typeurl/v2 v2.2.2/go.mod h1:95ljDnPfD3bAbDJRugOiShd/DlAAsxGtUBhJxIn7SCk=
github.com/containerd/zfs/v2 v2.0.0-rc.0 h1:0dRlgpoaepW7HuovtcvYQMF7NlpceQVdn7+3Udeth4M=
github.com/containerd/zfs/v2 v2.0.0-rc.0/go.mod h1:g36g/XCEGDRxUXIFdM3oWAEvmTvhfz/eKWElqg4Secw=
github.com/containernetworking/cni v1.2.3 h1:hhOcjNVUQTnzdRJ6alC5XF+wd9mfGIUaj8FuJbEslXM=

View File

@ -284,16 +284,14 @@ func getTypeByUrl(url string) (reflect.Type, error) {
mu.RUnlock()
mt, err := protoregistry.GlobalTypes.FindMessageByURL(url)
if err != nil {
e := protoregistry.NotFound
if !errors.Is(err, e) {
return nil, fmt.Errorf("type with url %s: %w", url, ErrNotFound)
}
for _, h := range handlers {
if t := h.GetType(url); t != nil {
return t, nil
if errors.Is(err, protoregistry.NotFound) {
for _, h := range handlers {
if t := h.GetType(url); t != nil {
return t, nil
}
}
}
return nil, fmt.Errorf("type with url %s: %w", url, ErrNotFound)
}
empty := mt.New().Interface()
return reflect.TypeOf(empty).Elem(), nil

2
vendor/modules.txt vendored
View File

@ -194,7 +194,7 @@ github.com/containerd/plugin/registry
# github.com/containerd/ttrpc v1.2.6
## explicit; go 1.19
github.com/containerd/ttrpc
# github.com/containerd/typeurl/v2 v2.2.1
# github.com/containerd/typeurl/v2 v2.2.2
## explicit; go 1.21
github.com/containerd/typeurl/v2
# github.com/containerd/zfs/v2 v2.0.0-rc.0