我正在尝试将Go应用上传到Appegnine Go 1.12运行时。我的主要pkg在cmd
文件夹下,如图https://cloud.google.com/appengine/docs/standard/go112/config/appref#runtime_and_app_elements
但是,如果我尝试使用官方文档中概述的任何方法,则会收到以下错误消息:
ERROR: (gcloud.app.deploy) An error occurred while parsing file: [/home/tamal/go/src/kmodules.xyz/resource-metadata/app.yaml]
Unable to assign value './cmd/resource-metadata-server' to attribute 'main':
Value './cmd/resource-metadata-server' for main does not match expression '^(?:[\w.\\\/:]+)$'
in "/home/tamal/go/src/kmodules.xyz/resource-metadata/app.yaml", line 3, column 7
ERROR: (gcloud.app.deploy) An error occurred while parsing file: [/home/tamal/go/src/kmodules.xyz/resource-metadata/app.yaml]
Unable to assign value 'kmodules.xyz/resource-metadata/cmd/resource-metadata-server' to attribute 'main':
Value 'kmodules.xyz/resource-metadata/cmd/resource-metadata-server' for main does not match expression '^(?:[\w.\\\/:]+)$'
in "/home/tamal/go/src/kmodules.xyz/resource-metadata/app.yaml", line 2, column 7
问题似乎是我不允许在app.yaml的-
条目中使用main
。这是为什么?这个可以解决吗?
我正在使用
$ gcloud version
Google Cloud SDK 257.0.0
app-engine-go
app-engine-python 1.9.86
beta 2019.05.17
bq 2.0.46
cloud-datastore-emulator 2.1.0
core 2019.08.02
gsutil 4.41
答案 0 :(得分:0)
错误代码表明传递给main的字符串必须与正则表达式^(?:[\w.\\\/:]+)$
相匹配。这意味着提供的字符串必须与字符集内的任何字符匹配,例如/w
,可以是任何单词字符(字母数字和下划线),.
与.
字符{{ 1}}与\\
字符相匹配,\
与\/
字符相匹配,/
与:
字符相匹配。
请注意,在字符集中没有:
可以让您在main中提供的字符串中包含-
字符,同时遵守要约束的正则表达式。因此,只要此约束排除字符集中的-
,在尊重表达式其余部分的情况下,main属性中预期字符串的主体应该也排除-
。