mirror of
https://github.com/golang/go
synced 2024-11-18 10:04:43 -07:00
cmd/oracle: expect oracle binary beneath $GOBIN, $GOPATH/bin, or $GOROOT/bin
in that order, so that "go get golang.org/x/tools/cmd/oracle" installs it and no copy is needed. We keep the old location for compatibility. Why is if/else control flow so hard in basic Lisp? Sometimes you just need 'return'. Change-Id: Iae231a761d707daaa1316161cfad0365111eff0e Reviewed-on: https://go-review.googlesource.com/9547 Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
6a8dc4ed40
commit
8ff1f51a5b
@ -22,8 +22,25 @@
|
||||
"Options specific to the Go oracle."
|
||||
:group 'go)
|
||||
|
||||
(defcustom go-oracle-command (concat (car (go-root-and-paths)) "/bin/oracle")
|
||||
"The Go oracle command; the default is $GOROOT/bin/oracle."
|
||||
(defcustom go-oracle-command
|
||||
(let* ((dirs (go-root-and-paths))
|
||||
(gopath (cdr dirs))
|
||||
(gobin (getenv "GOBIN"))
|
||||
(goroot-cmd (concat (car dirs) "/bin/oracle"))
|
||||
cmd)
|
||||
(if gobin
|
||||
(let ((gobin-cmd (concat gobin "/oracle")))
|
||||
(if (file-executable-p gobin-cmd)
|
||||
(setq cmd gobin-cmd)))) ; use $GOBIN/oracle if executable
|
||||
(and (null cmd)
|
||||
gopath
|
||||
(let ((gopath-cmd (concat (car gopath) "/bin/oracle")))
|
||||
(if (file-executable-p gopath-cmd)
|
||||
(setq cmd gopath-cmd)))) ; use GOPATH[0]/bin if executable
|
||||
(or cmd goroot-cmd)) ; use $GOROOT/bin by default
|
||||
"The Go oracle command. The following directories are
|
||||
searched: (1) $GOBIN; (2) dir/bin, where dir is the first
|
||||
directory on $GOPATH; (3) $GOROOT/bin."
|
||||
:type 'string
|
||||
:group 'go-oracle)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user