
FIXED: * `envs/funcs.go:78:3: unknown field IgnoreWhiteSpace in struct literal of type EnvErrNoVal, but does have IgnoreWhitespace` * `envs/funcs_enverrnoval.go:15:8: sb.WasFound undefined (type *strings.Builder has no field or method WasFound)`
28 lines
501 B
Go
28 lines
501 B
Go
package envs
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// Error conforms to a stdlib error interface.
|
|
func (e *EnvErrNoVal) Error() (errStr string) {
|
|
|
|
var sb *strings.Builder = new(strings.Builder)
|
|
|
|
sb.WriteString("the variable '")
|
|
sb.WriteString(e.VarName)
|
|
sb.WriteString("' was ")
|
|
if e.WasFound {
|
|
sb.WriteString("found")
|
|
} else {
|
|
sb.WriteString("not found")
|
|
}
|
|
if e.WasRequiredNonEmpty && e.WasFound {
|
|
sb.WriteString(" but is empty and was required to be non-empty")
|
|
}
|
|
|
|
errStr = sb.String()
|
|
|
|
return
|
|
}
|