Skip to content

wtertius/dumper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dumper - simple data printer

Why?

For example, we have simple structure

type t struct {
	f1 int
	f2 *t
}

and variable of type *t

v := &t{
	f1: 1,
	f2: &t{
		f1: 2,
	},
}
v.f2.f2 = v //cycle

###Task: Save dump of v to log file Ways: ######1. fmt - no information about field f2, only address:

fmt.FPrintf(w, "%#v\n", v) //&t{f1:1, f2:(*t)(0xc20800a270)}

######2. JSON - all fields private, JSON prints {} ######3. dumper

fmt.Printf("%s\n", dumper.DumpToString(v)) //&(0xc20800a260)t{f1:int(1),f2:&(0xc20800a270)t{f1:int(2),f2:t(&(0xc20800a260))}}

##Description dumper doesn't produce valid Go code

##How to install go get github.com/sergei-svistunov/dumper

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 84.2%
  • Yacc 15.8%