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

Function ModuleKeyToCommitKey

private/bufpkg/bufmodule/module_key.go:106–112  ·  view source on GitHub ↗

ModuleKeyToCommitKey converts a ModuleKey to a CommitKey. This is purely lossy - a ModuleKey has more information than a CommitKey, and a CommitKey does not have any information that a ModuleKey does not have.

(moduleKey ModuleKey)

Source from the content-addressed store, hash-verified

104// This is purely lossy - a ModuleKey has more information than a CommitKey, and a
105// CommitKey does not have any information that a ModuleKey does not have.
106func ModuleKeyToCommitKey(moduleKey ModuleKey) (CommitKey, error) {
107 digest, err := moduleKey.Digest()
108 if err != nil {
109 return nil, err
110 }
111 return newCommitKey(moduleKey.FullName().Registry(), moduleKey.CommitID(), digest.Type())
112}
113
114// *** PRIVATE ***
115

Callers 3

putCommitMethod · 0.92

Calls 6

newCommitKeyFunction · 0.85
DigestMethod · 0.65
RegistryMethod · 0.65
FullNameMethod · 0.65
CommitIDMethod · 0.65
TypeMethod · 0.65

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…