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

Function newRefParser

private/buf/buffetch/ref_parser.go:38–90  ·  view source on GitHub ↗
(logger *slog.Logger)

Source from the content-addressed store, hash-verified

36}
37
38func newRefParser(logger *slog.Logger) *refParser {
39 return &refParser{
40 logger: logger,
41 fetchRefParser: internal.NewRefParser(
42 logger,
43 internal.WithRawRefProcessor(processRawRef),
44 internal.WithSingleFormat(formatBin),
45 internal.WithSingleFormat(formatBinpb),
46 internal.WithSingleFormat(
47 formatJSON,
48 internal.WithSingleCustomOptionKey(useProtoNamesKey),
49 internal.WithSingleCustomOptionKey(useEnumNumbersKey),
50 ),
51 internal.WithSingleFormat(formatTxtpb),
52 internal.WithSingleFormat(
53 formatYAML,
54 internal.WithSingleCustomOptionKey(useProtoNamesKey),
55 internal.WithSingleCustomOptionKey(useEnumNumbersKey),
56 ),
57 internal.WithSingleFormat(
58 formatBingz,
59 internal.WithSingleDefaultCompressionType(
60 internal.CompressionTypeGzip,
61 ),
62 ),
63 internal.WithSingleFormat(
64 formatJSONGZ,
65 internal.WithSingleDefaultCompressionType(
66 internal.CompressionTypeGzip,
67 ),
68 ),
69 internal.WithArchiveFormat(
70 formatTar,
71 internal.ArchiveTypeTar,
72 ),
73 internal.WithArchiveFormat(
74 formatTargz,
75 internal.ArchiveTypeTar,
76 internal.WithArchiveDefaultCompressionType(
77 internal.CompressionTypeGzip,
78 ),
79 ),
80 internal.WithArchiveFormat(
81 formatZip,
82 internal.ArchiveTypeZip,
83 ),
84 internal.WithGitFormat(formatGit),
85 internal.WithDirFormat(formatDir),
86 internal.WithModuleFormat(formatMod),
87 internal.WithProtoFileFormat(formatProtoFile),
88 ),
89 }
90}
91
92func newMessageRefParser(logger *slog.Logger, options ...MessageRefParserOption) *refParser {
93 messageRefParserOptions := newMessageRefParserOptions()

Callers 3

testRoundTripLocalFileFunction · 0.70
NewRefParserFunction · 0.70
testGetParsedRefFunction · 0.70

Calls 11

NewRefParserFunction · 0.92
WithRawRefProcessorFunction · 0.92
WithSingleFormatFunction · 0.92
WithArchiveFormatFunction · 0.92
WithGitFormatFunction · 0.92
WithDirFormatFunction · 0.92
WithModuleFormatFunction · 0.92
WithProtoFileFormatFunction · 0.92

Tested by 2

testRoundTripLocalFileFunction · 0.56
testGetParsedRefFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…