Skip to content
Go tool and library for generating code from the template using interface definition
Go Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/ifacecodegen
examples
vendor
.gitignore
.travis.yml
LICENSE
Makefile
README.md
generate.go
generate_test.go
models.go
parse.go
parse_test.go

README.md

ifacecodegen

Build Status GoDoc

Go tool and library for generating code from the template using interface definition.

Installation

go get -u github.com/fredipevcin/ifacecodegen/cmd/ifacecodegen

Running ifacecodegen

ifacecodegen -source examples/interface.go -destination -

or

cat examples/interface.go | ifacecodegen

Other options

ifacecodegen -h

Examples

Example templates and interface are located in examples folder.

# example 1
ifacecodegen \
	-source examples/interface.go \
	-template examples/example1.tmpl \
	-destination - \
	-meta service=account \
	-imports "opentracing=github.com/opentracing/opentracing-go,tracinglog=github.com/opentracing/opentracing-go/log"

# example 2
ifacecodegen \
	-source examples/interface.go \
	-template examples/example2.tmpl \
	-destination -

Notes

Inspired by:

You can’t perform that action at this time.