我目前正在尝试在Linux VPS上将我的golang应用程序设置为服务。golang应用程序在我的本地主机上平稳运行。在服务器本身上,我可以启动它,并且应用程序可以通过IP地址调用。go run main.go
服务配置:
[Unit]
Description=vfreight
[Service]
Type=simple
Restart=always
RestartSec=5s
ExecStart=/root/go/src/VFreight/main
[Install]
WantedBy=multi-user.target
但是当我尝试将其作为服务运行时,该服务总是失败。
May 13 20:10:31 srv.vfreight.com systemd[1]: Started vfreight.
May 13 20:10:31 srv.vfreight.com main[3167]: panic: html/template: pattern matches no files: `template/*.tmpl`
May 13 20:10:31 srv.vfreight.com main[3167]: goroutine 1 [running]:
May 13 20:10:31 srv.vfreight.com main[3167]: html/template.Must(...)
May 13 20:10:31 srv.vfreight.com main[3167]: /usr/lib/golang/src/html/template/template.go:374
May 13 20:10:31 srv.vfreight.com main[3167]: VFreight/app/controller.init.0()
May 13 20:10:31 srv.vfreight.com main[3167]: /root/go/src/VFreight/app/controller/control.go:21 +0x9e
May 13 20:10:31 srv.vfreight.com systemd[1]: vfreight.service: main process exited, code=exited, status=2/INVALIDARGUMENT
May 13 20:10:31 srv.vfreight.com systemd[1]: Unit vfreight.service entered failed state.
May 13 20:10:31 srv.vfreight.com systemd[1]: vfreight.service failed.
May 13 20:10:36 srv.vfreight.com systemd[1]: vfreight.service holdoff time over, scheduling restart.
May 13 20:10:36 srv.vfreight.com systemd[1]: Stopped vfreight.
func init() { tmpl = template.Must(template.ParseGlob("template/*.tmpl")) }
我试图将更改为,但这不起作用。template/*.tmpl../template/*.tmpl
去 env
希望有人有一个想法来解决这个问题。
问候克里斯
犯罪嫌疑人X
相关分类