-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.Issue is not actionable because of missing required information, which needs to be provided.
Description
What version of Go are you using (go version
)?
$ go version go version go1.11.1 windows/amd64
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\Administrator\AppData\Local\go-build set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOOS=windows set GOPATH=C:\Users\Administrator\go set GOPROXY= set GORACE= set GOROOT=C:\Go set GOTMPDIR= set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64 set GCCGO=gccgo set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD= set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\ADMINI~1\AppData\Local\Temp\go-build455657050=/tmp/go-build -gno-record-gcc-switches
What did you do?
When I use xml.Unmarshal to act the XML text string, the result does work. And one of these is ok, my script like this:
look the source, and test script。 TestBridge_Info
is ok.
source
/*
<?xml version="1.0" encoding="UTF-8"?>
<log>
<logentry revision="4907">
<author>joshua</author>
<date>2018-12-04T03:52:28.702087Z</date>
<msg></msg>
</logentry>
<logentry revision="4904">
<author>conero</author>
<date>2018-12-04T03:01:11.280212Z</date>
<msg></msg>
</logentry>
</log>
*/
type XLEnter struct {
XMLName xml.Name `xml:"logentry"`
Revision string `xml:"revision,attr"`
Author string `xml:"author"`
Date string `xml:"date"`
Msg string `xml:"msg"`
}
// log --xml
type XmlLog struct {
XMLName xml.Name `xml:"log"`
Enter []XLEnter
}
// svn log --xml
func (b *Bridge) Log(pArgs ...string) (XmlLog, error) {
args := b.GetArgs("log", "--xml")
if pArgs != nil && len(pArgs) > 1 {
args = append(args, pArgs...)
}
//fmt.Println(args)
out, err := Call(args...)
fmt.Println(out, err)
var dd XmlLog
if err != nil {
return dd, err
}
err = xml.Unmarshal([]byte(out), &dd)
if err != nil {
return dd, err
}
return dd, nil
}
use testing
func TestBridge_Log(t *testing.T) {
brd := &Bridge{Path: _testPath}
dd, er := brd.Log("-r", "4900:4903")
if er != nil {
fmt.Println(" Error: " + er.Error())
return
}
fmt.Println(dd)
fmt.Println(dd.Enter)
for _, d := range dd.Enter {
s := `{"revision": "` + d.Revision + `", "author": "` + d.Author + `", "date": "` + d.Date + `", "msg": "` + d.Msg + `"}`
fmt.Println(" " + s)
//fmt.Println(d)
}
}
What did you expect to see?
{{ log} []}
[]
What did you see instead?
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.Issue is not actionable because of missing required information, which needs to be provided.