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)
| 78 | // |
| 79 | // Returns an error of type *bufparse.ParseError if the string could not be parsed. |
| 80 | func 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 | // |
no test coverage detected
searching dependent graphs…