Skip to content
เข้าสู่ระบบ

Build Tags

Build tags ช่วยให้ compile โค้ดตามเงื่อนไข เช่น OS, architecture, หรือ custom flags

//go:build linux
// +build linux
package main
// ไฟล์นี้จะถูก compile เฉพาะบน Linux

Go 1.17+ ใช้ //go:build แต่ // +build ยังใช้ได้สำหรับ compatibility

logger_linux.go
//go:build linux
package logger
import "syscall"
func openLog() {
// Linux-specific implementation
syscall.Syslog(...)
}

เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม

ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด