上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 24 下一页
摘要: package main import ( "fmt" "sync" ) type object interface{} type Set struct { m map[object]bool sync.RWMutex //线程安全实现,记录下 } //初始化 func New() *Set { return &Set{ m: map... 阅读全文
posted @ 2019-05-17 17:18 wujf 阅读(860) 评论(0) 推荐(0) 编辑
摘要: 方式一 方式二 阅读全文
posted @ 2019-05-17 16:19 wujf 阅读(5980) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "math/rand" ) func main() { ch := make(chan int) done := make(chan bool) f := make(chan bool) go func() { for { select { ... 阅读全文
posted @ 2019-05-17 16:17 wujf 阅读(512) 评论(0) 推荐(0) 编辑
摘要: 1 前言相信有一定java开发经验的人或多或少都会遇到OutOfMemoryError的问题,这个问题曾困扰了我很长时间,随着解决各类问题经验的积累以及对问题根源的探索,终于有了一个比较深入的认识。 在解决java内存溢出问题之前,需要对jvm(java虚拟机)的内存管理有一定的认识。jvm管理的内 阅读全文
posted @ 2019-05-09 14:22 wujf 阅读(8239) 评论(0) 推荐(0) 编辑
摘要: 背景:坑货同事写代码一点规范都没有,瞎写,根据url没法直接定位到方法,无奈产生了此接口,程序员何苦为难程序员呢 阅读全文
posted @ 2019-04-30 15:39 wujf 阅读(941) 评论(0) 推荐(0) 编辑
摘要: func selects() { db, err := sql.Open("mysql", "root:root@tcp(127.0.0.1:3306)/test?charset=utf8&parseTime=True&loc=Local") checkErr(err) // 查询数据 //查询数据,取所有字段 rows2, _ := db.Query("... 阅读全文
posted @ 2019-04-15 10:53 wujf 阅读(1776) 评论(0) 推荐(0) 编辑
摘要: "github.com/satori/go.uuid" uid, _ := uuid.NewV4()放在gin的context里玩耍 //c.Set("uuid", uid)//应用里面打日志//uid,_:= c.Get("uuid") 阅读全文
posted @ 2019-04-13 14:23 wujf 阅读(3349) 评论(0) 推荐(0) 编辑
摘要: 打window包直接go build一下,完事, 但是,打linux包出现如下错误 ..\github.com\mattn\go-isatty\isatty_linux.go:7:8: cannot find package "golang.org/x/sys/unix" in any of: 解决 阅读全文
posted @ 2019-04-13 11:24 wujf 阅读(1284) 评论(0) 推荐(0) 编辑
摘要: func Cors(c *gin.Context) { c.Header("Access-Control-Allow-Origin", "*") c.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token") c.Header("... 阅读全文
posted @ 2019-04-13 10:52 wujf 阅读(470) 评论(0) 推荐(0) 编辑
摘要: 1、定义中间件 2、对要拦截的路由进行分组并引入中间件 3、测试 分别查看http://127.0.0.1:8088/api/ping和http://127.0.0.1:8088/ping,可以看出一个会输出“我是中间件”,一个不会输出 4、结论 什么权限、登陆、token之类的就这样起飞吧 阅读全文
posted @ 2019-04-13 10:47 wujf 阅读(1446) 评论(0) 推荐(0) 编辑
上一页 1 ··· 8 9 10 11 12 13 14 15 16 ··· 24 下一页