Go for Windows download: http://code.google.com/p/go-windows/, http://savechina.download.csdn.net/
DOS execution is required before use.
Set goroot = <The go folder>
Set GOOS = mingw
Sets goarch = 386
Set Path = <The go folder>/bin
Compile and execute the test. Go file.
8g test. Go // compile and generate test.8
8l test.8 // connect to produce 8.exe
8 // execute 8.exe
Example:
Package main
Import "FMT"
Func main (){
FMT. Print ("Hello, world \ n ")
}
Ensure that go files are stored in UTF-8 format without BOM characters.
1. Execute chcp 65001 in DOS // modifyCodeThe page is UTF-8; otherwise, compilation fails.
2. Change the DOS window font to new; otherwise, garbled characters are displayed.
3. The chcp does not seem to support batch file processing.
If you write a bat program for compilation and execution, failure is not a matter of your character.
4. For BOM details, see http://en.wikipedia.org/wiki/byte_order_mark. the editor notepad under Windows automatically adds three bytes at the beginning of the file when saving the UTF-8 file. The content is ef bb bf. You can use vim or notepad ++ to edit the code. If editplus is used, mark "do not add byte order to UTF-8 file" in tool-Parameter Selection-file. No editplus? You can write a go file to delete the three bytes starting with the specified file.