関連 : Python2でutf8のbomを削除する - brainstorm TrimPrefixが使える package main import ( "bytes" "flag" "fmt" "io/ioutil" "os" ) var UTF8_BOM = []byte{239, 187, 191} func hasBOM(in []byte) bool { return bytes.HasPrefix(in, UTF8_BOM) } func stripBOM(in []byte) []byte { return bytes.TrimPrefix(in, UTF8_BOM) } func main() { flag.Parse() defer func() { if err := recover(); err != nil { fmt.Fprintln(os.Stderr, "er