上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 234 下一页

2021年9月9日

golang,函数参数传递的sync.Mutex不是指针会怎么样

摘要: package main import ( "fmt" "sync")var a = 1func main() { lock := sync.Mutex{} wg := &sync.WaitGroup{} wg.Add(2) go t(lock,wg) go t(lock,wg) wg.Wait() 阅读全文

posted @ 2021-09-09 11:24 ExplorerMan 阅读(235) 评论(0) 推荐(0)

golang读写锁RWMutex

摘要: 读写锁是针对读写的互斥锁 基本遵循两大原则: 1、可以随便读,多个goroutine同时读 2、写的时候,啥也不能干。不能读也不能写 RWMutex提供了四个方法: func (*RWMutex) Lock // 写锁定 func (*RWMutex) Unlock // 写解锁 func (*RW 阅读全文

posted @ 2021-09-09 11:06 ExplorerMan 阅读(475) 评论(0) 推荐(0)

golang_并发安全: slice和map并发不安全及解决方法

摘要: golang_并发安全: slice和map并发不安全及解决方法 Grayan · 2020-07-21 15:32:48 · 1771 次点击 · 预计阅读时间 1 分钟 · 不到1分钟之前 开始浏览 这是一个创建于 2020-07-21 15:32:48 的文章,其中的信息可能已经有所发展或是发 阅读全文

posted @ 2021-09-09 10:55 ExplorerMan 阅读(506) 评论(0) 推荐(0)

什么情况下需要用到互斥锁sync.Mutex?

摘要: package mainimport ( "fmt" "runtime" "time")var a intfunc main() { runtime.GOMAXPROCS(runtime.NumCPU()) ch := make(chan int) for i :=0;i<1000;i++{ go 阅读全文

posted @ 2021-09-09 10:53 ExplorerMan 阅读(146) 评论(0) 推荐(0)

2021年9月8日

使用Charles进行HTTPS抓包

摘要: 背景: 在进行App测试或定位线上问题时,经常会遇到抓取HTTPS数据包的需求。一般在windows上会使用fiddler,Mac上使用Charles。对于https请求,抓到的数据因为经过了加密,只能看到乱码。 本文介绍如何使用Charles来抓取https网络报文。操作步骤已在MAC + iph 阅读全文

posted @ 2021-09-08 19:32 ExplorerMan 阅读(441) 评论(0) 推荐(0)

2021年9月7日

centos6 yum 源失效 404,终于解决了

摘要: YumRepo Error: All mirror URLs are not using ftp, http[s] or file.Eg. Invalid release/repo/arch combination/removing mirrorlist with no valid mirrors: 阅读全文

posted @ 2021-09-07 22:26 ExplorerMan 阅读(440) 评论(0) 推荐(0)

GOMAXPROCS你设置对了吗?

摘要: 1. 前言 有圈子的朋友介绍 uber-go/automaxprocs, 我才发现之前在docker中, Golang程序设置的GOMAXPROCS不正确,有必要在重新回顾一下了。 2. Go 调度器: M, P 和 G 我们知道在Go scheduler中,G代表goroutine, P代表Log 阅读全文

posted @ 2021-09-07 21:15 ExplorerMan 阅读(2918) 评论(0) 推荐(0)

容器资源可见性问题与 GOMAXPROCS 配置

摘要: Go 程序启动时候会根据 CPU 数量设置 GOMAXPROCS,比如下面的程序中在 8 核处理下输出为 8。 package main import ( "runtime" ) func main() { println(runtime.NumCPU()) } 当我们使用 Docker 的时候也是 阅读全文

posted @ 2021-09-07 21:14 ExplorerMan 阅读(813) 评论(0) 推荐(0)

2021年8月26日

windows下 charles 手机app抓包

摘要: windows下抓包 下载地址https://www.charlesproxy.com/latest-release/download.do 打开charles proxy -> proxy setting Port改为 8888 (这个随意 自己要记住 端口号做好高于或等于8888) 随便下载一个 阅读全文

posted @ 2021-08-26 15:24 ExplorerMan 阅读(308) 评论(0) 推荐(0)

2021年8月18日

Go语言参数校验(go-playground / validator)——基本使用

摘要: Go语言没有像Java一样的注解快速进行参数的校验,但可以通过struct tag(结构体标签)进行序列化。常用的如: type User struct { ID string `json:"id"` Name string `json:"name"` Age string `json:"age"` 阅读全文

posted @ 2021-08-18 16:11 ExplorerMan 阅读(1413) 评论(0) 推荐(1)

上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 234 下一页

导航