07 2018 档案
摘要:go是一门非常简洁,但很高效的语言。当我接触这门新语言的时候,我不大喜欢从头看 一门大部头的书,而是从简单的语法学习。我记得我第一次学go的时候,那时介绍go的书不多, 后来从网上下载了一本the little go book,在从杭州回武汉的火车上看完了,至今印象还是很深刻。 这对我以后理解go语
阅读全文
摘要:package main import ( "errors" "fmt" ) const ( ACT = 1 TASK = 2 ) type Quest struct { Id int QuestType int Process int Status int } type Questier interface { DoAction(Quest)...
阅读全文
摘要:package main import "fmt" var singleton *Singleton type Singleton struct { Count int } func GetSingleton() *Singleton { if singleton == nil { singleton = &Singleton{} return singleton } r...
阅读全文
摘要:游戏中加经验的地方很多,很多人写的很乱,我把这个功能用比较简单且清晰的方法写了下来。代码如下: package main import ( "fmt" "log" "github.com/emirpasic/gods/maps/treemap" ) func main() { exp := []int{ 20, 30, 40, 50, 70, 300, 350...
阅读全文
摘要: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 ...
阅读全文
摘要: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[...
阅读全文
摘要:package main import ( "fmt" "time" ) func main() { // ticker inner use chanel ticker := time.NewTicker(time.Second) for { <-ticker.C fmt.Println("tick!") } }
阅读全文
摘要: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...
阅读全文
摘要: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]...
阅读全文
摘要: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...
阅读全文
摘要:cd projecy/dir golint foldier name
阅读全文
摘要:go get -u github.com/golang/lint/golint
阅读全文
摘要:文件名含有特殊字符,直接使用 rm 可能删除不了,可以使用如下方法:1) 使用 ls -i 查处该文件的 inode 号,假设为6543212) 使用find命令删除 find ./ -inum 654321 -exec rm '{}' \;
阅读全文
摘要:创建一个node.js express类型的app
阅读全文
摘要:rubymine报找不到No Ruby interpreter configured for the project
阅读全文
摘要:执行powershell脚本报错解决办法
阅读全文

浙公网安备 33010602011771号