Emacs: Run 'go test' when Go buffer file name ends in '_test'

master
Pierre Neidhardt 2016-06-07 21:57:40 +02:00
parent 7db28a7351
commit 3e48fcab58
1 changed files with 2 additions and 1 deletions

View File

@ -41,7 +41,8 @@
(lambda () (interactive)
(let ((compile-command "gometalinter --cyclo-over=20 --deadline=20s -e 'declaration of err shadows' -e 'error return value not checked \\(.*\\.Close\\(\\)'"))
(compile compile-command))))
(set (make-local-variable 'compile-command) (if (go-buffer-in-gopath-p) "go install" "go build"))))
(set (make-local-variable 'compile-command)
(if (go-buffer-in-gopath-p) (if (string-match "_test.[gG][oO]$" buffer-file-name) "go test" "go install") "go build"))))
(define-skeleton go-main
"Insert main function with basic includes."