背景
interfaceinterface
如果项目比较小,还比较容易对付,因为按照习惯来讲,其实现往往都在对应接口的下方。但是遇到这种像 etcd 的项目就抓瞎了,因为其实现可能会跨越多个文件。好在 vscode 有个非常好用的功能:Go to Implementation
Ctrl+F12interface
guru
- 查找速度慢
- 不支持 Go Module
- 官方不再维护
gopls
微软在开发 VS Code 过程中, 定义一种协议, 语言服务器协议:Language Server Protocol,用来统一不同语言的静态检测、自动补全问题。
goplsguru
如果你想现在就用上这个特性,可以有两个选择:
mastergoplsbingobingoguru
当然也可以用我目前的方案:
goplsgoToTypeDefinitiongoToImplementationguru
golangci-lintgolint
最后贴下我的完整配置: