Improve go test output buffer behavior.

- Use compilation-start to get highlighting of compilation or runtime errors.
- Configure output window in popwin and window-purpose (so that it can be closed
  with C-g for example).
- Configurable buffer name.
This commit is contained in:
Denis Bernard 2017-01-15 18:31:33 +01:00 committed by syl20bnr
parent ddd065b90a
commit 9468599ea4
3 changed files with 13 additions and 2 deletions

View File

@ -98,6 +98,10 @@ function testing to work.
the coverage buffer. See [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Choosing-Window.html][=display-buffer=]] for a list of possible functions.
The default value is =display-buffer-reuse-window=.
Tests are run in a compilation buffer displayed in a popup window that can be
closed by pressing ~C-g~ from any other window. The variable
=go-test-buffer-name= can be customized to set the output buffer name.
** Guru
Go Oracle has been deprecated as of October 1, 2016, it's replacement is =go-guru=.

View File

@ -21,3 +21,6 @@
(defvar go-use-gometalinter nil
"Use gometalinter if the variable has non-nil value.")
(defvar go-test-buffer-name "*go test*"
"Name of the buffer for go test output. Default is *go test*.")

View File

@ -23,9 +23,14 @@
go-mode
go-guru
go-rename
popwin
))
(defun go/post-init-popwin ()
(push (cons go-test-buffer-name '(:dedicated t :position bottom :stick t :noselect t :height 0.4))
popwin:special-display-config))
(defun go/init-company-go ()
(use-package company-go
:defer t
@ -60,8 +65,7 @@
(defun spacemacs/go-run-tests (args)
(interactive)
(save-selected-window
(async-shell-command (concat "go test " args))))
(compilation-start (concat "go test " args) nil (lambda (n) go-test-buffer-name) nil))
(defun spacemacs/go-run-package-tests ()
(interactive)