
go
esrrhs
http://www.esrrhs.xyz/
展开
-
go跨平台编译
sudo GOARCH=mips GOOS=linux go build原创 2019-01-12 09:16:30 · 804 阅读 · 1 评论 -
golang源代码——go编译器
go/src/pkg/runtime/proc.c:247go/src/cmd/go/main.go:111原创 2014-12-11 20:40:02 · 1387 阅读 · 0 评论 -
Go string to ascii byte array
Go string to ascii byte arraybyteArray := []byte(myString)原创 2014-06-03 12:46:40 · 2153 阅读 · 0 评论 -
网络消息代码生成gencode
通过xml定义生成代码,支持数组变长数组结构体嵌套等,能满足常用需求原创 2014-04-26 21:08:24 · 1113 阅读 · 0 评论 -
golang的pprof支持
import "runtime/pprof"原创 2014-04-24 23:31:28 · 874 阅读 · 0 评论 -
golang解析xml,去掉重复项
package mainimport ( "encoding/xml" "fmt" "mahonia" "os" "strconv" "text/template")type Attribute struct { Name string Value string}type Token struct { Name string Attributes原创 2014-03-25 22:03:32 · 2161 阅读 · 0 评论 -
golang动态解析xml
package mainimport ( "encoding/xml" "fmt" "mahonia" "os" "strconv" "text/template")type Attribute struct { Name string Value string}type Token struct { Name string Attributes原创 2014-03-24 22:49:28 · 3530 阅读 · 0 评论 -
golang按行读取文件
f, err := os.Open("test.txt") if err != nil { panic(err) } defer f.Close() rd := bufio.NewReader(f) for { line, err := rd.ReadString('\n') //以'\n'为结束符读入一行原创 2014-02-15 14:41:09 · 5091 阅读 · 0 评论 -
golang转换gbk编码的问题
下载包 code.google.com/p/mahonia放到go的src目录里代码func iconv(str string) string { enc := mahonia.NewEncoder("gb2312") return enc.ConvertString(str)}原创 2014-01-18 18:20:47 · 4409 阅读 · 0 评论 -
golang的template实现自定义的循环
代码写func genlist(n string) []string { num, _ := strconv.Atoi(n) ret := make([]string, num) for i := 0; i < num; i++ { ret[i] = strconv.Itoa(i) } return ret}func output(src s原创 2014-01-17 18:20:33 · 2525 阅读 · 0 评论 -
golang工具基础——xml、template
go文件package main import ( "fmt" "encoding/xml" "os" "text/template")type Member struct { Name string `xml:"name,attr"` Comment string `xml:"comment,attr"`}type Struct struct { Name st原创 2014-01-15 21:52:08 · 1864 阅读 · 0 评论 -
golang编译调试选项
go build -gcflags "-N -l"原创 2014-01-16 11:53:13 · 3155 阅读 · 0 评论 -
Go1.2在win8下无法正常编译
坑爹,在win7下就正常使用了,win8下总提示can't find import xxx,这个xxx是自己写的package原创 2013-12-10 15:07:27 · 651 阅读 · 1 评论 -
go的protobuffer安装
windows环境下:1.首先,必须先的有go,默认安装在了C:\Go2.然后下载protoc,https://code.google.com/p/protobuf/downloads/list,下一个二进制文件即可,为了方便,可以直接放到C:\GO\bin里面3.配置GOPATH,这个就是你go工程的地方,应该早配置好了,比如D:\project\xxx4.cmd里运行go原创 2013-12-10 17:06:18 · 1956 阅读 · 0 评论