golang interface
Go interface list
可以使用list-interfaces工具查看某个package中的代码实现了那些接口:
~/gopath/bin/list-interfaces --codedir /root/gopath/src/github.com/hyperledger/fabric/consensus/ --gopath /root/gopath/ --outputfile result
具体list-interfaces工具下载安装自行google。
golang 继承和嵌入
如果struct继承了一个匿名struct,其会继承所有成员和函数,调用函数时会调用子类的函数,如果子类没有则调用父类。 如果要明确调用父类的变量和函数,则需明确使用.父类.函数或指针。
brew install tips:
Install an older version of a package
https://www.client9.com/using-macos-homebrew-to-install-a-specific-version/
git -C "$(brew --repo homebrew/core)" fetch --unshallow
git -C "$(brew --repo homebrew/core)" log master -- Formula/phantomjs.rb
BREWURL=https://raw.githubusercontent.com/Homebrew/homebrew-core
brew install ${BREWURL}/HASH/Formula/NAME.rb
Note: replace NAME and HASH with appropriate values.
interfaces.go error: use go1.8 or higher
For memo:
Last updated
Was this helpful?