
Go
文章平均质量分 82
Thread刚
这个作者很懒,什么都没留下…
展开
-
Golang正确停止Ticker
Golang可以利用time包的Ticker实现定时器的作用,最近使用Ticker时,发现调用Ticker的Stop方法无法正确的停止Ticker,协程会阻塞在等待Ticker的C通道处,精简后的代码如下: func UseTickerWrong() *time.Ticker { ticker := time.NewTicker(5 * time.Second) go func(ticker *time.Ticker) { for range ticker.C { fmt.Println(“Ticker1…原创 2020-12-22 11:06:40 · 810 阅读 · 0 评论 -
etcd undefined: resolver.BuildOption
使用ETCD clientv3包,遇到以下错误. 使用了go mod 首先初始化 go mod init 接着go build 出现下面问题 github.com/coreos/etcd/clientv3/balancer/resolver/endpoint ..\..\..\..\pkg\mod\github.com\coreos\etcd@v3.3.18+incompatible\c...原创 2020-03-10 13:33:50 · 2304 阅读 · 4 评论 -
VS code 编辑器配置GO开发环境
方法一:使用git下载源代码再安装 我们可以手动从github上下载工具,(执行此步骤前提需要你的电脑上已经安装了git) 第一步:现在自己的GOPATH的src目录下创建golang.org/x目录 第二步:在终端/cmd中cd到GOPATH/src/golang.org/x目录下 第三步:执行git clone https://github.com/golang/tools.git t...转载 2019-12-09 20:39:08 · 301 阅读 · 0 评论 -
go实现定期发送邮件
1.首先安装依赖包 安装依赖包: go get github.com/go-gomail/gomail go get github.com/tealeg/xlsx 2.创建main.go package main import ( "testing" "time" "github.com/tealeg/xlsx" //插件 "log" "fmt...原创 2019-12-01 15:36:31 · 953 阅读 · 0 评论 -
Golang出现的奇怪的问题
编译时 C:\Go\pkg\tool\windows_amd64\link.exe: cannot open file C:\Go\pkg\windows_amd64/github.com/boltdb/bolt.a: open C:\Go\pkg\windows_amd64/github.com/boltdb/bolt.a: The system cannot find the file sp...原创 2019-11-26 22:17:48 · 918 阅读 · 0 评论 -
Linux 下安装Go
我的配置 VPS:VirMach $1.25一个月的VPS 系统:Ubuntu Server 16.04 LTS 64bit Minimal 可以自己创建个虚拟机安装一个Server版的Linux,或者在这里选一个共享主机 登录Linux Mac或Linux的用户可以用命令ssh root@xxx.xxx.xxx.xxx登录主机 Window的用户可以使用SecureCRT登录主机 虚拟机...转载 2019-09-29 20:46:31 · 145 阅读 · 0 评论