Skip to content

Instantly share code, notes, and snippets.

@sideshowcoder
Created February 22, 2017 21:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sideshowcoder/0d37c53bbf1d62299600bb723cc20af0 to your computer and use it in GitHub Desktop.
Save sideshowcoder/0d37c53bbf1d62299600bb723cc20af0 to your computer and use it in GitHub Desktop.
(defun coder/go-guru-set-current-package-as-main ()
"GoGuru requires the scope to be set to a go package which
contains a main, this function will make the current package the
active go guru scope, assuming it contains a main"
(interactive)
(let* ((filename (buffer-file-name))
(gopath-src-path (concat (file-name-as-directory (go-guess-gopath)) "src"))
(relative-package-path (directory-file-name (file-name-directory (file-relative-name filename gopath-src-path)))))
(setq go-guru-scope relative-package-path)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment