M0109 switch misses cases
A switch on an enum-like type (a defined integer or string type with package level constants of that type) does not handle every constant, or a type switch on a sealed interface (one with an unexported method, so only its package implements it) does not handle every implementation, and there is no default clause.
A value added to the enum later then goes unnoticed.
The mistake and the fix
type Color int
const (Red Color = iota; Green; Blue)
switch c {
case Red, Green:
}switch c {
case Red, Green:
case Blue:
// handled, or nothing to do
}The fix
Handle the missing values, add a default clause, or write //exhaustive:ignore on the line before the switch. marmot fix adds the missing cases with empty bodies, which keeps the behavior.
See also all error codes and marmot explain.
M0108 unreachable function
No path from main or a test reaches the function, so it is dead code.
M0110 possible nil dereference
A pointer is dereferenced, or a map written to, where it can be nil: it is nil on one path into the use (var p *T; if c { p = &T{} }; p.f), or it comes from a function that returns nil with a nil error (or with ok true), in this package or another.