Build Tags
Build tags ช่วยให้ compile โค้ดตามเงื่อนไข เช่น OS, architecture, หรือ custom flags
Build Constraints พื้นฐาน
Section titled “Build Constraints พื้นฐาน”//go:build linux// +build linux
package main
// ไฟล์นี้จะถูก compile เฉพาะบน LinuxGo 1.17+ ใช้
//go:buildแต่// +buildยังใช้ได้สำหรับ compatibility
OS-specific Code
Section titled “OS-specific Code”//go:build linux
package logger
import "syscall"
func openLog() { // Linux-specific implementation syscall.Syslog(...)}เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google