liudng / godump Goto Github PK
View Code? Open in Web Editor NEWDumps information about a variable Like var_dump() in php.
License: Other
Dumps information about a variable Like var_dump() in php.
License: Other
--- FAIL: TestDump (0.00 seconds)
panic: reflect.Value.Interface: cannot return value obtained from unexported field or method [recovered]
panic: reflect.Value.Interface: cannot return value obtained from unexported field or method
goroutine 20 [running]:
runtime.panic(0x4d5720, 0x1212a410)
c:/go/src/pkg/runtime/panic.c:279 +0xe9
testing.func·006()
c:/go/src/pkg/testing/testing.go:416 +0x12d
runtime.panic(0x4d5720, 0x1212a410)
c:/go/src/pkg/runtime/panic.c:248 +0x176
reflect.valueInterface(0x4d05a0, 0x121102b0, 0x0, 0x173, 0xffffff01, 0x0, 0x0)
c:/go/src/pkg/reflect/value.go:1081 +0xc6
reflect.Value.Interface(0x4d05a0, 0x121102b0, 0x0, 0x173, 0x0, 0x0)
c:/go/src/pkg/reflect/value.go:1070 +0x49
github.com/favframework/debug.dump(0x4d05a0, 0x121102b0, 0x0, 0x173, 0x505650, 0x1)
E:/home/LD/data/mon/trunk/server/src/github.com/favframework/debug/dump.go:30 +0xa2
github.com/favframework/debug.dump(0x4d84c0, 0x121102b0, 0x0, 0x192, 0x504560, 0x0)
E:/home/LD/data/mon/trunk/server/src/github.com/favframework/debug/dump.go:49 +0x57c
github.com/favframework/debug.Dump(0x4d84c0, 0x121102b0)
E:/home/LD/data/mon/trunk/server/src/github.com/favframework/debug/dump.go:19 +0x73
github.com/favframework/debug.TestDump(0x12124240)
E:/home/LD/data/mon/trunk/server/src/github.com/favframework/debug/dump_test.go:54 +0x412
testing.tRunner(0x12124240, 0x5a7260)
c:/go/src/pkg/testing/testing.go:422 +0x87
created by testing.RunTests
c:/go/src/pkg/testing/testing.go:504 +0x720
goroutine 16 [chan receive]:
testing.RunTests(0x53f1e0, 0x5a7260, 0x1, 0x1, 0x421c01)
c:/go/src/pkg/testing/testing.go:505 +0x75c
testing.Main(0x53f1e0, 0x5a7260, 0x1, 0x1, 0x5af460, 0x0, 0x0, 0x5af460, 0x0, 0x0)
c:/go/src/pkg/testing/testing.go:435 +0x6e
main.main()
github.com/favframework/debug/_test/_testmain.go:47 +0x86
goroutine 19 [finalizer wait]:
runtime.park(0x412900, 0x5ad580, 0x5ac8c9)
c:/go/src/pkg/runtime/proc.c:1369 +0x94
runtime.parkunlock(0x5ad580, 0x5ac8c9)
c:/go/src/pkg/runtime/proc.c:1385 +0x3f
runfinq()
c:/go/src/pkg/runtime/mgc0.c:2644 +0xc5
runtime.goexit()
c:/go/src/pkg/runtime/proc.c:1445
FAIL github.com/favframework/debug 0.035s
can not print the case when map key is not string:
ex:
map[int]string
map[xxxStruct]string
panic: reflect: call of reflect.Value.Interface on zero Value [recovered]
panic: reflect: call of reflect.Value.Interface on zero Value
goroutine 20 [running]:
runtime.panic(0x4f00a0, 0x120401b0)
c:/go/src/pkg/runtime/panic.c:279 +0xe9
testing.func·006()
c:/go/src/pkg/testing/testing.go:416 +0x12d
runtime.panic(0x4f00a0, 0x120401b0)
c:/go/src/pkg/runtime/panic.c:248 +0x176
reflect.valueInterface(0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0)
c:/go/src/pkg/reflect/value.go:1075 +0x75
reflect.Value.Interface(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
c:/go/src/pkg/reflect/value.go:1070 +0x49
github.com/favframework/debug.Dump(0x0, 0x0)
E:/home/LD/data/mon/trunk/server/src/github.com/favframework/debug/dump.go:80 +0x66
github.com/favframework/debug.TestDump(0x12054240)
E:/home/LD/data/mon/trunk/server/src/github.com/favframework/debug/dump_test.go:39 +0x2e
testing.tRunner(0x12054240, 0x5a7260)
c:/go/src/pkg/testing/testing.go:422 +0x87
created by testing.RunTests
c:/go/src/pkg/testing/testing.go:504 +0x720
goroutine 16 [chan receive]:
testing.RunTests(0x53f6a0, 0x5a7260, 0x1, 0x1, 0x421c01)
c:/go/src/pkg/testing/testing.go:505 +0x75c
testing.Main(0x53f6a0, 0x5a7260, 0x1, 0x1, 0x5af460, 0x0, 0x0, 0x5af460, 0x0, 0x0)
c:/go/src/pkg/testing/testing.go:435 +0x6e
main.main()
github.com/favframework/debug/_test/_testmain.go:47 +0x86
goroutine 19 [finalizer wait]:
runtime.park(0x412900, 0x5ad580, 0x5ac8c9)
c:/go/src/pkg/runtime/proc.c:1369 +0x94
runtime.parkunlock(0x5ad580, 0x5ac8c9)
c:/go/src/pkg/runtime/proc.c:1385 +0x3f
runfinq()
c:/go/src/pkg/runtime/mgc0.c:2644 +0xc5
runtime.goexit()
c:/go/src/pkg/runtime/proc.c:1445
FAIL github.com/favframework/debug 0.036s
在如下代码中,godump会返回
p := person{firstName: "a", lastName: "n"}
godump.Dump(p)
(main.person)
firstName(string) ""
lastName(string) ""
而使用fmt.Printf("%+v\n", p)
可以正常返回
{firstName:a lastName:n}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.