I was surprised to see Printf %v panic on a struct that %#v prints fine. Is 
this expected / intentional / as designed?

Test case:
package main

import (
"fmt"
)

type MyError struct{ error }

func main() {
err := MyError{}
fmt.Printf("%%#v %#v\n", err)
fmt.Printf("%%+v %+v\n", err)
fmt.Printf("%%v %v\n", err)
}

Output:

%#v main.MyError{error:error(nil)}
%+v %!v(PANIC=runtime error: invalid memory address or nil pointer dereference)
%v %!v(PANIC=runtime error: invalid memory address or nil pointer dereference)


Playground: https://play.golang.org/p/B5FeWMryN0

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to