我无法让我的 golang prog 通过 upstart 运行。
这是我的项目目录--
/go
/src
/print.io
/geo
main.go
/geodomain
[.. files ..]
我将 gopath 设置为上面的 /go
目录。
在 /geo
文件夹中,我可以运行 go run main.go
并且它可以工作。
但是,使用以下 Upstart 配置其日志记录 main.go:8:2: import "print.io/geodomain": 找不到包
--
为什么它不能像我手动运行命令那样从 Upstart 处工作?
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
最佳答案
从评论中恢复:
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
.
关于go - 无法通过 Upstart 启动 Golang Prog,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19102349/