Go 1.11 已終止支援,並將於 2026 年 1 月 31 日
淘汰。淘汰後,您將無法部署 Go 1.11 應用程式,即使貴機構先前使用機構政策重新啟用舊版執行階段的部署作業也一樣。現有的 Go 1.11 應用程式在
淘汰日期過後,仍會繼續執行並接收流量。建議您
遷移至最新支援的 Go 版本。
定義執行階段設定
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
App Engine 中的 Go 1.11 應用程式是使用 app.yaml
檔案進行設定,當中包含執行階段、處理常式、資源調度,以及包含環境變數在內的其他一般設定。
app.yaml
檔案簡介
您可以在
app.yaml
檔案中指定 Go 1.11 應用程式的執行階段設定,包括版本和網址。這個檔案可做為特定
服務版本的部署作業描述元。
您必須先為應用程式的 default
服務建立 app.yaml
檔案,才能為其他服務建立及部署 app.yaml
檔案。
一般來說,app.yaml
檔案只需要 runtime
元素,即可在標準環境中執行簡易的 Go 1.11 應用程式,例如:
runtime: go111
如要進一步瞭解如何建構應用程式中的多項服務和
app.yaml
檔案,請參閱
為網路服務建立結構。
App Engine 會為所有其他設定提供預設值,包括用於決定應用程式可用的記憶體和 CPU 資源的 F1 執行個體類別,以及用於控制建立應用程式新執行個體的方式和時機的自動調整。
如果您需要覆寫預設設定,請建立 app.yaml
檔案並指定所需設定。詳情請參閱 app.yaml
檔案參考資料。
您可以為 app.yaml
檔案指定不重複的名稱,但稍後必須一併使用部署指令指定檔案名稱。舉例來說,如果您將 app.yaml
檔案命名為 service-name-app.yaml
或 app.standard.yaml
,就必須使用下列其中一種方式來部署應用程式:
gcloud app deploy service-name-app.yaml
gcloud app deploy app.standard.yaml
所有設定元素
如需這個設定檔中支援元素的完整清單,請參閱 app.yaml
參考資料。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-09-04 (世界標準時間)。
[[["容易理解","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-09-04 (世界標準時間)。"],[[["\u003cp\u003eA Go 1.11 app in App Engine uses an \u003ccode\u003eapp.yaml\u003c/code\u003e file to configure its runtime, handlers, scaling, environment variables, and other settings.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eapp.yaml\u003c/code\u003e file is essential for deploying a specific service version and must be created for the default service before adding others.\u003c/p\u003e\n"],["\u003cp\u003eA simple Go 1.11 app generally only needs the \u003ccode\u003eruntime\u003c/code\u003e element specified in its \u003ccode\u003eapp.yaml\u003c/code\u003e file, with other settings defaulting to App Engine's configurations.\u003c/p\u003e\n"],["\u003cp\u003eYou can customize the default settings of your app by creating an \u003ccode\u003eapp.yaml\u003c/code\u003e file and overriding the desired settings.\u003c/p\u003e\n"],["\u003cp\u003eWhile \u003ccode\u003eapp.yaml\u003c/code\u003e can be named uniquely, doing so requires you to specify the file's name in the deployment command.\u003c/p\u003e\n"]]],[],null,["# Defining Runtime Settings\n\nA Go 1.11 app in App Engine is configured using an `app.yaml`\nfile, that contains the runtime, handlers, scaling, and other general settings\nincluding environment variables.\n\nAbout `app.yaml` files\n----------------------\n\n\u003cbr /\u003e\n\nYou can specify the runtime configuration for your Go 1.11 app, including versions and URLs, in the `app.yaml` file. This file acts as a deployment descriptor of a specific [service](/appengine/docs/legacy/standard/go111/an-overview-of-app-engine) version.\n\nYou must first create the `app.yaml` file for the `default` service of your app\nbefore you can create and deploy `app.yaml` files for additional services.\n\n\nGenerally, your `app.yaml` file requires only the `runtime` element for a simple\nGo 1.11 app in the standard environment, for\nexample: \n\n runtime: go111\n\nTo learn more about structuring multiple services and `app.yaml` files in your app, see [Structuring Web Services](/appengine/docs/legacy/standard/go111/configuration-files).\n\nApp Engine provides default values for all other settings, including\nthe [F1 instance class](/appengine/docs/standard#instance_classes), which\ndetermines the memory and CPU resources that are available to your app, and\n[automatic scaling](/appengine/docs/legacy/standard/go111/how-instances-are-managed#scaling_types),\nwhich controls how and when new instances of your app are created.\n\nIf you need to override the default settings, create an `app.yaml` file and\nspecify the settings you need. For more information, see\n[`app.yaml` file reference](/appengine/docs/legacy/standard/go111/config/appref).\n\n\nYou can specify a unique name for your `app.yaml` files, but then you must\nspecify the file name with the [deployment\ncommand](/appengine/docs/legacy/standard/go111/testing-and-deploying-your-app)\nas well. For example, if you name your `app.yaml` file `service-name-app.yaml`\nor `app.standard.yaml`, then you must deploy your app using either: \n\n gcloud app deploy service-name-app.yaml\n gcloud app deploy app.standard.yaml\n\n\u003cbr /\u003e\n\nAll configuration elements\n--------------------------\n\n\nFor a complete list of all the supported elements in this configuration file,\nsee the\n[`app.yaml` reference](/appengine/docs/legacy/standard/go111/config/appref)."]]