This is a demo showing how to use gomplate to template out a Go project. Notably, the go.mod
file used for templating is a completely valid go.mod
file, which allows automated tools such as Dependabot to parse (and propose updates to) the template.
- Install
gomplate
. - Run
USER=farnsworth PROJECT=time-machine gomplate --input-dir=inDir --output-dir=outDir
to render the templates into a newoutDir
directory.
To make the demo simpler, the _templater.tmpl
file hard-codes a relative path to the outDir
directory. If you want to use this technique with the --output-dir
configuration option, you'll need to adjust the hard-coded string to read the output path from a data source or context
instead to ensure that the file is written to the correct directroy. See hairyhenderson/gomplate#2057 for more information.