MCPcopy Index your code
hub / github.com/coder/coder / BaggageToContext

Function BaggageToContext

coderd/audit/request.go:595–612  ·  view source on GitHub ↗
(ctx context.Context, d Baggage)

Source from the content-addressed store, hash-verified

593}
594
595func BaggageToContext(ctx context.Context, d Baggage) (context.Context, error) {
596 props, err := d.Props()
597 if err != nil {
598 return ctx, xerrors.Errorf("create baggage properties: %w", err)
599 }
600
601 m, err := baggage.NewMember("audit", "baggage", props...)
602 if err != nil {
603 return ctx, xerrors.Errorf("create new baggage member: %w", err)
604 }
605
606 b, err := baggage.New(m)
607 if err != nil {
608 return ctx, xerrors.Errorf("create new baggage carrier: %w", err)
609 }
610
611 return baggage.ContextWithBaggage(ctx, b), nil
612}
613
614func BaggageFromContext(ctx context.Context) WorkspaceBuildBaggage {
615 d := WorkspaceBuildBaggage{}

Callers 2

TestBaggageFunction · 0.92
BuildMethod · 0.92

Calls 3

PropsMethod · 0.65
NewMethod · 0.65
ErrorfMethod · 0.45

Tested by 1

TestBaggageFunction · 0.74