diff --git a/modules/lang/go/autoload.el b/modules/lang/go/autoload.el index 8ef830833..569065ae1 100644 --- a/modules/lang/go/autoload.el +++ b/modules/lang/go/autoload.el @@ -6,17 +6,22 @@ (defvar +go-test-last nil "The last test run.") -(defun +go--run-tests (args) +(defun +go--spawn (cmd) (require 'async) (save-selected-window - (async-shell-command (concat "go test " args)))) + (async-shell-command cmd))) + +(defun +go--run-tests (args) + (let ((cmd (concat "go test " args))) + (setq +go-test-last (concat "cd " default-directory ";" cmd)) + (+go--spawn cmd))) ;;;###autoload (defun +go/test-rerun () (interactive) (if +go-test-last - (funcall +go-test-last) - (+go/run-all-tests))) + (+go--spawn +go-test-last) + (+go/test-all))) ;;;###autoload (defun +go/test-all ()