Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

后端启动报错 #3

Open
loilih opened this issue May 9, 2024 · 5 comments
Open

后端启动报错 #3

loilih opened this issue May 9, 2024 · 5 comments

Comments

@loilih
Copy link

loilih commented May 9, 2024

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x1272c0a]

@bitxx
Copy link
Owner

bitxx commented May 10, 2024

有具体报错位置吗,麻烦贴一下完整的错误日志?
启动不成功,一般只有配置异常会出现

@loilih
Copy link
Author

loilih commented May 10, 2024

我直接 go run main.go

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x842c0a]

goroutine 1 [running]:
github.com/bitxx/logger/logbase.(*Helper).Infof(0x0, {0x1120ee6, 0x3}, {0xc00076e050, 0x1, 0x1})
C:/Users/yunfe/go/pkg/mod/github.com/bitxx/logger@v1.6.2/logbase/helper.go:24 +0x4a
go-admin/core/utils/log.Infof(...)
D:/golang/go-admin-master/core/utils/log/log.go:37
go-admin/core/cmd.tip()
D:/golang/go-admin-master/core/cmd/cobra.go:35 +0x11f
go-admin/core/cmd.glob..func1(0xc000e1cc00?, {0x2311c20?, 0x4?, 0x1122495?})
D:/golang/go-admin-master/core/cmd/cobra.go:22 +0x25
github.com/spf13/cobra.(*Command).ValidateArgs(...)
C:/Users/yunfe/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1096
github.com/spf13/cobra.(*Command).execute(0x22977a0, {0xc00004a0c0, 0x0, 0x0})
C:/Users/yunfe/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:909 +0x693
github.com/spf13/cobra.(*Command).ExecuteC(0x22977a0)
C:/Users/yunfe/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
C:/Users/yunfe/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
go-admin/core/cmd.Execute()
D:/golang/go-admin-master/core/cmd/cobra.go:44 +0x1a
main.main()
D:/golang/go-admin-master/main.go:17 +0xf
exit status 2

@bitxx
Copy link
Owner

bitxx commented May 11, 2024

我直接 go run main.go

panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x0 pc=0x842c0a]

goroutine 1 [running]: github.com/bitxx/logger/logbase.(*Helper).Infof(0x0, {0x1120ee6, 0x3}, {0xc00076e050, 0x1, 0x1}) C:/Users/yunfe/go/pkg/mod/github.com/bitxx/logger@v1.6.2/logbase/helper.go:24 +0x4a go-admin/core/utils/log.Infof(...) D:/golang/go-admin-master/core/utils/log/log.go:37 go-admin/core/cmd.tip() D:/golang/go-admin-master/core/cmd/cobra.go:35 +0x11f go-admin/core/cmd.glob..func1(0xc000e1cc00?, {0x2311c20?, 0x4?, 0x1122495?}) D:/golang/go-admin-master/core/cmd/cobra.go:22 +0x25 github.com/spf13/cobra.(*Command).ValidateArgs(...) C:/Users/yunfe/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1096 github.com/spf13/cobra.(*Command).execute(0x22977a0, {0xc00004a0c0, 0x0, 0x0}) C:/Users/yunfe/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:909 +0x693 github.com/spf13/cobra.(*Command).ExecuteC(0x22977a0) C:/Users/yunfe/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5 github.com/spf13/cobra.(*Command).Execute(...) C:/Users/yunfe/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 go-admin/core/cmd.Execute() D:/golang/go-admin-master/core/cmd/cobra.go:44 +0x1a main.main() D:/golang/go-admin-master/main.go:17 +0xf exit status 2

你是编译启动,也需要配置启动参数的,需要加上"server"或者 "server -c 配置位置"
具体可参考README.md的二进制启动方式,逻辑一样。

下面是在idea的IDE中编译启动的配置:
WX20240511-092434

@loilih
Copy link
Author

loilih commented May 11, 2024

好的,谢谢

@loilih
Copy link
Author

loilih commented May 11, 2024

导入数据库,生成代码,接口状态码:404

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants