dotfiles/.chezmoiscripts/run_install_go.sh.tmpl
2023-10-11 08:28:12 +02:00

8 lines
No EOL
484 B
Cheetah

{{- if (lookPath "go" | not) -}}
#!/bin/bash
{{- if eq .chezmoi.os "darwin" }}
brew install go
{{- else if eq .chezmoi.os "linux" }}
{{ if ne .chezmoi.uid "0" }} sudo {{ end -}}rm -rf /usr/local/go || {{ if ne .chezmoi.uid "0" }} sudo {{ end -}}mkdir -p /usr/local/go && curl -L https://go.dev/dl/$(curl "https://go.dev/VERSION?m=text" | head -n 1).linux-{{ .chezmoi.arch }}.tar.gz | {{ if ne .chezmoi.uid "0" }} sudo {{ end -}}tar -xz -C /usr/local/
{{- end }}
{{- end }}