18

无论是windows、linux还是docker启动,初始化都不成功

 4 years ago
source link: https://studygolang.com/articles/27186
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

初始化时报“创建表失败”,查看日志却没发现error错误。 数据库只生成57张表,但看了数据库初始化脚本是有59张表的。

绕过配置,直接访问网站注册用户,就会报{"message":"Internal Server Error"},后台报错: {"time":"2020-03-10T20:41:27.709376996Z","level":"-","prefix":"echo","file":"recover.go","line":"73","message":"[PANIC RECOVER] runtime error: index out of range goroutine 285 [running]:\ngithub.com/labstack/echo/v4/middleware.RecoverWithConfig.func1.1.1(0xcf8020, 0x1000, 0x420000, 0xdfb060, 0xc00557c360)\n\t/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/recover.go:71 +0xf1\npanic(0xbf0180, 0x13ae070)\n\t/usr/local/go/src/runtime/panic.go:522 +0x1b5\ngithub.com/studygolang/studygolang/logic.UserLogic.doCreateUser(0xdeb360, 0xc008969760, 0xc00553b298, 0xc0000a16c0, 0xc00553b258, 0x1, 0x1, 0x1, 0xc00194fc01)\n\t/app/studygolang/logic/user.go:770 +0x4a5\ngithub.com/studygolang/studygolang/logic.UserLogic.CreateUser(0xdeb360, 0xc008969760, 0xc00553b710, 0x0, 0x0, 0x0, 0x0)\n\t/app/studygolang/logic/user.go:87 +0x5ce\ngithub.com/studygolang/studygolang/http/controller.AccountController.Register(0xdfb060, 0xc00557c360, 0xcbe2dd, 0x5)\n\t/app/studygolang/http/controller/account.go:96 +0x77e\ngithub.com/labstack/echo/v4.(*Echo).add.func1(0xdfb060, 0xc00557c360, 0x0, 0x0)\n\t/go/pkg/mod/github.com/labstack/echo/[email protected]/echo.go:501 +0x87\ngithub.com/studygolang/studygolang/http/middleware.AutoLogin.func1.1(0xdfb060, 0xc00557c360, 0x0, 0x0)\n\t/app/studygolang/http/middleware/login.go:70 +0x1d6\ngithub.com/studygolang/studygolang/http/middleware.HTTPError.func1.1(0xdfb060, 0xc00557c360, 0x10, 0xbb0ca0)\n\t/app/studygolang/http/middleware/http_error.go:22 +0x40\ngithub.com/studygolang/studygolang/http/middleware.Installed.func1.1(0xdfb060, 0xc00557c360, 0xcf8020, 0x1000)\n\t/app/studygolang/http/middleware/installed.go:39 +0xe4\ngithub.com/labstack/echo/v4/middleware.RecoverWithConfig.func1.1(0xdfb060, 0xc00557c360, 0x0, 0x0)\n\t/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/recover.go:78 +0xd5\ngithub.com/studygolang/studygolang/middleware.EchoLoggerWitchConfig.func1.1(0xdfb060, 0xc00557c360, 0x0, 0x0)\n\t/app/studygolang/middleware/logger.go:89 +0x433\ngithub.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc000216000, 0xde8fe0, 0xc0018c6fc0, 0xc001a6b300)\n\t/go/pkg/mod/github.com/labstack/echo/[email protected]/echo.go:612 +0x22d\nnet/http.serverHandler.ServeHTTP(0xc0001f2410, 0xde8fe0, 0xc0018c6fc0, 0xc001a6b300)\n\t/usr/local/go/src/net/http/server.go:2774 +0xa8\nnet/http.(*conn).serve(0xc0003057c0, 0xdeb0e0, 0xc001b49080)\n\t/usr/local/go/src/net/http/server.go:1878 +0x851\ncreated by net/http.(*Server).Serve\n\t/usr/local/go/src/net/http/server.go:2884 +0x2f4\n\ngoroutine 1 [select, 6 minutes]:\ngithub.com/facebookgo/grace/gracehttp.(*app).run(0xc00025c770, 0x1, 0x1)\n\t/go/pkg/mod/github.com/facebookgo/[email protected]/gracehttp/http.go:165 +0x242\ngithub.com/facebookgo/grace/gracehttp.Serve(0xc000010748, 0x1, 0x1, 0xcbc826, 0x4)\n\t/go/pkg/mod/github.com/facebookgo/[email protected]/gracehttp/http.go:193 +0x4d\nmain.gracefulRun(0xc0001f2410)\n\t/app/studygolang/cmd/studygolang/graceful_unix.go:13 +0x62\nmain.main()\n\t/app/studygolang/cmd/studygolang/main.go:93 +0xb19\n\ngoroutine 19 [syscall, 6 minutes]:\nos/signal.signal_recv(0x0)\n\t/usr/local/go/src/runtime/sigqueue.go:139 +0x9c\nos/signal.loop()\n\t/usr/local/go/src/os/signal/signal_unix.go:23 +0x22\ncreated by os/signal.init.0\n\t/usr/local/go/src/os/signal/signal_unix.go:29 +0x41\n\ngoroutine 20 [chan receive, 6 minutes]:\ngithub.com/polaris1119/config.signalReload()\n\t/go/pkg/mod/github.com/polaris1119/[email protected]/reload_unix.go:16 +0xa9\ncreated by github.com/polaris1119/config.init.0\n\t/go/pkg/mod/github.com/polaris1119/[email protected]/config.go:65 +0x310\n\ngoroutine 162 [select]:\ngithub.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1(0xc00bb76f00, 0xc0055c2a80, 0xc000025440)\n\t/go/pkg/mod/github.com/go-sql-driver/[email protected]/connection_go18.go:178 +0xbf\ncreated by github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher\n\t/go/pkg/mod/github.com/go-sql-driver/[email protected]/connection_go18.go:175 +0xbe\n\ngoroutine 9 [IO wait, 6 minutes]:\ninternal/poll.runtime_pollWait(0x7f7e5eb09df8, 0x72, 0x0)\n\t/usr/local/go/src/runtime/netpoll.go:182 +0x56\ninternal/poll.(*pollDesc).wait(0xc0001bc798, 0x72, 0x0, 0x0, 0xcc0495)\n\t/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x9b\ninternal/poll\n"}

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:muxilin131420 备注:入群;或加QQ群:977810755


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK