ctags icon indicating copy to clipboard operation
ctags copied to clipboard

Go: Declarations inside functions are not tagged

Open r-31415 opened this issue 3 years ago • 0 comments

Name of the parser:

It is not clear from the output of ctags --list-subparsers, which parser is used for the Go language

The command line you used to run ctags:

$ ctags --options=NONE -o - example.go
$ ctags --options=NONE --kinds-go=+pftvsimMnuPaR -o - example.go

The content of input file:

package main

import (
        "fmt"
)

var z int = 3

func main() {
        x := 1
        var y int = 2

        fmt.Println(x)
        fmt.Println(y)
        fmt.Println(z)
}

The tags output you are not satisfied with:

main    example.go      /^func main() {$/;"     f       package:main
main    example.go      /^package main$/;"      p
z       example.go      /^var z int = 3$/;"     v       package:main    typeref:typename:int

The tags output you expect:

main    example.go      1;"     p
main    example.go      9;"     f       package:main
x       example.go      10;"    v
y       example.go      11;"    v
z       example.go      7;"     v       package:main    typeref:typename:int

The version of ctags:

$ ctags --version
Universal Ctags 5.9.0, Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Sep  3 2021, 18:12:18
  URL: https://ctags.io/
  Optional compiled features: +wildcards, +regex, +gnulib_regex, +iconv, +option-directory, +xpath, +json, +interactive, +sandbox, +yaml, +packcc, +optscript

How do you get ctags binary:

apt install ctags

r-31415 avatar Aug 04 '22 20:08 r-31415