dqf42223 2011-11-20 20:13
浏览 10
已采纳

Go的ctag数据库

How to generate tags file for Go source

In mac, I installed exuberant ctags , and tried the below command in source directory

ctags -f gosource.tags -R `pwd`

But, it doesn't consider *.go files. Do I have to use -h option? But, isn't it only for header files, as per the manual?

Please give me the correct command so that I can use the tags file with vim. I also prefer absolute path so that I can keep the file anywhere

Thanks.

Edit: I assumed current ctags support Go, seeing http://groups.google.com/group/golang-nuts/browse_thread/thread/3a4848db231b02c9.

but, http://ctags.sourceforge.net/languages.html desn't have go listed.

  • 写回答

4条回答 默认 最新

  • dtr32787 2011-11-23 03:02
    关注

    Add the following to ~/.ctags

    --langdef=Go
    --langmap=Go:.go
    --regex-Go=/func([ \t]+\([^)]+\))?[ \t]+([a-zA-Z0-9_]+)/\2/d,func/
    --regex-Go=/var[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,var/
    --regex-Go=/type[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,type/
    

    (From http://go-wise.blogspot.com/2011/09/using-ctags-with-go.html)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 深度学习残差模块模型
  • ¥20 两个不同Subnet的点对点连接
  • ¥50 怎么判断同步时序逻辑电路和异步时序逻辑电路
  • ¥15 差动电流二次谐波的含量Matlab计算
  • ¥15 Can/caned 总线错误问题,错误显示控制器要发1,结果总线检测到0
  • ¥15 C#如何调用串口数据
  • ¥15 MATLAB与单片机串口通信
  • ¥15 L76k模块的GPS的使用
  • ¥15 请帮我看一看数电项目如何设计