摘要: package main import ( "fmt" "sync" ) func main() { var mapInt = new(sync.Map) //add elem mapInt.Store(1, 1) mapInt.Store(2, 2) mapInt.Store(3, 3) fmt.Println("before delete ... 阅读全文
posted @ 2018-07-29 22:03 星空42 阅读(2055) 评论(0) 推荐(0) 编辑
摘要: package main import ( "encoding/json" "log" "reflect" "github.com/sanity-io/litter" ) func main() { type Item struct { Id int `json:"id"` Num int `json:"num"` } var itemMap = make(map[... 阅读全文
posted @ 2018-07-29 21:54 星空42 阅读(1071) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "time" ) func main() { // ticker inner use chanel ticker := time.NewTicker(time.Second) for { <-ticker.C fmt.Println("tick!") } } 阅读全文
posted @ 2018-07-29 21:47 星空42 阅读(224) 评论(0) 推荐(0) 编辑
摘要: package main import ( "time" "github.com/sanity-io/litter" ) func main() { var sliceChan = make(chan []int) go func(c chan []int) { for { select { case <-c: litter.Dump(<-c) def... 阅读全文
posted @ 2018-07-29 21:42 星空42 阅读(726) 评论(0) 推荐(0) 编辑
摘要: package main import ( "github.com/sanity-io/litter" ) func main() { var mapInt = make(map[int]int) // add for i := 1; i < 10; i++ { mapInt[i] = i } litter.Dump(mapInt) // update mapInt[3]... 阅读全文
posted @ 2018-07-29 21:36 星空42 阅读(787) 评论(0) 推荐(0) 编辑
摘要: package main import "github.com/sanity-io/litter" // slice增删改查,很实用 func main() { var sliceInt []int // init sliceInt = append(sliceInt, []int{1, 2, 3, 4}...) litter.Dump(sliceInt) // remove ind... 阅读全文
posted @ 2018-07-29 21:26 星空42 阅读(463) 评论(0) 推荐(0) 编辑
摘要: cd projecy/dir golint foldier name 阅读全文
posted @ 2018-07-28 14:26 星空42 阅读(621) 评论(0) 推荐(0) 编辑
摘要: 编译golint 阅读全文
posted @ 2018-07-28 14:20 星空42 阅读(273) 评论(0) 推荐(0) 编辑
摘要: go get -u github.com/golang/lint/golint 阅读全文
posted @ 2018-07-28 13:45 星空42 阅读(764) 评论(0) 推荐(0) 编辑
摘要: 文件名含有特殊字符,直接使用 rm 可能删除不了,可以使用如下方法:1) 使用 ls -i 查处该文件的 inode 号,假设为6543212) 使用find命令删除 find ./ -inum 654321 -exec rm '{}' \; 阅读全文
posted @ 2018-07-28 11:01 星空42 阅读(1009) 评论(0) 推荐(1) 编辑