go panic问题一例

     写个工具,发现程序panic了:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x115dab8]

goroutine 1 [running]:
crypto/rsa.checkPub(...)
        /usr/local/Cellar/go/1.12.9/libexec/src/crypto/rsa/rsa.go:75
crypto/rsa.EncryptOAEP(0x16b6300, 0xc0000a0070, 0x16a5be0, 0xc0000d40f0, 0x0, 0xc000126500, 0x40, 0x40, 0x0, 0x0, ...)
        /usr/local/Cellar/go/1.12.9/libexec/src/crypto/rsa/rsa.go:377 +0x38
main.httpPost(0xc0001f6360, 0x110, 0x15f0517, 0x4, 0x160669a, 0x22, 0x15f36d5, 0x8, 0x0, 0x0, ...)
        /xxx/http.go:67 +0x386
main.XYZ(0x15f0517, 0x4, 0x15f36d5, 0x8, 0xc000115f48, 0x0, 0x0)
        /xxx/hander.go:205 +0x231
main.main()
        /xxx/main.go:46 +0x11e

       怎么会panic在系统包rsa那里呢? 是系统包有问题吗?

       怕是想多了,搞笑!

      很明显,不是系统包的问题,而是自己使用的问题(没传参数进去)。

      不多说。

发布了2229 篇原创文章 · 获赞 4764 · 访问量 2014万+

猜你喜欢

转载自blog.csdn.net/stpeace/article/details/105458113