beedoc
beedoc copied to clipboard
beego 使用go build编译后,单独运行出现下面的错误,运行不起来
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
你把 runmode 改成非 dev 就可以。在dev环境下,我们会尝试做一些别的事情,比如说扫描 Controller 以生成注解路由,这是依赖于 GO 的开发环境的。在非 runmode != dev 的时候,我们就不会做这些事情。