阅读go项目源码,解决无法快速找到interface有哪些struct实现问题

前端之家收集整理的这篇文章主要介绍了阅读go项目源码,解决无法快速找到interface有哪些struct实现问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

阅读go项目源码时,不方便知道interface有哪些struct实现,很不方便。

list-interfaces这个工具,用来分析go项目源码,帮你快速找出interface有哪些struct实现。

list-interfaces使用

  1. list-interfaces --codedir /appdev/gopath/src/github.com/contiv/netplugin \
  2. --gopath /appdev/gopath \
  3. --outputfile /tmp/result
  4.  
  5. 参数说明
  6. --codedir 要分析的代码目录
  7. --gopath GOPATH环境变量目录
  8. --outputfile 分析结果保存到该文件

输出样例:

  1. interface item 文件/appdev/gopath/src/github.com/contiv/netplugin/vendor/google.golang.org/grpc/transport/transport.go
  2. 2struct实现了接口
  3. struct windowUpdate 文件/appdev/gopath/src/github.com/contiv/netplugin/vendor/google.golang.org/grpc/transport/control.go
  4. struct settings 文件/appdev/gopath/src/github.com/contiv/netplugin/vendor/google.golang.org/grpc/transport/control.go

项目源码仓库

https://git.oschina.net/jscode/list-interfaces

下载地址

如果你的系统是fedora25 x86_64或兼容的系统,可以下载已编译好的二进制包。

http://oog2gj1e8.bkt.clouddn.com/list-interfaces

猜你在找的Go相关文章