From 90e2dcfe7b92223221a44b2fc16ade64de09f2c9 Mon Sep 17 00:00:00 2001 From: Matt Moore Date: Fri, 19 Nov 2021 16:35:22 -0800 Subject: [PATCH] Prune a few dependencies from ./pkg/oci (#1085) Signed-off-by: Matt Moore --- pkg/oci/static/options.go | 5 +++-- pkg/oci/static/signature.go | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pkg/oci/static/options.go b/pkg/oci/static/options.go index 9220c06b63e..4e067173d8b 100644 --- a/pkg/oci/static/options.go +++ b/pkg/oci/static/options.go @@ -16,7 +16,8 @@ package static import ( - "github.com/go-openapi/swag" + "encoding/json" + "github.com/google/go-containerregistry/pkg/v1/types" "github.com/sigstore/cosign/pkg/oci" ctypes "github.com/sigstore/cosign/pkg/types" @@ -51,7 +52,7 @@ func makeOptions(opts ...Option) (*options, error) { } if o.Bundle != nil { - b, err := swag.WriteJSON(o.Bundle) + b, err := json.Marshal(o.Bundle) if err != nil { return nil, err } diff --git a/pkg/oci/static/signature.go b/pkg/oci/static/signature.go index 3fd0602ae57..b987869754e 100644 --- a/pkg/oci/static/signature.go +++ b/pkg/oci/static/signature.go @@ -24,7 +24,6 @@ import ( "github.com/google/go-containerregistry/pkg/v1/types" "github.com/sigstore/cosign/pkg/oci" "github.com/sigstore/sigstore/pkg/cryptoutils" - "knative.dev/pkg/kmeta" ) const ( @@ -66,9 +65,12 @@ var _ oci.Signature = (*staticLayer)(nil) // Annotations implements oci.Signature func (l *staticLayer) Annotations() (map[string]string, error) { - return kmeta.UnionMaps(l.opts.Annotations, map[string]string{ - SignatureAnnotationKey: l.b64sig, - }), nil + m := make(map[string]string, len(l.opts.Annotations)+1) + for k, v := range l.opts.Annotations { + m[k] = v + } + m[SignatureAnnotationKey] = l.b64sig + return m, nil } // Payload implements oci.Signature