README.md
1# codecgen tool
2
3Generate is given a list of *.go files to parse, and an output file (fout),
4codecgen will create an output file __file.go__ which
5contains `codec.Selfer` implementations for the named types found
6in the files parsed.
7
8Using codecgen is very straightforward.
9
10**Download and install the tool**
11
12`go get -u github.com/ugorji/go/codec/codecgen`
13
14**Run the tool on your files**
15
16The command line format is:
17
18`codecgen [options] (-o outfile) (infile ...)`
19
20```sh
21% codecgen -?
22Usage of codecgen:
23 -c="github.com/ugorji/go/codec": codec path
24 -o="": out file
25 -d="": random identifier for use in generated code (help reduce changes when files are regenerated)
26 -nx=false: do not support extensions (use when you know no extensions are used)
27 -r=".*": regex for type name to match
28 -nr="": regex for type name to exclude
29 -rt="": tags for go run
30 -st="codec,json": struct tag keys to introspect
31 -t="": build tag to put in file
32 -u=false: Use unsafe, e.g. to avoid unnecessary allocation on []byte->string
33 -x=false: keep temp file
34
35% codecgen -o values_codecgen.go values.go values2.go moretypedefs.go
36```
37
38**Limitations**
39
40codecgen doesn't support the following:
41
42- Canonical option.
43 This has not been implemented.
44- MissingFielder implementation.
45 If a type implements MissingFielder, it is completely ignored by codecgen.
46- CheckCircularReference.
47 When encoding, if a circular reference is encountered, it will cause a stack overflow.
48 Only use codecgen on types that you know do have circular references.
49
50**More Information**
51
52Please see the [blog article](http://ugorji.net/blog/go-codecgen)
53for more information on how to use the tool.
54
55