有没有办法告诉Go中的文件类型(可执行文件,文本等)?

It there a built-in way to get a file type in Go?

Is it sufficient to guess from the filename alone (in Windows) or is there a way to tell only basically if the file is, say, an executable file? I'd like to find a cross-platform method of doing this, and reading a filename and working from that may miss executable files that are renamed to *.jpg.

You can either use MIME type guessing using mime.TypeByExtension or http.DetectContentType from the standard library or use third-party libmagic bindings, e.g. magicmime.