From 249c3b87b01dcfa7f4484b5ac37e4015bbc2ef03 Mon Sep 17 00:00:00 2001 From: Ian Clark Date: Fri, 6 Jan 2017 13:06:30 -0600 Subject: [PATCH] Configurable extra arguments to go test ADD: - layers/+lang/go/config.el Added new variable `go-use-test-args` to allow specifying additional arguments being passed to `go test. CHANGE: - layers/+lang/go/packages.el Updated `go-run-tests` to automatically concat the new variable `go-use-test-args` to args passed to `go test`. --- layers/+lang/go/README.org | 5 +++++ layers/+lang/go/config.el | 3 +++ layers/+lang/go/packages.el | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/layers/+lang/go/README.org b/layers/+lang/go/README.org index 872b9eda0..8439b527f 100644 --- a/layers/+lang/go/README.org +++ b/layers/+lang/go/README.org @@ -103,6 +103,11 @@ 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. +To provide additional arguments to go test, specify =go-use-test-args=. +#+begin_src emacs-lisp + (go :variables go-use-test-args "-race -timeout 10s" +#+end_src + ** Guru Go Oracle has been deprecated as of October 1, 2016, it's replacement is =go-guru=. diff --git a/layers/+lang/go/config.el b/layers/+lang/go/config.el index 65595405c..1ea7ad379 100644 --- a/layers/+lang/go/config.el +++ b/layers/+lang/go/config.el @@ -24,3 +24,6 @@ (defvar go-test-buffer-name "*go test*" "Name of the buffer for go test output. Default is *go test*.") + +(defvar go-use-test-args "" + "Additional arguments to be supplied to `go test` during runtime.") diff --git a/layers/+lang/go/packages.el b/layers/+lang/go/packages.el index 8e42be2eb..7b87ffb2c 100644 --- a/layers/+lang/go/packages.el +++ b/layers/+lang/go/packages.el @@ -65,7 +65,8 @@ (defun spacemacs/go-run-tests (args) (interactive) - (compilation-start (concat "go test " args) nil (lambda (n) go-test-buffer-name) nil)) + (compilation-start (concat "go test " args " " go-use-test-args) + nil (lambda (n) go-test-buffer-name) nil)) (defun spacemacs/go-run-package-tests () (interactive)