以下 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"]],["上次更新時間:2025-07-08 (世界標準時間)。"],[[["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."]]],[]]