10 2021 档案

go micro metrics 接入Prometheus、Grafana
摘要:本文介绍go micro中加入metric, 并接入Prometheus、Grafana 1.go micro中间件加载prometheus plugins go micro中提供了prometheus plugins github.com/micro/go-plugins/wrapper/moni 阅读全文

posted @ 2021-10-24 23:39 ExplorerMan 阅读(395) 评论(0) 推荐(0)

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

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

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

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

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

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

导航