我尝试通过gitlab CI在GCP上运行我的函数,但是它返回了以下错误:
Function failed to start: no matching function found with name: "RunUsers"
路径:测试/函数. go
文件名"函数. go"
部署
x一个一个一个一个x一个一个二个x
我应该删除.gcloudignore
文件中的. mod吗?
格鲁迪戈尔:
# This file specifies files that are *not* uploaded to Google Cloud
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore
tests/
README.md
Makefile
env/
*.json
sonar-project.properties
.gitlab-ci.yml
cmd/
*.mod
有人经历过这个问题吗?
3条答案
按热度按时间qvk1mo1f1#
您将入口点指定为:
函数声明为:
注意函数名的case的不同:
runUsers
与RunUsers
的对比。ktecyv1j2#
部署时出现问题,中的代码正确且功能正常
tjvv9vkg3#
当尝试在本地运行代码时,我遇到了同样的错误:
解决方案需要在我的代码中包含一个
func init()
(沿着cmd/main.go
文件),请参见文档:https://github.com/GoogleCloudPlatform/functions-framework-go#quickstart-hello-world-on-your-local-machine