I'm using Jennifer which is a code generator for Go.
I want to write code to generate the main
function such that some lines could be count
number of times, where count
is a variable I read from a file.
I tried creating the required string using for
loop and passing it in the arguments, but the Block()
only accepts type Code
.
functoret := jen.Func().Id("main").Params().Block(
jen.Id("a").Op(":=").Id("b")
jen.Id("a").Op(":=").Id("c")
jen.Id("a").Op(":=").Id("d") //count number of times
)