【发布时间】:2020-06-16 13:14:02
【问题描述】:
我编写了一些 Golang 代码,在我的本地机器上测试时可以使用。当我将其部署为 Google Cloud 功能时,它会失败,因为它无法打开模板文件。失败的代码行是:
t, err := template.New("list.gohtml").ParseFiles("list.gohtml")
在此调用之后,err 设置为 open list.gohtml: no such file or directory
该文件与 go 源文件在同一目录下,并且未列在 .gcloudignore 或 .gitignore 中。 gcloud 函数文档说,除非在其中一个忽略文件中列出,否则目录中的所有文件都将被上传,如果我运行 gcloud meta list-files-for-upload,则文件 list.gohtml 包含在显示的列表中。 p>
是否有一些神奇的文件夹布局可以完成这项工作,或者gcloud functions deploy 命令的选项?
【问题讨论】:
标签: go google-cloud-functions gcloud go-templates