1.在Go中文论坛下载最新的Go for windows release 2010-05-04
2.将下载包解压在c盘下。
![](http://student.csdn.net/image/zoom.gif)
![点击图片,在新窗口显示原始尺寸](http://student.csdn.net/attachment/201006/10/237699_127616385355zO.jpg)
3.设置环境变量。
- set goroot=c:\go
- set goarch=386
- set path=c:\go\bin
- set goos=windows
4.编写第一个go语言程序代码。
- package main
- import "fmt"
- func main(){
- fmt.Printf("this is first my\n go program")
- };
用记事本编写并保存为h.go,我保存在了c:\go\work下
![](http://student.csdn.net/image/zoom.gif)
![点击图片,在新窗口显示原始尺寸](http://student.csdn.net/attachment/201006/10/237699_1276163863p009.jpg)
5.编译并运行h.go文件
运行cmd,转到c:\go\work下分别输入
- 8g h.go
- 8l h.8
- 8.out
可以看到h.go编译并成功运行。也可以看到当前目录下有三个文件
![](http://student.csdn.net/image/zoom.gif)
![点击图片,在新窗口显示原始尺寸](http://student.csdn.net/attachment/201006/10/237699_1276163873GBBf.jpg)
6.go语言尚有待提高,在windows下中文会乱码,官方推荐notepad++编程,尚未试过,最终乱码问题我也尚未解决。go目录下也
有很多test例子。
评论