![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
go
江湖人称黑哥
这个作者很懒,什么都没留下…
展开
-
go的交差编译
gox 是一个交叉编译的辅助工具,项目地址在 https://github.com/mitchellh/gox使用 go get github.com/mitchellh/gox 进行安装后会在 $GOPATH/bin 目录下生成 gox.exe,为了方便以后使用,最好拷到 c:\go\bin 目录下。然后进入到项目目录,执行 gox 即可一次性完成所有平台的编译。$ goxNumber...原创 2020-03-14 18:06:26 · 189 阅读 · 0 评论 -
gin结合go-redis根据ip完成访问频率限制
import ( "time" "github.com/go-redis/redis")// Limiter 定义属性type Limiter struct { // Redis client connection. rc *redis.Client}// 根据redisURL创建新的limiter并返回func NewLimiter(redisURL string) (...翻译 2020-02-29 11:52:51 · 2891 阅读 · 0 评论 -
gin统一返回 状态码
返回错误信息func generateErrors(err error, key string) map[string][]string { if err == nil { return nil } if key == "" { key = "system" } if vErr, ok := err.(service.ValidateErrors); ok { ret...原创 2020-03-05 10:45:39 · 2484 阅读 · 0 评论 -
gin解决CORS跨域问题
package mainimport ( "time" "github.com/gin-contrib/cors" "github.com/gin-gonic/gin")func main() { router := gin.Default() // CORS for https://foo.com and https://github.com origins, allowi...原创 2020-03-04 16:50:14 · 5669 阅读 · 0 评论