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

Method GetRefForInputConfig

private/buf/buffetch/ref_parser.go:252–280  ·  view source on GitHub ↗
(
	ctx context.Context,
	inputConfig bufconfig.InputConfig,
)

Source from the content-addressed store, hash-verified

250}
251
252func (a *refParser) GetRefForInputConfig(
253 ctx context.Context,
254 inputConfig bufconfig.InputConfig,
255) (Ref, error) {
256 parsedRef, err := a.getParsedRefForInputConfig(ctx, inputConfig, allFormats)
257 if err != nil {
258 return nil, err
259 }
260 switch t := parsedRef.(type) {
261 case internal.ParsedSingleRef:
262 messageEncoding, err := parseMessageEncoding(t.Format())
263 if err != nil {
264 return nil, err
265 }
266 return newMessageRef(t, messageEncoding)
267 case internal.ParsedArchiveRef:
268 return newSourceRef(t), nil
269 case internal.ParsedDirRef:
270 return newDirRef(t), nil
271 case internal.ParsedGitRef:
272 return newSourceRef(t), nil
273 case internal.ParsedModuleRef:
274 return newModuleRef(t), nil
275 case internal.ProtoFileRef:
276 return newProtoFileRef(t), nil
277 default:
278 return nil, fmt.Errorf("unknown ParsedRef type: %T", parsedRef)
279 }
280}
281
282func (a *refParser) GetSourceOrModuleRef(
283 ctx context.Context,

Callers

nothing calls this directly

Calls 8

parseMessageEncodingFunction · 0.85
newMessageRefFunction · 0.85
newSourceRefFunction · 0.85
newDirRefFunction · 0.70
newModuleRefFunction · 0.70
newProtoFileRefFunction · 0.70
FormatMethod · 0.65

Tested by

no test coverage detected