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

Function ParseDigestType

private/bufpkg/bufmodule/digest.go:80–90  ·  view source on GitHub ↗

ParseDigestType parses a DigestType from its string representation. This reverses DigestType.String(). Returns an error of type *bufparse.ParseError if the string could not be parsed.

(s string)

Source from the content-addressed store, hash-verified

78//
79// Returns an error of type *bufparse.ParseError if the string could not be parsed.
80func ParseDigestType(s string) (DigestType, error) {
81 d, ok := stringToDigestType[s]
82 if !ok {
83 return 0, bufparse.NewParseError(
84 "module digest type",
85 s,
86 fmt.Errorf("unknown type: %q", s),
87 )
88 }
89 return d, nil
90}
91
92// Digest is a digest of some content.
93//

Callers 2

runFunction · 0.92
ParseDigestFunction · 0.70

Calls 1

NewParseErrorFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…