MCPcopy Create free account
hub / github.com/bufbuild/buf / GetDirOrProtoFileRef

Method GetDirOrProtoFileRef

private/buf/buffetch/ref_parser.go:436–452  ·  view source on GitHub ↗
(
	ctx context.Context,
	value string,
)

Source from the content-addressed store, hash-verified

434}
435
436func (a *refParser) GetDirOrProtoFileRef(
437 ctx context.Context,
438 value string,
439) (DirOrProtoFileRef, error) {
440 parsedRef, err := a.getParsedRef(ctx, value, dirOrProtoFileFormats)
441 if err != nil {
442 return nil, err
443 }
444 switch t := parsedRef.(type) {
445 case internal.ParsedDirRef:
446 return newDirRef(t), nil
447 case internal.ProtoFileRef:
448 return newProtoFileRef(t), nil
449 default:
450 return nil, fmt.Errorf("invalid ParsedRef type: %T", parsedRef)
451 }
452}
453
454func (a *refParser) GetDirOrProtoFileRefForInputConfig(
455 ctx context.Context,

Callers

nothing calls this directly

Calls 3

getParsedRefMethod · 0.95
newDirRefFunction · 0.70
newProtoFileRefFunction · 0.70

Tested by

no test coverage detected