go-mode: build and test tools

This commit is contained in:
Henrik Lissner 2015-09-30 13:44:13 -04:00
parent 73a01409c2
commit 2e702b260e
2 changed files with 23 additions and 1 deletions

18
modules/lib/defuns-go.el Normal file
View file

@ -0,0 +1,18 @@
;;; defuns-go.el
;; TODO Implement narf:go-get-package
(defun narf--go-get-package ())
;;;###autoload
(defun narf:go-test-run-all ()
(interactive)
(async-shell-command (format "cd '%s' && go test" (narf/project-root))))
;;;###autoload
(defun narf:go-test-run-package ()
(interactive)
(error "Not yet implemented")
(async-shell-command (format "cd '%s' && go test %s" (narf/project-root) (narf--go-get-package))))
(provide 'defuns-go)
;;; defuns-go.el ends here

View file

@ -5,10 +5,14 @@
:interpreter "go"
:init
(add-hook! go-mode '(emr-initialize flycheck-mode))
(build-for! go-mode "go build")
:config
(bind! :map go-mode-map
:n "gd" 'godef-jump
:n "gD" 'godef-describe)
:n "gD" 'godef-describe
:n "tr" 'narf:go-test-run-all
:n "ta" 'narf:go-test-run-all
:n "ts" 'narf:go-test-run-package)
(mapc (lambda (x)
(let ((command-name (car x))