commitUUID returns the buf-style 32-character dashless UUID for a git commit SHA. The buf CLI (v1.32+) validates the commit id with uuidutil.FromDashless, which requires exactly 32 hex characters and rejects anything else — including a raw 40-char git SHA — with "expected dashless uuid to be of leng
(gitSHA string)
| 31 | // next. A random UUID per call would force the client to re-resolve on |
| 32 | // every restart and break foreign-id caching in buf.lock. |
| 33 | func commitUUID(gitSHA string) string { |
| 34 | if gitSHA == "" { |
| 35 | return "" |
| 36 | } |
| 37 | sum := sha256.Sum256([]byte(gitSHA)) |
| 38 | var uuid [16]byte |
| 39 | copy(uuid[:], sum[:16]) |
| 40 | // Set version 4 (random) in the high nibble of byte 6. |
| 41 | uuid[6] = (uuid[6] & 0x0f) | 0x40 |
| 42 | // Set variant RFC 4122 in the high two bits of byte 8. |
| 43 | uuid[8] = (uuid[8] & 0x3f) | 0x80 |
| 44 | return hex.EncodeToString(uuid[:]) |
| 45 | } |
| 46 | |
| 47 | func parseResourceRefs(msg []byte) []moduleRef { |
| 48 | var refs []moduleRef |
no outgoing calls