go - 无法通过 Upstart 启动 Golang Prog

标签 go ubuntu-12.04 upstart

我无法让我的 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 normal PATH.

关于go - 无法通过 Upstart 启动 Golang Prog,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19102349/

相关文章:

linux - Bash 多行回显

python - 声音文件不在pygame中播放

c++ - UBUNTU C++ 编译器找不到头文件

ubuntu - 为什么在 GNU/Linux 上停止(或重新启动)squid3 如此缓慢?

go - 定义返回接口(interface) slice 的函数类型

go - 如何使用索引构造翻转的单个位位域?

go - 无法运行 go 权限被拒绝?

go - 有没有办法在 Go 中的构建时定义常量?

python - 异步运行一些 Python 代码的正确方法是什么?

process - 使用Upstart设置内存消耗限制