cmd/icingadb-migrate: replace magic number 20 with sha1.Size

This commit is contained in:
Alexander A. Klimov 2024-07-09 14:56:26 +02:00 committed by alvar
parent b7483eb6f8
commit b6839ce9f0

View file

@ -2,6 +2,7 @@ package main
import (
"context"
"crypto/sha1"
"database/sql"
_ "embed"
"encoding/hex"
@ -71,8 +72,8 @@ func main() {
_, _ = fmt.Fprintf(os.Stderr, "bad env ID: %s\n", err.Error())
os.Exit(2)
}
if len(envId) != 20 {
_, _ = fmt.Fprintf(os.Stderr, "bad env ID: must be 20 bytes long, has %d bytes\n", len(envId))
if len(envId) != sha1.Size {
_, _ = fmt.Fprintf(os.Stderr, "bad env ID: must be %d bytes long, has %d bytes\n", sha1.Size, len(envId))
os.Exit(2)
}