初始化时报“创建表失败”,查看日志却没发现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/v4@v4.1.8/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/v4@v4.1.8/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/v4@v4.1.8/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/v4@v4.1.8/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/grace@v0.0.0-20180706040059-75cf19382434/gracehttp/http.go:165 +0x242\ngithub.com/facebookgo/grace/gracehttp.Serve(0xc000010748, 0x1, 0x1, 0xcbc826, 0x4)\n\t/go/pkg/mod/github.com/facebookgo/grace@v0.0.0-20180706040059-75cf19382434/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/config@v0.0.0-20160609095218-06a751e884f3/reload_unix.go:16 +0xa9\ncreated by github.com/polaris1119/config.init.0\n\t/go/pkg/mod/github.com/polaris1119/config@v0.0.0-20160609095218-06a751e884f3/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/mysql@v1.4.1/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/mysql@v1.4.1/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"}
有疑问加站长微信联系(非本文作者))