1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-23 20:02:22 +00:00
ch5-04-validator中的validator库的示例代码存在错误,原代码无法运行,此处修改后的代码可正常运行
This commit is contained in:
yangsijie666 2020-04-23 12:04:22 +08:00
commit 5d5cb7df1e
4 changed files with 9 additions and 4 deletions

View File

@ -2,7 +2,7 @@
- *赞助 BTC: 1Cbd6oGAUUyBi7X7MaR4np4nTmQZXVgkCW*
- *赞助 ETH: 0x623A3C3a72186A6336C79b18Ac1eD36e1c71A8a6*
- *Go语言付费QQ群: 1055927514*
- *Go语言QQ群: 102319854, 1055927514*
----
@ -54,6 +54,11 @@
1. [Go语言并发编程](https://talks.godoc.org/github.com/chai2010/awesome-go-zh/chai2010/chai2010-golang-concurrency.slide) - [chai2010](https://github.com/chai2010/awesome-go-zh/tree/master/chai2010) 武汉·光谷猫友会 2018/09/16, [整理01](https://mp.weixin.qq.com/s/UaY9gJU85dq-dXlOhLYY1Q)/[整理02](https://mp.weixin.qq.com/s/_aKNO-H11GEDA-l0rycfQQ)
1. 深入CGO编程: https://github.com/chai2010/gopherchina2018-cgo-talk
## 腾讯课堂·Go语言快递(免费)
https://ke.qq.com/course/2202273
![](weappCode-qq-ke.jpg)
## 网易云课堂·光谷码农课堂

View File

@ -269,10 +269,10 @@ func (a *Authentication) Auth(ctx context.Context) error {
var appid string
var appkey string
if val, ok := md["login"]; ok { appid = val[0] }
if val, ok := md["user"]; ok { appid = val[0] }
if val, ok := md["password"]; ok { appkey = val[0] }
if appid != a.Login || appkey != a.Password {
if appid != a.User || appkey != a.Password {
return grpc.Errorf(codes.Unauthenticated, "invalid token")
}

View File

@ -271,4 +271,4 @@ func entry() {
表驱动的设计方式,很多设计模式相关的书籍并没有把它作为一种设计模式来讲,但我认为这依然是一种非常重要的帮助我们来简化代码的手段。在日常的开发工作中可以多多思考,哪些不必要的`switch case`可以用一个字典和一行代码就可以轻松搞定。
当然,表驱动也不是缺点,因为需要对输入`key`计算哈希,在性能敏感的场合,需要多加斟酌。
当然,表驱动也不是没有缺点,因为需要对输入`key`计算哈希,在性能敏感的场合,需要多加斟酌。

BIN
weappCode-qq-ke.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB