simple golang go:generate code generator
go get github.com/dbreedt/gener8
skip_format: skip gofmt being run on the generated file
trace : enables trace logging
in : file to parse
out : file to write the generated code to
pkg : the value to replace $pkg with
kws : csv list of values to replace $kwn tokens with
Create a file with markers
- $pkg
- $kwn where n is a numeric value starting from 1
Then add a go:generate comment to your codebase
//go:generate gener8 -in=make.me -out=made.go -pkg=made -kws=test,tPtr
or just run it from the cmdline:
gener8 -in=make.me -out=made.go -pkg=made -kws=test,tPtr
In these examples $kw1
will be replaced with test
and $kw2
will be replaced with tPtr