使用goland寫struct,定義json tag
默認是用snake_case
命名,也就是下劃線寫法
type Hello struct {
HelloWorld string `json:"hello_world"`
}
把表達式由camelCase(fieldName())
改爲camelCase(fieldName())
即可修改爲小駝峯
type Hello struct {
HelloWorld string `json:"helloWorld"`
}
使用goland寫struct,定義json tag
默認是用snake_case
命名,也就是下劃線寫法
type Hello struct {
HelloWorld string `json:"hello_world"`
}
把表達式由camelCase(fieldName())
改爲camelCase(fieldName())
即可修改爲小駝峯
type Hello struct {
HelloWorld string `json:"helloWorld"`
}
本文使用go標準庫log進行日誌記錄 1.編寫自定義日誌收集器 package logger import ( "io" "log" "os" ) var ( Info *log.Logger