Skip to content

Commit

Permalink
feat: add go support
Browse files Browse the repository at this point in the history
  • Loading branch information
seantrane committed May 6, 2022
1 parent 8631b8b commit 61c30d7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
26 changes: 26 additions & 0 deletions go/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
#
# Install Go.

# Shell Support
# shellcheck disable=SC1090
[[ -z "$SHELLSUPPORT" ]] && . "$( cd "${BASH_SOURCE%/*}/.." && pwd )/shell/support.sh"

if ! type "go" &> /dev/null || [[ "$OSTYPE" == "darwin"* ]]; then
sh_info "Installing Go..."
if type "brew" &> /dev/null; then
brew install go
elif type "apt-get" &> /dev/null; then
sudo apt-get -y install go
elif type "yum" &> /dev/null; then
sudo yum install go
fi
fi

if type "go" &> /dev/null; then
sh_success "$(go version) installed: $(command -v go)"

sh_info "Setting up Go workspace file structure (~/go)..."
mkdir -p "$HOME"/go/{bin,src,pkg}
ls -al "$HOME/go"
fi
6 changes: 6 additions & 0 deletions go/path.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

[[ -d "$HOME/go" ]] && export GOPATH="$HOME/go"
[[ -d "$(brew --prefix golang)/libexec" ]] && export GOROOT="$(brew --prefix golang)/libexec"
[[ -d "${GOPATH}/bin" ]] && export PATH="$PATH:${GOPATH}/bin"
[[ -d "${GOROOT}/bin" ]] && export PATH="$PATH:${GOROOT}/bin"

0 comments on commit 61c30d7

Please sign in to comment.