Closed pekim closed 7 years ago
I likely won't have a chance to look at this for the next few days.
I'm almost certain this is related to golang/go#16394 which is about build failures caused by a large number of string concatenations. While that remains open, I'll try the workaround applied to x/text. Iff that doesn't work, I'll add a configuration option that will allow the disabling of string wrapping.
I'd rather not add a configuration option if I can help it and it would later be removed if the compiler bug is fixed.
I agree, https://github.com/golang/go/issues/16394 does indeed look like it describes the problem.
The parenthesis workaround sounds good if it works.
I'd rather not add a configuration option if I can help it and it would later be removed if the compiler bug is fixed.
Yes, on reflection that would result in a backwards incompatible API change. Never a good idea if it can be avoided.
@pekim I was able to trivially reproduce this bug, and porting the fix from x/text solved it for me. Hopefully this is also a satisfactory solution for you.
Yes, it works a treat.
Thank you.
I have a number of truetype files that result in a generated go src file of about 150,000 lines.
Each input file generates something like this.
The large number of lines of concatenated strings results in crazy compile times. In fact I've not been able to successfully build; I end up giving up and interrupting the build.
If I change
wrapAt
to a very large number (such as 1000000) then the data is generated as a single string for each asset, and the build time is perfectly reasonable.I can't find a nice way to change, or better still disable, the wrapAt value. For now I've locally changed
{{flate . "\t\t\t" 24}}
to{{flate . "\t\t\t" 1000000}}
at release.go#L213 to prove the problem and a solution. (And the same for{{read . "\t\t\t" 24 -}}
.)It would be good if this could configured in https://godoc.org/github.com/tmthrgd/go-bindata#GenerateOptions . However I've not yet been able to get my head around the code enough to work out how to approach this, and make a merge request.
Perhaps the concatenation of multiple strings should be removed completely? I'm sure that others may hit the same issue at some point. Interestingly the original jteeuwen/go-bindata does not do this, it generates a single string for an asset's data.