If you want to generate javascript code I suggest the encoding/json package from the stdlib. Like: https://play.golang.org/p/vHKcCfWJPz
On Thu, Jan 05, 2017 at 09:06:06AM -0800, bsr wrote: > Alexander. thank you very much for helping out. > your program does output my desired string, but value is read from parsing > struct comment and not sure how to get the same effect of multi line > string `hello ... \n world` > In other word, my input is "hello ... \n world" and not sure how to > convert to support multi line string like `hello ... \n world` > thanks in advance, > bsr. > > On Thursday, January 5, 2017 at 11:52:39 AM UTC-5, Alexander Kapshuk > wrote: > > On Thu, Jan 5, 2017 at 6:45 PM, bsr <[1]bsr...@gmail.com> wrote: > > Please see the example [2]https://play.golang.org/p/SeG7oO5Us0 > > > > I am doing some javascript codegen and I want my values single quoted. > so, > > in the above example, I want the output to be > > > > > > { v: 'hello ... \n world'} > > > > > > instead of > > > > { v: '"hello ... \n world"'} or { v: "hello ... \n world"} > > > > how can I do that? > > > > thanks, > > bsr. > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "golang-nuts" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to [3]golang-nuts...@googlegroups.com. > > For more options, visit [4]https://groups.google.com/d/optout. > > [5]https://play.golang.org/p/GEQpdi6C6s > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [6]golang-nuts+unsubscr...@googlegroups.com. > For more options, visit [7]https://groups.google.com/d/optout. > > References > > Visible links > 1. javascript: > 2. https://play.golang.org/p/SeG7oO5Us0 > 3. javascript: > 4. https://groups.google.com/d/optout > 5. https://play.golang.org/p/GEQpdi6C6s > 6. mailto:golang-nuts+unsubscr...@googlegroups.com > 7. https://groups.google.com/d/optout -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.