2023-02-03 20:53:29 -08:00
|
|
|
{{- if (ne .host.distro.family "windows") -}}
|
|
|
|
#!/usr/bin/env bash
|
2023-04-11 20:57:02 -07:00
|
|
|
# @file Go Install
|
|
|
|
# @brief Ensures Go is installed via Homebrew
|
|
|
|
# @description
|
|
|
|
# This script ensures Go is installed. It uses Homebrew to install Go.
|
2023-02-03 20:53:29 -08:00
|
|
|
|
|
|
|
{{ includeTemplate "universal/profile-before" }}
|
|
|
|
{{ includeTemplate "universal/logg-before" }}
|
|
|
|
|
|
|
|
### Ensure Go is installed
|
|
|
|
if ! command -v go > /dev/null; then
|
|
|
|
if command -v brew; then
|
2023-11-04 18:46:18 -07:00
|
|
|
logg 'Installing go via Homebrew'
|
2023-02-03 20:53:29 -08:00
|
|
|
brew install go || GO_EXIT_CODE=$?
|
|
|
|
if [ -n "$GO_EXIT_CODE" ]; then
|
2023-11-04 18:46:18 -07:00
|
|
|
logg error 'go was not successfully installed via Homebrew'
|
2023-02-03 20:53:29 -08:00
|
|
|
fi
|
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg 'brew is unavailable. Cannot use it to perform a system installation of node.'
|
2023-02-03 20:53:29 -08:00
|
|
|
fi
|
|
|
|
else
|
2023-11-04 18:46:18 -07:00
|
|
|
logg 'go is available'
|
2023-02-03 20:53:29 -08:00
|
|
|
fi
|
|
|
|
|
|
|
|
{{ end -}}
|