Commit e0c220e6 authored by Doug MacEachern's avatar Doug MacEachern

Add method to install go packages

Several go related tools can be used within emacs, such as:
gocode, godef, goimports, golint, goflymake, etc.

The el-get-go method lets the 'go get' command take care of
downloading and building such tools.  The main advantage is letting
go get take care of resolving dependecies and building the binary,
rather than wedging into the :build property.
parent 121c4bb8
......@@ -34,6 +34,7 @@
(require 'el-get-git)
(require 'el-get-github)
(require 'el-get-git-svn)
(require 'el-get-go)
(require 'el-get-hg)
(require 'el-get-http)
(require 'el-get-http-tar)
......
......@@ -161,7 +161,7 @@ methods that targets @code{apt-get}, @code{brew}, @code{builtin},
@code{bzr}, @code{cvs}, @code{darcs}, @code{elpa}, @code{emacsmirror},
@code{emacswiki}, @code{fink}, @code{fossil}, @code{git} and
@code{git-svn}, @code{github} @code{github-tar} and @code{github-zip},
@code{hg}, @code{http} @code{http-tar} and @code{http-zip},
@code{go}, @code{hg}, @code{http} @code{http-tar} and @code{http-zip},
@code{pacman} and @code{svn}.
@item Notification
......
;;; el-get --- Manage the external elisp bits and pieces you depend upon
;;
;; Copyright (C) 2010-2011 Dimitri Fontaine
;;
;; Author: Dimitri Fontaine <dim@tapoueh.org>
;; URL: http://www.emacswiki.org/emacs/el-get
;; GIT: https://github.com/dimitri/el-get
;; Licence: WTFPL, grab your copy here: http://sam.zoy.org/wtfpl/
;;
;; This file is NOT part of GNU Emacs.
;;
;; Install
;; Please see the README.md file from the same distribution
(defcustom el-get-go (executable-find "go")
"The go executable."
:group 'el-get
:type 'file)
(defcustom el-get-go-install-hook nil
"Hook run after go install."
:group 'el-get
:type 'hook)
(defun el-get-go-install (package url post-install-fun)
"go install PACKAGE"
(let* ((gopath (getenv "GOPATH"))
(source (el-get-package-def package))
(pkgname (el-get-as-string (plist-get source :pkgname)))
(pdir (el-get-package-directory package))
(name (format "*go get %s*" package))
(ok (format "Package %s installed." package))
(ko (format "Could not install package %s." package)))
(unless (file-directory-p pdir)
(make-directory pdir))
(setenv "GOPATH" pdir)
(el-get-start-process-list
package
`((:command-name ,name
:buffer-name ,name
:default-directory ,el-get-dir
:program ,el-get-go
:args ("get" "-v" "-u" ,pkgname)
:message ,ok
:error ,ko))
post-install-fun)
(setenv "GOPATH" gopath)))
(el-get-register-method :go
:install #'el-get-go-install
:update #'el-get-go-install
:remove #'el-get-rmdir
:install-hook #'el-get-go-install-hook)
(provide 'el-get-go)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment