@@ -12,7 +12,6 @@ TARGET_GO_VERSION=${VERSION:-"latest"}
1212TARGET_GOROOT=${TARGET_GOROOT:- " /usr/local/go" }
1313TARGET_GOPATH=${TARGET_GOPATH:- " /go" }
1414USERNAME=${USERNAME:- " automatic" }
15- UPDATE_RC=${UPDATE_RC:- " true" }
1615INSTALL_GO_TOOLS=${INSTALL_GO_TOOLS:- " true" }
1716
1817# https://www.google.com/linuxrepositories/
@@ -47,17 +46,6 @@ elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
4746 USERNAME=root
4847fi
4948
50- updaterc () {
51- if [ " ${UPDATE_RC} " = " true" ]; then
52- echo " Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
53- if [[ " $( cat /etc/bash.bashrc) " != * " $1 " * ]]; then
54- echo -e " $1 " >> /etc/bash.bashrc
55- fi
56- if [ -f " /etc/zsh/zshrc" ] && [[ " $( cat /etc/zsh/zshrc) " != * " $1 " * ]]; then
57- echo -e " $1 " >> /etc/zsh/zshrc
58- fi
59- fi
60- }
6149# Figure out correct version of a three part version number is not passed
6250find_version_from_git_tags () {
6351 local variable_name=$1
@@ -148,7 +136,7 @@ if ! cat /etc/group | grep -e "^golang:" > /dev/null 2>&1; then
148136 groupadd -r golang
149137fi
150138usermod -a -G golang " ${USERNAME} "
151- mkdir -p " ${TARGET_GOROOT} " " ${TARGET_GOPATH} "
139+ mkdir -p " ${TARGET_GOROOT} " " ${TARGET_GOPATH} "
152140if [ " ${TARGET_GO_VERSION} " != " none" ] && ! type go > /dev/null 2>&1 ; then
153141 # Use a temporary locaiton for gpg keys to avoid polluting image
154142 export GNUPGHOME=" /tmp/tmp-gnupg"
@@ -231,19 +219,10 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
231219 rm -rf /tmp/gotools
232220fi
233221
234- # Add GOPATH variable and bin directory into PATH in bashrc/zshrc files (unless disabled)
235- updaterc " $( cat << EOF
236- export GOPATH="${TARGET_GOPATH} "
237- if [[ "\$ {PATH}" != *"\$ {GOPATH}/bin"* ]]; then export PATH="\$ {PATH}:\$ {GOPATH}/bin"; fi
238- export GOROOT="${TARGET_GOROOT} "
239- if [[ "\$ {PATH}" != *"\$ {GOROOT}/bin"* ]]; then export PATH="\$ {PATH}:\$ {GOROOT}/bin"; fi
240- EOF
241- ) "
242222
243223chown -R " ${USERNAME} :golang" " ${TARGET_GOROOT} " " ${TARGET_GOPATH} "
244224chmod -R g+r+w " ${TARGET_GOROOT} " " ${TARGET_GOPATH} "
245225find " ${TARGET_GOROOT} " -type d -print0 | xargs -n 1 -0 chmod g+s
246226find " ${TARGET_GOPATH} " -type d -print0 | xargs -n 1 -0 chmod g+s
247227
248228echo " Done!"
249-
0 commit comments