install.fairie/home/.chezmoiscripts/universal/run_onchange_before_09-install-go.tmpl
2023-11-05 01:46:18 +00:00

26 lines
740 B
Cheetah

{{- if (ne .host.distro.family "windows") -}}
#!/usr/bin/env bash
# @file Go Install
# @brief Ensures Go is installed via Homebrew
# @description
# This script ensures Go is installed. It uses Homebrew to install Go.
{{ 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 -}}