• jimmyfrasche's avatar
    flag: correct zero values when printing defaults · 3c588b3f
    jimmyfrasche authored
    When the flag package first begin printing nonzero defaults, the test
    was against a fixed set of string representations of zero values.
    This worked until the string representation of a time.Duration
    changed from "0" to "0s", causing the zero Duration to register as
    nonzero. The flag package then added reflect-based code that fell back
    to the old test. This failed to work when a nonzero default for a flag
    happened to be the string representation of one the original fixed set
    of zero values in the original test. This change removes the original
    test, allowing the reflect-based code to be the only deciding factor.
    
    Fixes #23543
    
    Change-Id: I582ce554d6729e336fdd96fb27340674c15350d8
    Reviewed-on: https://go-review.googlesource.com/103867Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    3c588b3f
flag.go 32.7 KB