• Rob Pike's avatar
    fmt: catch panics from calls to String etc. · 97a929aa
    Rob Pike authored
    This change causes Print et al. to catch panics generated by
    calls to String, GoString, and Format.  The panic is formatted
    into the output stream as an error, but the program continues.
    As a special case, if the argument was a nil pointer, the
    result is just "<nil>", because that's almost certainly enough
    information and handles the very common case of String
    methods that don't guard against nil.
    
    Scan does not want this change. Input must work; output can
    be for debugging and it's nice to get output even when you
    make a mistake.
    
    R=dsymonds, r, adg, gri, rsc, gri
    CC=golang-dev
    https://golang.org/cl/4640043
    97a929aa
fmt_test.go 18.9 KB