上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 217 下一页

2021年10月18日

go module使用教程:使用go mod的方法.报错go: cannot determine module path for source directory

摘要: 使用go mod的方法 单独从大工程里拷出小文件想新建新文件工程时,部分文件路径名报红,出现报错go: cannot determine module path for source directory E:\tttttt (outside GOPATH, no import comments)1. 阅读全文

posted @ 2021-10-18 20:05 ExplorerMan 阅读(1522) 评论(0) 推荐(0) 编辑

2021年10月13日

golang三大基础mock大法

摘要: 一、使用gomonkey来mock函数和方法 1、mock函数 gomonkey.ApplyFunc(target,double) 其中target是被mock的目标函数,double是用户重写的函数。 注意点:重写的函数要和原函数入参和出参保持一致,否则会报错。 2、mock方法 gomonkey 阅读全文

posted @ 2021-10-13 14:16 ExplorerMan 阅读(2039) 评论(0) 推荐(0) 编辑

2021年10月12日

用vscode开发调试golang超简单教程

摘要: 目录 一、下载并安装vscode 二、安装Go插件 三、下载调试工具 四、打开现有go工程文件夹或新建go项目即可进行调试 五、问题处理 首先安装golang开发环境,这个不用说。 到这个页面下载golang 的安装包 https://studygolang.com/dl ,再安装就可以了。 一、下 阅读全文

posted @ 2021-10-12 21:25 ExplorerMan 阅读(4511) 评论(0) 推荐(0) 编辑

2021年10月9日

go语言 判断一个实例是否实现了某个接口interface

摘要: package main import "fmt" type Animal interface { run() walk() } type Dog struct { Id int } func (dog Dog) run() { fmt.Printf("I am Dog,I can Run!\n") 阅读全文

posted @ 2021-10-09 17:53 ExplorerMan 阅读(130) 评论(0) 推荐(0) 编辑

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 阅读(195) 评论(0) 推荐(0) 编辑

golang读写锁RWMutex

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

posted @ 2021-09-09 11:06 ExplorerMan 阅读(437) 评论(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 阅读(388) 评论(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 阅读(131) 评论(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 阅读(320) 评论(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 阅读(383) 评论(0) 推荐(0) 编辑

上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 217 下一页

导航