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

Method GetRef

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

Source from the content-addressed store, hash-verified

220}
221
222func (a *refParser) GetRef(
223 ctx context.Context,
224 value string,
225) (Ref, error) {
226 parsedRef, err := a.getParsedRef(ctx, value, allFormats)
227 if err != nil {
228 return nil, err
229 }
230 switch t := parsedRef.(type) {
231 case internal.ParsedSingleRef:
232 messageEncoding, err := parseMessageEncoding(t.Format())
233 if err != nil {
234 return nil, err
235 }
236 return newMessageRef(t, messageEncoding)
237 case internal.ParsedArchiveRef:
238 return newSourceRef(t), nil
239 case internal.ParsedDirRef:
240 return newDirRef(t), nil
241 case internal.ParsedGitRef:
242 return newSourceRef(t), nil
243 case internal.ParsedModuleRef:
244 return newModuleRef(t), nil
245 case internal.ProtoFileRef:
246 return newProtoFileRef(t), nil
247 default:
248 return nil, fmt.Errorf("unknown ParsedRef type: %T", parsedRef)
249 }
250}
251
252func (a *refParser) GetRefForInputConfig(
253 ctx context.Context,

Callers

nothing calls this directly

Calls 8

getParsedRefMethod · 0.95
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