MCPcopy Create free account
hub / github.com/opencontainers/go-digest / Set

Method Set

algorithm.go:91–104  ·  view source on GitHub ↗

Set implemented to allow use of Algorithm as a command line flag.

(value string)

Source from the content-addressed store, hash-verified

89
90// Set implemented to allow use of Algorithm as a command line flag.
91func (a *Algorithm) Set(value string) error {
92 if value == "" {
93 *a = Canonical
94 } else {
95 // just do a type conversion, support is queried with Available.
96 *a = Algorithm(value)
97 }
98
99 if !a.Available() {
100 return ErrDigestUnsupported
101 }
102
103 return nil
104}
105
106// Digester returns a new digester for the specified algorithm. If the algorithm
107// does not have a digester implementation, nil will be returned. This can be

Callers

nothing calls this directly

Calls 2

AvailableMethod · 0.95
AlgorithmTypeAlias · 0.85

Tested by

no test coverage detected