store-procedure goformat
~local %gobuf
setv %gobuf $cbufname
setv %gofile $cfilname
setv %errbuf "[gofmt errors]"
; If we have an existing error buffer, delete it.
~force buffer %errbuf
~if $status
unmark-buffer %errbuf
~force delete-buffer %errbuf
~endif
~hidden edit-file &cat "!gofmt " &cat %gofile " 1> /dev/null"
rename-buffer %errbuf
~if > $blines 0
set error-buffer %errbuf
buffer %gobuf
LoadErrors
~else
~force unmark-buffer %errbuf
~force delete-buffer %errbuf
~endif
~endm
LoadErrors is a local version of LoadErrorExprs that looks in ~/.vile/vile-errs for error expressions.