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

beego 使用go build编译后,单独运行出现下面的错误,运行不起来 #935

Open
hexinjun888 opened this issue Jul 29, 2021 · 1 comment

Comments

@hexinjun888
Copy link

go的版本是V1.16

panic: err: go command required, not found: exec: "go": executable file not foun
d in %PATH%: stderr:

goroutine 1 [running]:
github.com/beego/beego/v2/server/web.initBeforeHTTPRun.func1()
C:/Users/hexinjun/go/pkg/mod/github.com/beego/beego/[email protected]/server/web
/beego.go:83 +0x21f
sync.(*Once).doSlow(0x11196f8, 0xc25138)
E:/Program Files/Go/src/sync/once.go:68 +0xf7
sync.(*Once).Do(...)
E:/Program Files/Go/src/sync/once.go:59
github.com/beego/beego/v2/server/web.initBeforeHTTPRun()
C:/Users/hexinjun/go/pkg/mod/github.com/beego/beego/[email protected]/server/web
/beego.go:69 +0x54
github.com/beego/beego/v2/server/web.(*HttpServer).Run(0xc000004f18, 0x0, 0x0, 0
x0, 0x0, 0x0)
C:/Users/hexinjun/go/pkg/mod/github.com/beego/beego/[email protected]/server/web
/server.go:85 +0x3b
github.com/beego/beego/v2/server/web.Run(0x0, 0x0, 0x0)
C:/Users/hexinjun/go/pkg/mod/github.com/beego/beego/[email protected]/server/web
/beego.go:57 +0x6b
main.main()
C:/Users/hexinjun/Desktop/新建文件夹/test/main.go:9 +0x39

@flycash
Copy link
Collaborator

flycash commented Aug 4, 2021

你把 runmode 改成非 dev 就可以。在dev环境下,我们会尝试做一些别的事情,比如说扫描 Controller 以生成注解路由,这是依赖于 GO 的开发环境的。在非 runmode != dev 的时候,我们就不会做这些事情。

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