golang subprocess tests
摘要:# golang Subprocess testsSometimes you need to test the behavior of a process, not just a function.```gofunc Crasher() { fmt.Println("Going down in flames!") os.Exit(1)}```To test this code, we ...
阅读全文
posted @
2018-05-18 23:03
baizx
阅读(250)
推荐(0) 编辑
go test 高级技巧
摘要:Go advanced testing tips & tricks This post is based on talk I gave at Vilnius Golang meetup. I have read many blogs, watched talks and gathered all t
阅读全文
posted @
2018-05-17 09:51
baizx
阅读(1494)
推荐(0) 编辑
go 笔记
摘要:# go 笔记# defer defer 的参数绑定是在 defer 时,而不是在执行时,和 go 是一样的。```gofor i := 0; i < 5; i++ { defer fmt.Printf("%d ", i)}```会输出4 3 2 1 0# make && newmake 只能应用于 slice,map,channel,返回的不是指针。以 slice 为例,一个 slice ...
阅读全文
posted @
2018-05-16 23:34
baizx
阅读(176)
推荐(0) 编辑
readme
摘要:# 如何使用 geth1.8来监听合约事件# 新功能介绍geth1.8版本带来了新的事件处理方式,使用 abigen 可以自动生成包含合约事件监听以及过滤相关代码.这样就不用自己去写代码解析 log.比如:```bashabigen --sol token.sol --pkg token --out token.go```# 一个例子通过监听谁给我转账,来说明如何使用新的接口## 创建 Filte...
阅读全文
posted @
2018-05-13 17:52
baizx
阅读(456)
推荐(0) 编辑
如何使用 channel
摘要:# 如何使用 Channel例子来自于[Concurrency is not parallelism](https://talks.golang.org/2012/concurrency.slide)#Google Search: A fake framework## v1.0 ```govar ( Web = fakeSearch("web") Image = fakeSearch(...
阅读全文
posted @
2018-05-08 23:27
baizx
阅读(587)
推荐(0) 编辑
修改vscode caipeiyu.writeCnblog ,简化博客发布
摘要:# 修改vscode caipeiyu.writeCnblog ,简化博客发布# 1. 安装caipeiyu.writeCnblogvscode的博客园文章发布插件WriteCnblog : https://marketplace.visualstudio.com/items?itemName=caipeiyu.writeCnblog# 2. 修改扩展## 2.1 修改```cd .vscode/...
阅读全文
posted @
2018-05-07 15:38
baizx
阅读(436)
推荐(0) 编辑
thedao
摘要:# TheDao 简化版解释## the Dao 合约```contract f1{ function transfer() { if (acccount[m]>=100) { m.send(100) account[m]-=100 } }}```# send 会调用 m 的 fallback 函数但是 m...
阅读全文
posted @
2018-05-07 15:15
baizx
阅读(257)
推荐(0) 编辑