1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| ➜ goRedisDemo git:(master) ✗ go run main.go test mySQL panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x10c1141]
goroutine 1 [running]: sync.(*Mutex).Lock(...) /usr/local/go/src/sync/mutex.go:74 database/sql.(*DB).conn(0x0, 0x130f9e0, 0xc000018080, 0x1036801, 0xc000000180, 0x300000002, 0xc000000180) /usr/local/go/src/database/sql/sql.go:1132 +0x41 database/sql.(*DB).prepare(0x0, 0x130f9e0, 0xc000018080, 0x12c9f84, 0x69, 0x102da01, 0x203000, 0xc0000b3d78, 0xc0000b3d68) /usr/local/go/src/database/sql/sql.go:1431 +0x58 database/sql.(*DB).PrepareContext(0x0, 0x130f9e0, 0xc000018080, 0x12c9f84, 0x69, 0x30, 0x30, 0x128eaa0) /usr/local/go/src/database/sql/sql.go:1404 +0x99 database/sql.(*DB).Prepare(...) /usr/local/go/src/database/sql/sql.go:1421 goRedisDemo/db.OnFileUploadFinished(0x12bbb58, 0x8, 0x12bbb60, 0x8, 0x0, 0x0, 0x0, 0x0) /Users/samtake/Documents/GitHub/goRedisDemo/db/file.go:15 +0x77 goRedisDemo/handler.UploadHandlerDB() /Users/samtake/Documents/GitHub/goRedisDemo/handler/testDB.go:10 +0x76 main.main() /Users/samtake/Documents/GitHub/goRedisDemo/main.go:14 +0x7a exit status 2 ➜ goRedisDemo git:(master) ✗ go get database/sql ➜ goRedisDemo git:(master) ✗ go get github.com/go-sql-driver/mysql ➜ goRedisDemo git:(master) ✗ go run main.go test mySQL panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x10c1141]
goroutine 1 [running]: sync.(*Mutex).Lock(...) /usr/local/go/src/sync/mutex.go:74 database/sql.(*DB).conn(0x0, 0x130f9e0, 0xc0000b0008, 0x1036801, 0xc000000180, 0x300000002, 0xc000000180) /usr/local/go/src/database/sql/sql.go:1132 +0x41 database/sql.(*DB).prepare(0x0, 0x130f9e0, 0xc0000b0008, 0x12c9f84, 0x69, 0x102da01, 0x203000, 0xc0000dfd78, 0xc0000dfd68) /usr/local/go/src/database/sql/sql.go:1431 +0x58 database/sql.(*DB).PrepareContext(0x0, 0x130f9e0, 0xc0000b0008, 0x12c9f84, 0x69, 0x30, 0x30, 0x128eaa0) /usr/local/go/src/database/sql/sql.go:1404 +0x99 database/sql.(*DB).Prepare(...) /usr/local/go/src/database/sql/sql.go:1421 goRedisDemo/db.OnFileUploadFinished(0x12bbb58, 0x8, 0x12bbb60, 0x8, 0x0, 0x0, 0x0, 0x0) /Users/samtake/Documents/GitHub/goRedisDemo/db/file.go:22 +0x77 goRedisDemo/handler.UploadHandlerDB() /Users/samtake/Documents/GitHub/goRedisDemo/handler/testDB.go:10 +0x76 main.main() /Users/samtake/Documents/GitHub/goRedisDemo/main.go:14 +0x7a exit status 2
|