随笔分类 -  Go

摘要://type:interface value:sturctfunc PrintStruct(t reflect.Type, v reflect.Value, pc int) { fmt.Println("") for i := 0; i < t.NumField(); i++ { ... 阅读全文
posted @ 2015-01-24 17:31 yumuxu 阅读(3290) 评论(0) 推荐(0)
摘要:1 package main 2 3 import ( 4 "fmt" 5 "reflect" 6 ) 7 8 const ( 9 cmask = 12710 )11 12 func main() {13 var u uint814 u = 2215 ... 阅读全文
posted @ 2015-01-08 15:16 yumuxu 阅读(188) 评论(0) 推荐(0)
摘要:1 // golang 查看变量的类型 2 // 1.switch 中使用i.(type) 3 // 2.使用反射 reflect.TypeOf(i) 4 package main 5 6 import ( 7 "fmt" 8 "reflect" 9 )10 11 func Us... 阅读全文
posted @ 2015-01-07 14:26 yumuxu 阅读(452) 评论(0) 推荐(0)
摘要:strconv 包括 四 类函数1.Append 类,例如 AppendBool(dst []byte, b bool)[]byte,将值转化后添加到[]byte的末尾2.Format 类,例如FormatBool(b bool) string,将bool float int uint 类型的转换为... 阅读全文
posted @ 2014-11-07 17:46 yumuxu 阅读(1422) 评论(0) 推荐(0)
摘要:1 package main 2 3 import ( 4 "fmt" 5 "strconv" 6 "time" 7 ) 8 9 const LOOP = 10000010 11 var num int64 = 1012 13 func main() {14 s... 阅读全文
posted @ 2014-11-05 20:15 yumuxu 阅读(1877) 评论(0) 推荐(0)
摘要:1 //autoInc.go 2 3 package autoInc 4 5 type AutoInc struct { 6 start, step int 7 queue chan int 8 running bool 9 }10 11 func ... 阅读全文
posted @ 2014-10-31 10:32 yumuxu 阅读(698) 评论(0) 推荐(0)
摘要:go 自带了notepad++的语法高亮配置,只需要在notepad++里导入即可:1. 打开go的安装目录misc\notepadplus下的userDefineLang.xml,把开头的和结尾的的注释取消掉2. 把misc\notepadplus目录下的go.xml放到notepad++安装目录... 阅读全文
posted @ 2014-10-29 18:59 yumuxu 阅读(308) 评论(0) 推荐(0)
摘要:// Fields 以连续的空白字符为分隔符,将 s 切分成多个子串,结果中不包含空白字符本身// 空白字符有:\t, \n, \v, \f, \r, ' ', U+0085 (NEL), U+00A0 (NBSP)// 如果 s 中只包含空白字符,则返回一个空列表func Fields(s str... 阅读全文
posted @ 2014-10-29 15:45 yumuxu 阅读(5443) 评论(0) 推荐(0)