摘要: Go中使用*号表示指针,但是没有指针算数,不能对其进行加减。同时内存管理都由Go来负责,不需要拖动释放内存。Go中的函数接收者,可以为值类型,也可以是引用类型。看代码:package main import ("fmt") type Rect struct {X, Y,Area,Length flo... 阅读全文
posted @ 2015-03-20 21:47 klain 阅读(1901) 评论(0) 推荐(1) 编辑
摘要: Go中的ioutil包可以方便的实现文件读写。代码:package main import ("fmt""io/ioutil") func main() {filename := "test.txt"data := []byte("hello")ioutil.WriteFile(filename, ... 阅读全文
posted @ 2015-03-20 21:44 klain 阅读(405) 评论(0) 推荐(0) 编辑