branch: elpa/go-mode
commit 49521d540ddab1f118dd55c772c49fe6fcb39c92
Author: Dominik Honnef <[email protected]>
Commit: Dominik Honnef <[email protected]>

    Add go-reset-gopath
---
 NEWS       | 3 +++
 go-mode.el | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/NEWS b/NEWS
index 3e1cde5..373c145 100644
--- a/NEWS
+++ b/NEWS
@@ -41,6 +41,9 @@ go-mode-1.4.0 (???)
    projectile-switch-project-hook, directory variables or some other
    way of invoking per-project code.
 
+ * Add new command go-reset-gopath, which resets GOPATH to the value
+   it had when Emacs started.
+
  * Add customizable variable godoc-command, which allows choosing
    between using godoc and go doc. It defaults to go doc, which
    differs from prior versions which always used godoc.
diff --git a/go-mode.el b/go-mode.el
index 4f45faa..812f37a 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -1984,6 +1984,13 @@ switching projects."
     (setenv "GOPATH" gopath)
     (message "Set GOPATH to %s" gopath)))
 
+(defun go-reset-gopath ()
+  "Reset GOPATH to the value it had when Emacs started."
+  (interactive)
+  (let ((gopath (go-original-gopath)))
+    (setenv "GOPATH" gopath)
+    (message "Set GOPATH to %s" gopath)))
+
 (defun go-original-gopath ()
   "Return the original value of GOPATH from when Emacs was started."
   (let ((process-environment initial-environment)) (getenv "GOPATH")))

Reply via email to