Merge pull request #1488 from dougm/go

Go language related recipes and package installer
This commit is contained in:
yagnesh రాఘవ 2014-01-01 07:43:53 -08:00
commit 3218d1a831
9 changed files with 90 additions and 15 deletions

View File

@ -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)

View File

@ -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

55
methods/el-get-go.el Normal file
View File

@ -0,0 +1,55 @@
;;; 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)

View File

@ -1,11 +1,8 @@
(:name go-autocomplete
:description "An autocompletion daemon for the Go programming language"
:type github
:pkgname "nsf/gocode"
:type go
:pkgname "github.com/nsf/gocode"
:depends (auto-complete)
:features (go-autocomplete)
:build (("go" "build" "-o" "gocode"))
:build/windows-nt (("go" "build" "-o" "gocode.exe"))
:load-path ("emacs")
:prepare (progn
(add-to-list 'exec-path (el-get-package-directory "go-autocomplete"))))
:load-path ("src/github.com/nsf/gocode/emacs")
:post-init (add-to-list 'exec-path (concat default-directory "bin")))

View File

@ -1,11 +1,8 @@
(:name go-company
:description "An autocompletion daemon for the Go programming language"
:type github
:pkgname "nsf/gocode"
:type go
:pkgname "github.com/nsf/gocode"
:depends (company)
:features (company-go)
:build '(("go" "build" "-o" "gocode"))
:build/windows-nt (("go" "build" "-o" "gocode.exe"))
:load-path ("emacs-company")
:prepare (progn
(add-to-list 'exec-path (el-get-package-directory "go-company"))))
:load-path ("src/github.com/nsf/gocode/emacs-company")
:post-init (add-to-list 'exec-path (concat default-directory "bin")))

5
recipes/go-def.rcp Normal file
View File

@ -0,0 +1,5 @@
(:name go-def
:description "Required for go-mode godef functions"
:type go
:pkgname "code.google.com/p/rog-go/exp/cmd/godef"
:post-init (add-to-list 'exec-path (concat default-directory "bin")))

8
recipes/go-flymake.rcp Normal file
View File

@ -0,0 +1,8 @@
(:name go-flymake
:description "Flymake for the Go programming language"
:type go
:pkgname "github.com/dougm/goflymake"
:depends go-mode
:features go-flymake
:load-path "src/github.com/dougm/goflymake"
:post-init (add-to-list 'exec-path (concat default-directory "bin")))

5
recipes/go-imports.rcp Normal file
View File

@ -0,0 +1,5 @@
(:name go-imports
:description "Tool to fix (add, remove) your Go imports automatically"
:type go
:pkgname "github.com/bradfitz/goimports"
:post-init (setq gofmt-command (concat default-directory "bin/goimports")))

7
recipes/go-lint.rcp Normal file
View File

@ -0,0 +1,7 @@
(:name go-lint
:description "lint for the Go source code"
:type go
:pkgname "github.com/golang/lint/golint"
:features golint
:load-path "src/github.com/golang/lint/misc/emacs"
:post-init (el-get-envpath-prepend "PATH" (concat default-directory "bin")))