查看操作系统平台和内核版本:uname -a Mac 下编译 Linux 和 Windows 64位可执行程序 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build main.go CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build main.go Linux 下编译 Mac 和 Windows 64位可执行程序 CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build main.go CGO_ENABLED=0 GOOS=windows……
压力测试 ab wrk ab为Apache内置 ab -n1000 -c10 http://localhost:8080/ 1000次请求 10个并发,分析 Requests per second 字段 Server Software: Iris: Server Hostname: localhost Server Port: 8080 Document Path: / Document Length: 5368 bytes Concurrency Level: 10 Time taken for tests: 0.758 seconds Complete requests: 1000 Failed……
路由配置规则 直接通过 function 绑定 controller,function name 映射到 路由的地址 function named rule: func(*Controller) GetLoginBy(id int64) 绑定的controller HTTP-method+routePath map to - GET:/user/login/{param:long} 通……
文档 go doc text/template $ go doc html/template 应用 func main() { // 定义模板显示格式 const templ = `<p>A: {{.A}}</p><p>B: {{.B}}</p>` // 模板配置函数 t := template.Must(template.New("escape").Parse(templ)) var data struct { A string // untrusted plain text B template.HTML // trusted HTML } // A是一个普通字符串,B是一个……