简体   繁体   English

如何在appengine Go中使用与app.yaml不同的文件夹中的主包?

[英]How to use main package in different folder than app.yaml for appengine Go?

I am trying to upload a Go app to appegnine Go 1.12 runtime. 我正在尝试将Go应用程序上传到appegnine Go 1.12运行时。 My main pkg is under a cmd folder as shows https://cloud.google.com/appengine/docs/standard/go112/config/appref#runtime_and_app_elements 我的主要pkg在cmd文件夹下,如下所示:https://cloud.google.com/appengine/docs/standard/go112/config/appref#runtime_and_app_elements

But if I try any of the approaches outlines in the official docs, I get the following error: 但是,如果我尝试使用官方文档中概述的任何方法,则会收到以下错误消息:

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

The problem seems to be that I am not allowed to use - in the main entry in app.yaml. 问题似乎是我不允许使用-在app.yaml的main条目中。 Why is that? 这是为什么? Can this be fixed? 这个可以解决吗?

I am using 我在用

$ 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

The error code suggests that the string passed on to main must match the regex ^(?:[\\w.\\\\\\/:]+)$ . 错误代码表明传递给main的字符串必须与正则表达式^(?:[\\w.\\\\\\/:]+)$匹配。 This means that the supplied string must match any character inside the character set such as /w which can be any word character ( alphanumeric & underscore ), . 这意味着所提供的字符串必须设置诸如字符内部的任何字符匹配/w可以是任何字字符(字母数字和下划线), . which matches the . 与匹配. character, \\\\ which matches a \\ character, \\/ which matches a / character and : which matches a : character. 字符\\\\匹配\\字符, \\/匹配/字符和:匹配:字符。

Notice that there isn't a - in the character set which would allow you to include the - character in the string supplied in main while respecting the regex it is constrained to. 请注意,在字符集中没有-允许您在main中提供的字符串中包括-字符,同时遵守它所约束的正则表达式。 As such, so long as this constraint exclude - in the character set, main the expected string in the main attribute should be one that also excludes - while respecting the rest of the expression. 这样,只要此约束排除-在字符集中,main属性中的预期字符串应该也排除在外) -同时尊重表达式的其余部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM