无法通过 Upstart 启动 Golang Prog [英] Can't Start Golang Prog Via Upstart
问题描述
我无法通过 upstart 运行我的 golang prog.
I can't get my golang prog to run via upstart.
这是我的项目目录--
/go
/src
/print.io
/geo
main.go
/geodomain
[.. files ..]
我的 gopath 设置为上面的 /go
目录.
I have my gopath set to the /go
dir above.
在 /geo
文件夹中,我可以运行 go run main.go
并且它可以工作.
Within the /geo
folder i can run go run main.go
and it works.
但是,使用以下新贵配置,其日志记录 main.go:8:2: import "print.io/geodomain": cannot find package
--
However, with the following upstart configuration its logging main.go:8:2: import "print.io/geodomain": cannot find package
--
为什么它不能像我手动运行命令那样从新贵开始工作?
Why doesnt it work from upstart like it does when i run the command manually?
description "go-server"
author "micah smith"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [!2345]
respawn
script
chdir ~/go/src/print.io/geo/
exec go run main.go
end script
推荐答案
从评论中恢复:
是否有可能在通过 Upstart 调用时未设置 GOPATH
?尝试编译您的程序(go build
)并将其放在您的普通 PATH
中.
Is it possible that, when invoked through Upstart, the
GOPATH
isn't set? Try compiling your program (go build
) and putting it on your normalPATH
.
这篇关于无法通过 Upstart 启动 Golang Prog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!