求助,windows下编译Linux 386架构的go二进制程序,运行时报错,报错提示项目的绝对路径。
报错信息如下:
root@ubuntu:~/Desktop/webvProject/src# ./server
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8131598]
goroutine 1 [running]:
database/sql.(*Stmt).ExecContext(0x0, {0x8679ff8, 0x9c1c100}, {0x0, 0x0, 0x0})
C:/Program Files/Go/src/database/sql/sql.go:2578 +0x58
database/sql.(*Stmt).Exec(...)
C:/Program Files/Go/src/database/sql/sql.go:2610
webvProject/Service.deleteAll()
F:/WebView/webvProject/Service/redisService.go:58 +0x82
webvProject/Service.InitRedis()
F:/WebView/webvProject/Service/redisService.go:18 +0xec
main.main()
F:/WebView/webvProject/main.go:16 +0x1e
在linux的项目下编译运行是可以成功的,然后将二进制程序转移到项目目录外运行也是报类似的错,区别只在于路径有所变化。
在windows下编译运行后,连同整个文件夹一起上传指linux服务器下运行就报这个错了。
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: