#!/bin/bash

set -euo pipefail

# ~/.ctags needs to look like
# --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/
#
# See also https://stackoverflow.com/questions/8204367/ctag-database-for-go

ctags -f gosource.tags -R `pwd`
mv gosource.tags tags
