Hey axel, Thanks for the reply, but unfortunately not. Because that is going to simply print pointer values out. I want it to unwind all of that (and handle the difficulty of recursive references). I want to be able to take what is printed and simply paste it into a file assigned to a variable, add the needed imports and have it compile.
On Monday, August 15, 2022 at 7:34:08 AM UTC-7 axel.wa...@googlemail.com wrote: > Does fmt.Printf("%#v", v) do what you want? > > On Mon, Aug 15, 2022 at 4:27 PM John <johns...@gmail.com> wrote: > >> I know we have plenty of pretty printing out there, but i'm looking for a >> package that can print the Go representation of a Struct out to screen. >> >> So given: >> >> var x := &myStruct{ >> A: "hello" >> } >> >> someLib.Print(x) >> >> I get: >> >> &myStruct{ >> A: "hello" >> } >> >> I'm sure someone has used reflection to do this and figured out how they >> want to deal with recursive pointers, so don't want to go recreate the >> wheel here. >> >> Thanks. >> >> >> -- >> 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...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/f4fa3f7b-318e-407b-96ef-16102db1e037n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/golang-nuts/f4fa3f7b-318e-407b-96ef-16102db1e037n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/2029ba81-dbf5-44c2-ac9f-228dcb7837f4n%40googlegroups.com.