Make uuid.Nil and other values as a constant
xorcare opened this issue · comments
Vasiliy Vasilyuk commented
Hello! I suggest to make uuid.Nil and other global uuids as constant to avoid modification at runtime.
One example of a problem I look in practice:
err = rows.Scan(
&uuid.Nil, // for group by only
//...
)
Such a seemingly innocuous change modifies the value of the uuid.Nil variable, and breaks the comparison.
var uid uuid.UUID
if uid == uuid.Nil {
// This condition doesn't work.
}
Vasiliy Vasilyuk commented
Unfortunately there is no way to make a constant from an array, and my suggestion is meaningless. My mistake, sorry. 🥲