Code Monkey home page Code Monkey logo

golang-emacs's Introduction

Golang support for Emacs

If you:

  1. Have Emacs
  2. Have Docker

Then, this package will allow you to do Golang development in Emacs with completion and other features, without having Golang installed on your system.

Make sure you are in the docker group.

0. Create side-$GOPATH:

$ cd ~
$ export GOPATH="$HOME/temp-gopath"
$ mkdir -p "$GOPATH/bin"

1. Install golang-emacs:

$ cd $GOPATH
$ git clone [email protected]:dustinlacewell/golang-emacs.git .emacs.d

2. Add new bin directories to your $PATH

Add these to the FRONT of your $PATH, so that these binaries are found before your system-installed or current $GOPATH/bin binaries. This should completely shadow any existing go installation or $GOPATH state on your system.

$ export PATH="$GOPATH/.emacs.d/bin:$GOPATH/bin:$PATH"

You can check that the pseudo-binaries are now available with the which command:

$ which go
/home/username/temp-gopath/.emacs.d/bin/go

Note: for these changes to persist, you'll need to make the related changes to your .bashrc file.

3. Install the following go packages:

go get -u golang.org/x/tools/cmd/goimports
go get -u github.com/golang/lint/golint
go get -u github.com/nsf/gocode

The newly built installed binaries should now be available through the side-$GOPATH:

$ which goimports
/home/username/temp-gopath/bin/goimports

Note: while the built gocode binary is installed to the side-$GOPATH/bin folder as usual, this project provides a pseudo-binary that emacs will find and utilize. It provides some compability support for doing completion over the container boundry.

$ which gocode
/home/username/temp-gopath/.emacs.d/bin/gocode

Run Emacs

Now you can run emacs with the provided configuration. It will download packages on the first run:

cd $GOPATH
touch .emacs.d/custom.el
emacs -q -l .emacs.d/init.el

Note: as of now, emacs must be launched from $GOPATH because my elisp sucks.

Screenshot

golang-emacs's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.