install.fairie/home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl

23 lines
593 B
Cheetah
Raw Normal View History

{{- if (ne .host.distro.family "windows") -}}
#!/usr/bin/env bash
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}
### Ensure Go is installed
if ! command -v go > /dev/null; then
if command -v brew; then
logg 'Installing `go` via Homebrew'
brew install go || GO_EXIT_CODE=$?
if [ -n "$GO_EXIT_CODE" ]; then
logg error '`go` was not successfully installed via Homebrew'
fi
else
logg '`brew` is unavailable. Cannot use it to perform a system installation of node.'
fi
else
logg '`go` is available'
fi
{{ end -}}