Repository navigation
Bug fix release. Three fixes, no new features, no API change.
A separator you chose was silently replaced
Regression from v0.3.0. Making the default separator collapse repeats was implemented as "route the value through strings.Fields whenever the separator looks like whitespace", which threw away a separator you deliberately set:
e := ecp.New()
e.Advance.SplitChar = "\t"
// value "a b\tc d"
// v0.2.5: ["a b" "c d"] correct
// v0.3.0: ["a" "b" "c" "d"] wrong
// v0.3.1: ["a b" "c d"] correct againOnly the default separator collapses repeats now, and it does so by dropping empty elements instead of re-splitting — so a tab inside an element is no longer treated as a separator either.
An optional section explicitly set to zero stayed nil
Pointer sections, new in v0.3.0, were allocated when the filled-in value came out non-zero. That cannot tell "nothing was said about this section" from "every value in it is zero":
P_PORT=0 -> cfg.P == nil // explicitly asked for, silently dropped
It also left List and Get disagreeing: List advertised P_PORT, and Get answered key not found for it.
The walk now tracks whether a field was actually assigned, from the environment or from a default tag, and allocates on that. This matches what a scalar pointer has always done — *int with default:"0" gives you &0, not nil.
A section nothing was said about still stays nil.
Errors blamed the wrong part of the value
Present in every earlier version. A value that merely contained an e was reported as a failure to parse the fragment after it:
| value | before | after |
|---|---|---|
not-a-number |
strconv.Atoi: parsing "r" |
strconv.ParseInt: parsing "not-a-number" |
hello |
strconv.Atoi: parsing "llo" |
strconv.ParseInt: parsing "hello" |
A non-numeric exponent means the value is not scientific notation at all, so it is reported whole. 1e, 1e1e1e and 1e-3 still error, and errors.As still unwraps to *strconv.NumError.
Upgrading
Drop-in from v0.3.0. The only behaviour that changes is the three bugs above.