github.com/octohelm/cuemod@v0.9.4/pkg/cueify/golang/group_version.go (about)

     1  package golang
     2  
     3  import (
     4  	"context"
     5  
     6  	"k8s.io/apimachinery/pkg/runtime/schema"
     7  )
     8  
     9  type contextGroupVersionKind struct {
    10  }
    11  
    12  func groupVersionKindFromContext(ctx context.Context) *schema.GroupVersionKind {
    13  	if i, ok := ctx.Value(contextGroupVersionKind{}).(*schema.GroupVersionKind); ok {
    14  		return i
    15  	}
    16  	return nil
    17  }
    18  
    19  func withGroupVersionKind(ctx context.Context, i *schema.GroupVersionKind) context.Context {
    20  	return context.WithValue(ctx, contextGroupVersionKind{}, i)
    21  }