以下 app.yaml 演示了如何将应用配置为使用最新 Go 版本。如需使用任何其他受支持版本的 Go,您必须更新 app.yaml 文件。如需了解详情,请参阅 Go 运行时。
runtime:goenv:flexruntime_config:operating_system:'ubuntu22'# This sample incurs costs to run on the App Engine flexible environment.# The settings below are to reduce costs during testing and are not appropriate# for production use. For more information, see:# https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-with-app-yamlmanual_scaling:instances:1resources:cpu:1memory_gb:0.5disk_size_gb:10
您可能只需在相应的 app.yaml 文件中定义几个元素,具体取决于应用服务的复杂程度。以下示例演示了简单的 Go 应用可能需要在柔性环境中定义的元素:
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-04-03。"],[[["The `app.yaml` file is essential for configuring an App Engine app, defining its CPU, memory, network, disk resources, scaling, and environment variables."],["You can specify the Go runtime version and URLs within the `app.yaml` file, which acts as the deployment descriptor for a specific service version."],["The `app.yaml` file for the default service of your app must be created before creating and deploying `app.yaml` files for additional services."],["While you can rename `app.yaml` files, using a custom name necessitates specifying the file name in the deployment command."],["Some Go runtimes have reached their end of support, therefore, it's advised that you upgrade to the latest version of Go, and note that you will not be able to redeploy versions after their end of support date."]]],[]]