以下代码用到Go1标准库fmt和expvar,仅两行代码,结果编译生成的EXE超大,达 3.2 MB。我的系统是 Windows 7, x86。按说,如果仅仅输出 fmt.Println("Hello world"),EXE应该在 1.1 MB 是比较正常的表现。编译方法:go build expvar.go--------------------------------------------------------package mainimport ("fmt""expvar")func main() {fmt.Println("Hello, Go1. This is liigo.")expvar.Do(func(kv expvar.KeyValue){ fmt.Printf("\n%s=%s\n",kv.Key,kv.Value) })}
--
来自: Golang-China ~ 中文Go语言技术邮件列表
详情: http://groups.google.com/group/golang-china
官网: http://golang-china.org/
IRC: irc.freenode.net #golang-china
@golangchina
fango