adhocteam / pushup

Pushup is for making modern, page-oriented web apps in Go
https://pushup.adhoc.dev
MIT License
844 stars 30 forks source link

Mangle buffer name #89

Closed llimllib closed 1 year ago

llimllib commented 1 year ago

rather than preventing users from using the name 'b', let's mangle our own names to something they're unlikely to want to use.

Generated code, before:

            b := new(bytes.Buffer)
//line dump.up:2
            io.WriteString(b, "\n\n")
//line dump.up:3
            io.WriteString(b, "<h2>")
//line dump.up:3
            io.WriteString(b, "Dump request headers")
//line dump.up:3
            io.WriteString(b, "</h2>")
<snip>
            sections["contents"] <- template.HTML(b.String())

Generated code, after:

            __pushup_b := new(bytes.Buffer)
//line dump.up:2
            io.WriteString(__pushup_b, "\n\n")
//line dump.up:3
            io.WriteString(__pushup_b, "<h2>")
//line dump.up:3
            io.WriteString(__pushup_b, "Dump request headers")
//line dump.up:3
            io.WriteString(__pushup_b, "</h2>")
<snip>
            sections["contents"] <- template.HTML(__pushup_b.String())

Fixes #88