Skip to content

cboecking/golang-env-setup

Repository files navigation

How to Install Go (Golang) Development Environment on an Ubuntu Server or a Chromebook

The purpose of this project is to help me quickly setup a go development environment using either an Ubuntu server or a Chromebook. I created an installation script because (1) I am lazy, (2) I tear down and re-create enviornments all the time, and (3) I want my enviornments to be the same everywhere everytime so that I become proficent with the tools.

Golang Environment Installation

Execute the following line from an Ubuntu 14.04 or newer server (see below for Chromebook details):

source <(curl -s https://raw.githubusercontent.com/cboecking/golang-env-setup/master/go_install.sh)

Installation Notes

  1. The script assumes you want to use terminal-based authoring tools
  2. It installs go (golang)
  3. It installs and executes a sample project to confirm all worked as expected
  4. It configures vim with the vim-go development environment
  5. It installs tmux so that you can create and share terminal sessions
  6. It appends details (my preferences) to your .profile

Using Chromebook for Go (Golang) Development

My Chromebook is proving to be a great development platform for go. It has a 4-core i3 Intel processor, and the 4GB of RAM seem to be enough given how little ChromeOS and Ubuntu cli consume. If you want more RAM, consider this machine. Or, you can go extreme with the pixel.

I am surprised by and impressed with how easy it is to install Ubuntu inside your Chromebook and access it directly through the Chrome OS terminal.

Configuring Chromebook for Development (more)

  1. Put chromebook in developer mode. In my case:
  2. Press Esc + Refresh function key + Power ==> to enter recovery mode
  3. When the white screen comes up, press Ctrl-d ==> to enter developer mode
  4. Log into Chrome when it finally boots back up
  5. Download crouton (direct link)
  6. Install the Chrome plug-ins listed in the below section
  7. Press Ctrl-Alt-t to open a terminal window then type shell
  8. Go to the downloads directory using: cd ~/Download
  9. Make crouton executable using: chmox +x crouton
  10. Link to my crouton cheatsheet
  11. Execute crouton to install a cli version of Ubuntu 14.04 using: sudo sh crouton -r trusty -t cli-extra
  12. Create a pristine backup of your new Ubuntu installation using: sudo edit-chroot -b trusty
  13. Rename your backup file to include the word 'pristine' for future reference
  14. Start using Ubuntu from a terminal->shell using: sudo enter-chroot
  15. Note: I created an alias in my ~/.bashrc of ec to execute: sudo enter-chroot
  16. Once you reach your Ubuntu prompt, install curl using: sudo apt-get install curl -y
  17. Install and configure your go environment using the command listed at the top of this page.

Chrome Plug-ins

  1. Secure Shell
  2. Crosh Window - allows you to open a secure shell in a separate window.

ChromeOS and OpenVPN

Easy way to connect to openvpn server - see openvpn2 script

Put chromebook in developer mode
copy above/link openvpn2 script to ~/Downloads/openpvn2
enter shell
cd /usr/local/bin/
sudo cp ~/Downloads/openvpn2 .
sudo chmod +x openvpn2
cd ~/Downloads/
openvpn2 yourVPNfile.ovpn
ctrl+c to end the session

Below is a copy of the above openvpn2 script - just in case

#!/bin/sh -e
trap '' 2
# Stop shill and restart it with a nicer attitude towards tun0
sudo stop shill
sudo start shill BLACKLISTED_DEVICES=tun0
# Sleep 10 seconds to allow chromebook to reconnect to the network
sudo sleep 10
sudo openvpn --mktun --dev tun0
sudo sleep 3
# Add google DNS on top of current ones, since openvpn command does not do it
sudo sed -i '1s/^/# new DNS\nnameserver 8.8.8.8\nnameserver 8.8.4.4\n# old DNS\n/' /var/run/shill/resolv.conf
# Lauch openvpn, finally...
sudo openvpn --config $1 --dev tun0
# When ctrl-c is hit remove tun0 and cleanup the DNS
sudo openvpn --rmtun --dev tun0
sudo sed -i '/# new DNS/,/# old DNS/d' /var/run/shill/resolv.conf
trap 2

Crouton References

  1. Main crouton page
  2. List of commands
  3. My cheatsheet

vim-go Resources

  1. Written tutorial
  2. Video tutorial - same as written
  3. See cheatsheet in this repository

goa Resources

  1. goa and gorma discussion and tutorial

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published