Addition of 'LvlDiscard Lvl = -1' at beginning of const block in commit e699254142 caused the iota assigned values of LvlCrit through LvlTrace to change from 0 to 5 to 1 to 6. (#815)

This restores the original enumerated const values by moving LvlDiscard after all the iota assigned constants.
Usage of auto-increment enumerations does not work the same way in golang as it does in C/C++ and its behaviour is detailed in the link below.
https://go.dev/ref/spec#Iota
This commit is contained in:
Kristofer Peterson 2023-05-11 07:37:29 +01:00 committed by GitHub
parent b6de7aaf17
commit 3274b3bce7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,13 +18,13 @@ const skipLevel = 2
type Lvl int
const (
LvlDiscard Lvl = -1
LvlCrit Lvl = iota
LvlCrit Lvl = iota
LvlError
LvlWarn
LvlInfo
LvlDebug
LvlTrace
LvlDiscard Lvl = -1
)
// AlignedString returns a 5-character string containing the name of a Lvl.