英文:
Can't Start Golang Prog Via Upstart
问题
我无法通过upstart运行我的golang程序。
这是我的项目目录--
/go
/src
/print.io
/geo
main.go
/geodomain
[.. 文件 ..]
我将我的gopath设置为上面的/go
目录。
在/geo
文件夹中,我可以运行go run main.go
,它可以正常工作。
然而,使用以下upstart配置时,它会记录main.go:8:2: import "print.io/geodomain": cannot find package
--
为什么当我手动运行命令时,它可以工作,但是通过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
英文:
I can't get my golang prog to run via upstart.
Here is my proj dir--
/go
/src
/print.io
/geo
main.go
/geodomain
[.. files ..]
I have my gopath set to the /go
dir above.
Within the /geo
folder i can run go run main.go
and it works.
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
答案1
得分: 2
从评论中重新提交:
> 当通过Upstart调用时,GOPATH
是否可能未设置?尝试编译您的程序(go build
)并将其放在正常的PATH
上。
英文:
Resumbitted from comment:
> 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
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论