project idea: go-symbol-search
Starting a two week vacation today, so I’ve planned a small project: a Go-specific version of ctags. I’ve used ctags in the past to navigate a medium-sized Go monorepo, but there were some pain points. Re-indexing usually took about a minute, and, at least by default, ctags doesn’t search the standard library or Go module dependencies. I’m imagining a tool that’s easy to use from the CLI as well as from within an editor like vim or aretext.
In theory, it should be straightforward to parse and interpret Go source files using the ast package. It should also be possible to find module dependencies from a go.mod file. There’s probably some trickiness here that I haven’t discovered yet (aliasing imports, rewriting module rules, other things?), but hopefully nothing intractable. The tool could cache data in a SQLite database to avoid parsing Go files that haven’t changed (based on last access timestamp and a checksum). Hopefully re-indexing and searching the database will be fast enough for interactive use.
Like all good project ideas, I’m not entirely sure if this is going to work, but I’m excited to find out!