I use Haml in my web framework, I use syntax_suggest [1] to count the missing pairs so I can insert them automatically at the end of the block. It would probably not be too difficult to do the same thing in Go.
1. https://github.com/ruby/syntax_suggest/blob/main/lib/syntax_...