0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2025-01-06 22:40:31 -05:00

diagnostics: Persist UUID in string format for convenience

This commit is contained in:
Matthew Holt 2018-02-10 20:21:16 -07:00
parent 6b3c2212a1
commit 5820356cf6
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5

View file

@ -296,7 +296,7 @@ func initDiagnostics() {
newUUID := func() uuid.UUID {
id := uuid.New()
err := ioutil.WriteFile(uuidFilename, id[:], 0644)
err := ioutil.WriteFile(uuidFilename, []byte(id.String()), 0644) // human-readable this way
if err != nil {
log.Printf("[ERROR] Persisting instance UUID: %v", err)
}
@ -319,7 +319,7 @@ func initDiagnostics() {
log.Printf("[ERROR] Reading persistent UUID: %v", err)
id = newUUID()
} else {
id, err = uuid.FromBytes(uuidBytes)
id, err = uuid.ParseBytes(uuidBytes)
if err != nil {
log.Printf("[ERROR] Parsing UUID: %v", err)
id = newUUID()