FAQ
I've found a bug with the standard library XML parser. I've created a test
that reproduces it (gist below) but I'm having a little trouble digging
finding the source of the issue. Could someone with a little more insight
into the XML parser help out?

https://gist.github.com/robyoung/5295628

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Dan Kortschak at Apr 2, 2013 at 9:23 pm
    Runnable playground links are much more friendly for this kind of thing, but I'll have a look when I get to a real machine.
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dan Kortschak at Apr 2, 2013 at 11:54 pm
    The xml.CharData token is not usable after the next call to Token()
    (actually the xml data buffer is not usable hence the next token local
    name being what you see as the prefix of the char data). You are
    effectively doing this because of the use of the goroutine to read the
    xml stream - it can go ahead and read the next token as soon as you have
    accepted the token in the range loop, clobbering your char data. I would
    just include the reading in the main routine.

    In short, your code is racey.
    On Tue, 2013-04-02 at 12:56 -0700, bubblenut@gmail.com wrote:
    I've found a bug with the standard library XML parser. I've created a
    test that reproduces it (gist below) but I'm having a little trouble
    digging finding the source of the issue. Could someone with a little
    more insight into the XML parser help out?


    https://gist.github.com/robyoung/5295628


    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Rob Young at Apr 3, 2013 at 8:38 pm
    Aha, I see. Fantastic, thanks.
    On Wednesday, 3 April 2013 00:54:07 UTC+1, kortschak wrote:

    The xml.CharData token is not usable after the next call to Token()
    (actually the xml data buffer is not usable hence the next token local
    name being what you see as the prefix of the char data). You are
    effectively doing this because of the use of the goroutine to read the
    xml stream - it can go ahead and read the next token as soon as you have
    accepted the token in the range loop, clobbering your char data. I would
    just include the reading in the main routine.

    In short, your code is racey.
    On Tue, 2013-04-02 at 12:56 -0700, bubb...@gmail.com <javascript:> wrote:
    I've found a bug with the standard library XML parser. I've created a
    test that reproduces it (gist below) but I'm having a little trouble
    digging finding the source of the issue. Could someone with a little
    more insight into the XML parser help out?


    https://gist.github.com/robyoung/5295628

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 2, '13 at 9:07p
activeApr 3, '13 at 8:38p
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase