升級go1.10後打包出錯

romny發表於2018-02-27

小白請教:


之前 1.8 和 1.9 都正常,今天升級到 1.10 發現打包出來的執行檔案執行報錯 在 mac 和 win10 打包成 linux bee pack -be=GOOS=linux 執行時:

panic: you are in dev mode. So please set gopath

goroutine 1 [running]:
github.com/astaxie/beego.(*ControllerRegister).Include(0xc4200c0790, 0xc4201dfc30, 0x1, 0x1)
    E:/m/go/src/github.com/astaxie/beego/router.go:231 +0x789
github.com/astaxie/beego.(*Namespace).Include(0xc4202290a0, 0xc4201dfc30, 0x1, 0x1, 0xc4202290a0)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:186 +0x4d
github.com/astaxie/beego.NSInclude.func1(0xc4202290a0)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:302 +0x46
github.com/astaxie/beego.NewNamespace(0xaae8aa, 0x9, 0xc42008d388, 0x1, 0x1, 0xc420231101)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:42 +0x8c
github.com/astaxie/beego.NSNamespace.func1(0xc420229080)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:386 +0x52
github.com/astaxie/beego.NewNamespace(0xaae88f, 0x9, 0xc420183e98, 0x18, 0x18, 0xc420231170)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:42 +0x8c
aaa-api/routers.init.1()
    E:/m/go/src/aaa-api/routers/router.go:20 +0x17f4
panic: you are in dev mode. So please set gopath

goroutine 1 [running]:
github.com/astaxie/beego.(*ControllerRegister).Include(0xc4200c0840, 0xc4201dfc30, 0x1, 0x1)
    E:/m/go/src/github.com/astaxie/beego/router.go:231 +0x789
github.com/astaxie/beego.(*Namespace).Include(0xc42022b0c0, 0xc4201dfc30, 0x1, 0x1, 0xc42022b0c0)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:186 +0x4d
github.com/astaxie/beego.NSInclude.func1(0xc42022b0c0)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:302 +0x46
github.com/astaxie/beego.NewNamespace(0xaae8aa, 0x9, 0xc42008d388, 0x1, 0x1, 0xc420235101)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:42 +0x8c
github.com/astaxie/beego.NSNamespace.func1(0xc42022b0a0)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:386 +0x52
github.com/astaxie/beego.NewNamespace(0xaae88f, 0x9, 0xc420185e98, 0x18, 0x18, 0xc420235170)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:42 +0x8c
aaa-api/routers.init.1()
    E:/m/go/src/aaa-api/routers/router.go:20 +0x17f4
panic: you are in dev mode. So please set gopath

goroutine 1 [running]:
github.com/astaxie/beego.(*ControllerRegister).Include(0xc4200ae6e0, 0xc4201cbc60, 0x1, 0x1)
    E:/m/go/src/github.com/astaxie/beego/router.go:231 +0x789
github.com/astaxie/beego.(*Namespace).Include(0xc4202150e0, 0xc4201cbc60, 0x1, 0x1, 0xc4202150e0)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:186 +0x4d
github.com/astaxie/beego.NSInclude.func1(0xc4202150e0)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:302 +0x46
github.com/astaxie/beego.NewNamespace(0xaae8aa, 0x9, 0xc42000d398, 0x1, 0x1, 0xc420221101)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:42 +0x8c
github.com/astaxie/beego.NSNamespace.func1(0xc4202150c0)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:386 +0x52
github.com/astaxie/beego.NewNamespace(0xaae88f, 0x9, 0xc420169e98, 0x18, 0x18, 0xc420221170)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:42 +0x8c
aaa-api/routers.init.1()
    E:/m/go/src/aaa-api/routers/router.go:20 +0x17f4
panic: you are in dev mode. So please set gopath

goroutine 1 [running]:
github.com/astaxie/beego.(*ControllerRegister).Include(0xc4200c0790, 0xc4201dfc30, 0x1, 0x1)
    E:/m/go/src/github.com/astaxie/beego/router.go:231 +0x789
github.com/astaxie/beego.(*Namespace).Include(0xc4202270c0, 0xc4201dfc30, 0x1, 0x1, 0xc4202270c0)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:186 +0x4d
github.com/astaxie/beego.NSInclude.func1(0xc4202270c0)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:302 +0x46
github.com/astaxie/beego.NewNamespace(0xaae8aa, 0x9, 0xc42008d388, 0x1, 0x1, 0xc420233101)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:42 +0x8c
github.com/astaxie/beego.NSNamespace.func1(0xc4202270a0)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:386 +0x52
github.com/astaxie/beego.NewNamespace(0xaae88f, 0x9, 0xc420183e98, 0x18, 0x18, 0xc420233170)
    E:/m/go/src/github.com/astaxie/beego/namespace.go:42 +0x8c
aaa-api/routers.init.1()
    E:/m/go/src/aaa-api/routers/router.go:20 +0x17f4

我是用 Supervisord 部署的,之前一直正常。 然後把模式又 dev 轉成 prod 就不報錯了,為什麼呢?都只能用 prod 了?

更多原創文章乾貨分享,請關注公眾號
  • 升級go1.10後打包出錯
  • 加微信實戰群請加微信(註明:實戰群):gocnio

相關文章