• Gustavo Niemeyer's avatar
    exp/template: don't panic on range of nil interface · e3f3a541
    Gustavo Niemeyer authored
    This avoids a non-obvious panic when range is used on a
    nil interface, and fixes it by behaving as if the range
    was empty.
    
    The new behavior is equivalent to the outcome of iterating
    on a nil map or slice, and is useful because it allows
    generic structures such as used in json (map[string]interface{})
    to behave correctly if a key generally set to a list or map
    isn't present.
    
    R=golang-dev, r, gustavo
    CC=golang-dev
    https://golang.org/cl/4876046
    e3f3a541
exec.go 19.4 KB