随笔分类 - Go
参考:《Go Web 编程》
摘要:1. 标准库 标准库math中定义了各种数字类型的取值范围 const ( MaxInt8 = 1<<7 - 1 MinInt8 = -1 << 7 MaxInt16 = 1<<15 - 1 MinInt16 = -1 << 15 MaxInt32 = 1<<31 - 1 MinInt32 = -1
阅读全文
摘要:``` package main import ( "context" "fmt" "io" "io/ioutil" "log" "net" "net/http" "time" ) var handlersMap = make(map[string]http.HandlerFunc) func f1
阅读全文
摘要:```
package main import ( "fmt" "net/http"
) type DB struct{ name string age int
} var gdb DB = DB{"catty",26} func get(w http.ResponseWriter, req *http.Request) { // The "/" pattern matches ...
阅读全文
摘要:参考: 《Go Web 编程》 1. go 实现的基于REST的Web服务 go // webserver project server.go package main import ( "encoding/json" "fmt" "net/http" //"strconv" ) type Post
阅读全文