-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotfiles_install_tools_golang.sh
94 lines (87 loc) · 2.24 KB
/
dotfiles_install_tools_golang.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Script to set up Golang environment
# Copyright (C) 2018, 2023 Upperstream Software.
# Provided under the ISC License. See LICENSE.txt file for details.
# shellcheck disable=SC2006,SC2148,SC2154
golang_describe_module() {
cat <<-EOF
golang:
install Go programming language development tools
EOF
}
go_install_package() {
_version="${2:-latest}"
go install "$1@$_version"
}
install_distribution_golang() {
tar -zxf "`download_distfile go1.15.6.linux-amd64.tar.gz https://go.dev/dl/go1.20.2.linux-amd64.tar.gz`" -C "$local_dir"/ && \
(cd "$local_dir"/bin && \
ln -sf "$local_dir"/go/bin/* .)
}
install_golang() {
case "$os" in
FreeBSD)
install_package go
;;
Linux)
case "$distribution" in
Alpine)
alpine_enable_edge_repos && linux_install_package libc-dev go
;;
Arch)
linux_install_package go
;;
Debian)
if [ "$prefer_binary_package" -eq 1 ]; then
linux_install_package golang
else
install_distribution_golang
fi
;;
Devuan)
if [ "$prefer_binary_package" -eq 1 ]; then
linux_install_package golang
else
install_distribution_golang
fi
;;
*)
linux_install_package golang
;;
esac
;;
NetBSD)
if [ ! -x /usr/pkg/sbin/mozilla-rootcerts ]; then
install_package mozilla-rootcerts
fi && \
if [ ! -f "`echo /etc/openssl/certs/mozilla-rootcert-* | cut -f1 -d' '`" ]; then
"$sudo" /usr/pkg/sbin/mozilla-rootcerts install
fi && \
install_package go
;;
OpenBSD)
install_package go
;;
*)
install_package golang
;;
esac
}
install_tools_golang() {
cat <<-EOF
-----------------------------------------
Installing tools for Golang
-----------------------------------------
EOF
has git || install git || report_error
has go || install_golang || report_error
GOPATH=$HOME/go
export GOPATH
test -d "$GOPATH" || mkdir -p "$GOPATH"
PATH=$PATH:$GOPATH/bin
has gocode || go_install_package github.com/nsf/gocode || report_error
has gotags || go_install_package github.com/jstemmer/gotags || report_error
has joe || install joe || report_error
if [ ! -f "$lisp_dir"/gotags.el ]; then
download https://raw.githubusercontent.com/craig-ludington/gotags-el/master/me-alpheus-gotags.el > "$lisp_dir"/gotags.el
fi
}