MCPcopy Create free account
hub / github.com/php/frankenphp / uniqueID

Function uniqueID

caddy/hotreload.go:91–104  ·  view source on GitHub ↗
(s any)

Source from the content-addressed store, hash-verified

89}
90
91func uniqueID(s any) (string, error) {
92 var b bytes.Buffer
93
94 if err := gob.NewEncoder(&b).Encode(s); err != nil {
95 return "", fmt.Errorf("unable to generate unique name: %w", err)
96 }
97
98 h := fnv.New64a()
99 if _, err := h.Write(b.Bytes()); err != nil {
100 return "", fmt.Errorf("unable to generate unique name: %w", err)
101 }
102
103 return fmt.Sprintf("%016x", h.Sum64()), nil
104}

Callers 1

configureHotReloadMethod · 0.85

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected