go - Printing all values of a struct with mixed values? -


is there way of printing struct mixed value types, including pointer types, such value shown? example:

package main  import (     "fmt" )  type test struct {   str string   ptr *string }  func main() {   s := "some string"   p := &s    t := test{      str: s,      ptr: p,   }    fmt.printf("%#v\n", t) } 

i want like: main.test{str:"some string", ptr:(*string)("some string"}
instead of: main.test{str:"some string", ptr:(*string)(0x1040a120)}

https://play.golang.org/p/ykzrpoeq_y

there's no fmt verb use functionality. implement stringer on struct , have full control on how struct printed.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -