Deploy แอป Go
Build หนึ่ง module เป็น native service
ตั้งค่า executable
เลือก Go และ directory ที่มี go.mod ค่า Main package เป็น . หรือ local package เช่น ./cmd/api ไม่ใช่ filename, wildcard หรือ shell command และต้องเป็น package main Commit go.mod/go.sum ให้ตรงกัน สำหรับ Web ตั้ง health path และอ่าน PORT/HOST (127.0.0.1) ที่ Portal สงวนไว้ ส่วน Worker รัน process ต่อเนื่อง ไม่ตรวจ HTTP และไม่เติม PORT/HOST โดยยังใช้ build contract ของ binary เดิม
เงื่อนไขการ build
go mod download
go list -mod=readonly -f {{.Name}} ./cmd/api
go build -mod=readonly -trimpath -o hostmgr-app ./cmd/apiGo ต้อง build เสมอ ใช้ CGO_ENABLED=0, GOWORK=off และ GOTOOLCHAIN=local กับ compiler บนเครื่องและหนึ่ง module ไม่ดาวน์โหลด toolchain อัตโนมัติหรือส่ง Git credential ให้ private modules ใช้ Compose หากต้องมี cgo, system libraries หรือหลาย modules ใน workspace
ตรวจ compiler ก่อนใช้งาน
ตรวจ Go ใน Setup และ executable บน host จริง Installer ปัจจุบันประกาศ Go version แต่ไม่มีขั้นดาวน์โหลด/ติดตั้ง Go จึงไม่ควรยึดข้อความเก่าที่บอกว่าติดตั้งให้อัตโนมัติ ให้ผู้ดูแลเตรียม compiler บน host ส่วน Docker สำหรับทดลองไม่มี Go compiler และ candidate HTTP ผ่านยังไม่ยืนยัน systemd/TLS activation