Purpose
The point of this gist is to provide a simple checklist of what to do in order to build go-projects with the latest go compiler suite and needed profile setup. This is mainly used for setting up go + git with private repos.
CI Builds
ACS uses CircleCI to build binaries from source. For information on that, look in the .circleci folder under the ACS repository.
Manual Builds
- Install Golang >= 1.11
- Manually: download from https://golang.org/dl/ and unpack via
tar xfv /path/to/dl/go*.tar.gz -C /usr/local/go
- macOS:
brew install go
- debian:
apt install go
- yum:
yum install golang
ordnf install golang
- Manually: download from https://golang.org/dl/ and unpack via
- Install
npm
- Manually (you are on your own)
- macOS:
brew install npm
- debian:
apt install npm
- yum/dnf:
yum install npm
ordnf install npm
- Install
goreleaser
- macOS:
brew install goreleaser
- macOS:
- Install
protobuf
- macOS:
brew install protobuf
- macOS:
- You will need to modifiy your shell enviroment
- The following is no longer valid as of Jan 2019: ~Set a
GOPATH
viaexport GOPATH="${HOME}/Workspace/go"
or similar, which is still needed as of go 10.1. Not doing this shoves everything in${HOME}/go
, which might break things.~ - Ensure GOPATH is unset, and GO111MODULES=”on” - acs uses go modules to handle dependancies.
- Modify $PATH so
npm
, andgo
are generally available (if they are in nonstandard locations). - Modify $PATH (
export PATH="${PATH}:${HOME}/go/bin"
) so commands retrieved viago get
are immediately available. Alternatively, setGOBIN
to$HOME/bin
or similar so that go install places the compiled binaries in$HOME/bin
- If you modified your shell’s configuration (
~/.profile
,~/.bashrc
,~/.zshrc
, etc), you will need to eithersource
them or relogin.
- The following is no longer valid as of Jan 2019: ~Set a
- Modifications to
~/.gitconfig
(Might not be needed)- Because we have private repos (for now), we need to tell
git
(whichgo
uses in the background) to use SSH rather than HTTPS.
cat << EOF > ~/.gitconfig [url "git@github.com:"] insteadOf = https://github.com/ [url "git@github.com:"] pushInsteadOf = "git://github.com/" [url "git@github.com:"] pushInsteadOf = "https://github.com/" EOF
- set
user.name
anduser.email
otherwisegit push
fails miserably.
git config --global user.name "your-user-name" git config --global user.email "username@users.noreply.github.com"
- Because we have private repos (for now), we need to tell
- Get the sources and build the packages
cd $WORKSPACE
git checkout https://github.com/NCAR/ACS
pushd ACS
make projdeps deps # This could take a little bit.
- To build a snapshot: run
make snapshot
at the root ACS directory.
Editors
This section is here as basic guidance on how to get various editors up and running.
VSCode
It works rather well. Manually install it, and install the Go extension. Additional tools I have found useful are dep Better TOML, Graphviz Preview, RAML, vscode-proto3, and vscode-protolint. Once you install, open the command palette, and run the “Go: Install/Update Tools” option, select all the tools and click ok. You will need to re-do this if you update the go compiler.
vim
Check out github.com/fatih/vim-go. Installation is pretty simple. Once you install, run :GoInstallBinaries
inside vim and it will install the support tooling.
Sublime Text 3
I haven’t used Sublime in a while, but its tooling worked well enough. You might need to relogin after performing the above commands so the profile is properly loaded. From there you basically follow the following.
- Install Package Control
- Install the Following Package in Package Control
- SublimeLinter
- SublimeLinter-contrib-golint
- SublimeLinter-contrib-gotype