- Notifications
You must be signed in to change notification settings - Fork23
samuell/devbox-golang
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Vagrant box backed by Docker or Virtualbox, with Ansible provisioning
A Vagrant box (Virtualbox or Docker as providers) with Ansible provisioningfor setting up a Vim-based Golang development environment.
Note: There are currently problems with the docker version of the script, so please use the virtualbox version until this is solved!
- Ubuntu 16.04 "xenial" LTS 64bit base image
- Go(lang) 1.6.2
- Vim
- Fatih's vim-go plugin, providing syntax highlight, gocode integration for autocompletion, and more.
- See thevim-go README for more info on how you can easily enable additional included features.
- GoCode Go completion engine
- Git
- Tig - text mode interface to git
- gdb - the GNU debugger
- cgdb - Curses based user interface to gdb
Uncomment roles in playbook.yml to enable these.
- Valloric's YouCompleteMe for as-you-type completion (NB: Requires uncommenting the YouCompleteMe role in playbook.yml!)).
- Apache Mesos - An open source computer cluster manager. (UI onlocalhost:5050).
- Vagrant
- Ansible
- VirtualBox (Not required if you use Docker as provider!)
- Docker (Not required if you use Virtualbox as provider!)
Install Virtualbox:
sudo apt-get install virtualbox
Install Docker:
sudo apt-get install docker.io
Install a recent version of ansible:
sudo apt-get install ansible/trusty-backports
(if you ubuntu version is "trusty", otherwise, replace it with your appropriate version)
Install Vagrant, by first downloadng the proper .deb file fromvagrantup.com
... and then installing it with:
sudo dpkg -i<deb-file>
git clone git@github.com:samuell/devbox-golangcd devbox-golang
With docker provider (Expect it to take at least ~8m):
vagrant up docker
With VirtualBox provider (Expect it to take at least ~20m):
vagrant up virtualbox
With docker provider:
vagrant ssh docker
With VirtualBox provider:
vagrant ssh virtualbox
mkcd~/code/go/src/github/<user>/<repo>git init.
vim main.go
With the following command you can get the info you need to run scpagainst the machine:
vagrant ssh-config [docker| virtualbox]
Note the hostname and port number (and identity file, if you with),and run, for example:
scp -i<identity-file-path> -P<portno> \~/.ssh/id_rsa_<whateveryounamedit> \vagrant@<hostname>:/home/vagrant/.ssh/
Then, sometimes, in order to get the new key activated in your shellafter logging in to the vm, you might need to do:
ssh-agent bash -lssh-add~/.ssh/id_rsa_<whateveryounamedit>
- Autocompletion will happen automatically
- If you have turned off the YouCompleteMe role, you will get autocompletion with
<C-x><C-o>
GDB Breakpoints don't take, unless you follow the advice givenhere.That is, in short, do this on yourHost machine, if you run Ubuntu:
sudo apt-get install apparmor-utilssudoecho'aa-complain /etc/apparmor.d/docker'>> /etc/rc.localsudo aa-complain /etc/apparmor.d/docker
The problem seems to be that
ptrace
is not given access to the process otherwise.There are some really red message from the docker daemon when running
vagrant halt
.Everything seems to work as expected though (including the shutdown)There are some red message on vagrant up, but they are nothing serious, and can be ignored for now.
When building Go 1.5 dev, the build will end with a lot of error messages, but that is from thetests after the build. The build itself seems to work, largely.