Ugorji Nwoke fd33a05832 codec/codecgen: added copyright info 5 anos atrás
..
README.md ee524d388a Add -nr flag to exclude types from code-generation 8 anos atrás
gen.go e72634d4d3 codecgen: expand documentation and exec command from same dir as input/output files 6 anos atrás
goversion_pkgpath_gte_go111.go ed9a3b5f07 codecgen: add support for go1.11 modules (#266) 6 anos atrás
goversion_pkgpath_lt_go111.go ed9a3b5f07 codecgen: add support for go1.11 modules (#266) 6 anos atrás
z.go fd33a05832 codec/codecgen: added copyright info 5 anos atrás

README.md

codecgen tool

Generate is given a list of *.go files to parse, and an output file (fout), codecgen will create an output file file.go which contains codec.Selfer implementations for the named types found in the files parsed.

Using codecgen is very straightforward.

Download and install the tool

go get -u github.com/ugorji/go/codec/codecgen

Run the tool on your files

The command line format is:

codecgen [options] (-o outfile) (infile ...)

% codecgen -?
Usage of codecgen:
  -c="github.com/ugorji/go/codec": codec path
  -o="": out file
  -r=".*": regex for type name to match
  -nr="": regex for type name to exclude
  -rt="": tags for go run
  -t="": build tag to put in file
  -u=false: Use unsafe, e.g. to avoid unnecessary allocation on []byte->string
  -x=false: keep temp file

% codecgen -o values_codecgen.go values.go values2.go moretypedefs.go

Please see the blog article for more information on how to use the tool.