mirror of
https://github.com/golang/go
synced 2024-11-25 01:47:56 -07:00
misc/emacs: allow users to customize path of 'go' tool.
Some users have multiple Go development trees and invoke the 'go' tool via a wrapper that sets GOROOT and GOPATH based on the current directory. Such users should customize go-command to point to the wrapper script. R=dominik.honnef CC=golang-dev https://golang.org/cl/13233043
This commit is contained in:
parent
7c8be15b8a
commit
264b73b3f2
@ -150,6 +150,14 @@
|
|||||||
:type 'hook
|
:type 'hook
|
||||||
:group 'go)
|
:group 'go)
|
||||||
|
|
||||||
|
(defcustom go-command "go"
|
||||||
|
"The 'go' command. Some users have multiple Go development
|
||||||
|
trees and invoke the 'go' tool via a wrapper that sets GOROOT and
|
||||||
|
GOPATH based on the current directory. Such users should
|
||||||
|
customize this variable to point to the wrapper script."
|
||||||
|
:type 'string
|
||||||
|
:group 'go)
|
||||||
|
|
||||||
(defface go-coverage-untracked
|
(defface go-coverage-untracked
|
||||||
'((t (:foreground "#505050")))
|
'((t (:foreground "#505050")))
|
||||||
"Coverage color of untracked code."
|
"Coverage color of untracked code."
|
||||||
@ -844,7 +852,8 @@ uncommented, otherwise a new import will be added."
|
|||||||
('none (insert "\nimport (\n\t" line "\n)\n")))))))
|
('none (insert "\nimport (\n\t" line "\n)\n")))))))
|
||||||
|
|
||||||
(defun go-root-and-paths ()
|
(defun go-root-and-paths ()
|
||||||
(let* ((output (split-string (shell-command-to-string "go env GOROOT GOPATH") "\n"))
|
(let* ((output (split-string (shell-command-to-string (concat go-command " env GOROOT GOPATH"))
|
||||||
|
"\n"))
|
||||||
(root (car output))
|
(root (car output))
|
||||||
(paths (split-string (cadr output) ":")))
|
(paths (split-string (cadr output) ":")))
|
||||||
(append (list root) paths)))
|
(append (list root) paths)))
|
||||||
@ -903,9 +912,10 @@ If IGNORE-CASE is non-nil, the comparison is case-insensitive."
|
|||||||
(if (string= (file-truename (match-string 1 line)) (file-truename buffer-file-name))
|
(if (string= (file-truename (match-string 1 line)) (file-truename buffer-file-name))
|
||||||
(string-to-number (match-string 2 line)))))
|
(string-to-number (match-string 2 line)))))
|
||||||
(split-string (shell-command-to-string
|
(split-string (shell-command-to-string
|
||||||
(if (string-match "_test\.go$" buffer-file-truename)
|
(concat go-command
|
||||||
"go test -c"
|
(if (string-match "_test\.go$" buffer-file-truename)
|
||||||
"go build -o /dev/null")) "\n")))))
|
" test -c"
|
||||||
|
" build -o /dev/null"))) "\n")))))
|
||||||
|
|
||||||
(defun go-remove-unused-imports (arg)
|
(defun go-remove-unused-imports (arg)
|
||||||
"Removes all unused imports. If ARG is non-nil, unused imports
|
"Removes all unused imports. If ARG is non-nil, unused imports
|
||||||
|
Loading…
Reference in New Issue
Block a user