I have some text file that I read from my Go program. I\'d like to ship a single executable, without supplying that text file additionally. How do I embed it into compilatio
I used a simple function to read an external template in a go generate
run and to generate Go code from it. A function returning the template as a string will be generated. One can then parse the returned template string using tpl, err := template.New("myname").Parse(mynameTemplate())
I did put that code to github. You might want to try https://github.com/wlbr/templify
Very simple, but works for me quite well.