blog-service
blog-service copied to clipboard
《Go 语言编程之旅:一起用 Go 做项目》第二章:博客程序(HTTP Server)
如果不处理 locale 字段为空的情况,大部分时候可以正常响应,但是针对部分极端的边界情况,例如某个字段校验规则为 binding:"min=1",但是传参时使用空字符串 "",会导致请求异常   
报错内容: init.setupSetting err: While parsing config: yaml: line 11: did not find expected key 我将yaml直接替换为示例文件中的 yaml 编译是没问题的,但是把示例文件中除此章节涉及内容外多余部分删除,只保留此小节涉及内容,编译就会报错,挺奇怪。 反复检查很多次,并不是 yaml 格式的问题。
win10系统 go 1.16 复制文章源码或当前目录下源码到系统报错 `go: blog-service/pkg/app: package github.com/go-playground/universal-translator imported from implicitly required module; to add missing requirements, run: go get github.com/go-playground/[email protected] go: blog-service/internal/middleware: package github.com/go-playground/locales/en imported from implicitly required module;...
r.POST("/auth", api.GetAuth)改为r.GET("/auth", api.GetAuth)
time.Now().Local().UnixNano() 的Local多此一举 时间戳是全世界统一的 if len(l.fields) > 0 也可以去掉
并发情况下会产生map线程安全问题
第二章 2.6 节中, models 回调用的是 gorm 1.0 版本,请问在 gorm 2.0 版本中如何处理?
程序启动: ``` global.AppSetting.DefaultContextTimeout *= time.Second global.JWTSetting.Expire *= time.Second global.ServerSetting.ReadTimeout *= time.Second global.ServerSetting.WriteTimeout *= time.Second ``` 热更新: ``` func (s *Setting) ReloadAllSection() error { for k, v := range sections {...
在知乎买的书,里面的sql竟然是图片截图...