golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.4k stars 17.71k forks source link

encoding/xml: unexpected behavior of decoder.Skip #33222

Open GreenHedgehog opened 5 years ago

GreenHedgehog commented 5 years ago

What version of Go are you using (go version)?

$ go version
go1.12.4 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/alef/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/alef/go_ws"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build838012780=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://play.golang.org/p/-DttEFaM_L9

What did you expect to see?

some value 
some value 

What did you see instead?

some value 
 XML syntax error on line 1: unexpected end element 

It a lit bit discouraged, what xml.Skip not working with RawToken, this behavior not mentioned in xml.Skip description.

julieqiu commented 5 years ago

/cc @rsc per owners.