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

Function WithSingleFormat

private/buf/buffetch/internal/internal.go:597–609  ·  view source on GitHub ↗

WithSingleFormat attaches the given format as a single format. It is up to the user to not incorrectly attached a format twice.

(format string, options ...SingleFormatOption)

Source from the content-addressed store, hash-verified

595//
596// It is up to the user to not incorrectly attached a format twice.
597func WithSingleFormat(format string, options ...SingleFormatOption) RefParserOption {
598 return func(refParser *refParser) {
599 format = normalizeFormat(format)
600 if format == "" {
601 return
602 }
603 singleFormatInfo := newSingleFormatInfo()
604 for _, option := range options {
605 option(singleFormatInfo)
606 }
607 refParser.singleFormatToInfo[format] = singleFormatInfo
608 }
609}
610
611// WithArchiveFormat attaches the given format as an archive format.
612//

Callers 2

newRefParserFunction · 0.92
newMessageRefParserFunction · 0.92

Calls 3

normalizeFormatFunction · 0.85
newSingleFormatInfoFunction · 0.85
optionStruct · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…