aboutsummaryrefslogtreecommitdiff
path: root/src/go
diff options
context:
space:
mode:
Diffstat (limited to 'src/go')
-rw-r--r--src/go/devcontainer-feature.json5
-rwxr-xr-xsrc/go/install.sh23
2 files changed, 4 insertions, 24 deletions
diff --git a/src/go/devcontainer-feature.json b/src/go/devcontainer-feature.json
index f7ee1ad..cb30c5b 100644
--- a/src/go/devcontainer-feature.json
+++ b/src/go/devcontainer-feature.json
@@ -26,8 +26,9 @@
}
},
"containerEnv": {
- "GOPATH": "/usr/local/go",
- "PATH": "/usr/local/go/bin:${PATH}"
+ "GOROOT": "/usr/local/go",
+ "GOPATH": "/go",
+ "PATH": "/usr/local/go/bin:/go/bin:${PATH}"
},
"capAdd": [
"SYS_PTRACE"
diff --git a/src/go/install.sh b/src/go/install.sh
index 3b0ff26..86bdbc6 100755
--- a/src/go/install.sh
+++ b/src/go/install.sh
@@ -12,7 +12,6 @@ TARGET_GO_VERSION=${VERSION:-"latest"}
TARGET_GOROOT=${TARGET_GOROOT:-"/usr/local/go"}
TARGET_GOPATH=${TARGET_GOPATH:-"/go"}
USERNAME=${USERNAME:-"automatic"}
-UPDATE_RC=${UPDATE_RC:-"true"}
INSTALL_GO_TOOLS=${INSTALL_GO_TOOLS:-"true"}
# https://www.google.com/linuxrepositories/
@@ -47,17 +46,6 @@ elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
USERNAME=root
fi
-updaterc() {
- if [ "${UPDATE_RC}" = "true" ]; then
- echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
- if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
- echo -e "$1" >> /etc/bash.bashrc
- fi
- if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
- echo -e "$1" >> /etc/zsh/zshrc
- fi
- fi
-}
# Figure out correct version of a three part version number is not passed
find_version_from_git_tags() {
local variable_name=$1
@@ -148,7 +136,7 @@ if ! cat /etc/group | grep -e "^golang:" > /dev/null 2>&1; then
groupadd -r golang
fi
usermod -a -G golang "${USERNAME}"
-mkdir -p "${TARGET_GOROOT}" "${TARGET_GOPATH}"
+mkdir -p "${TARGET_GOROOT}" "${TARGET_GOPATH}"
if [ "${TARGET_GO_VERSION}" != "none" ] && ! type go > /dev/null 2>&1; then
# Use a temporary locaiton for gpg keys to avoid polluting image
export GNUPGHOME="/tmp/tmp-gnupg"
@@ -231,14 +219,6 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
rm -rf /tmp/gotools
fi
-# Add GOPATH variable and bin directory into PATH in bashrc/zshrc files (unless disabled)
-updaterc "$(cat << EOF
-export GOPATH="${TARGET_GOPATH}"
-if [[ "\${PATH}" != *"\${GOPATH}/bin"* ]]; then export PATH="\${PATH}:\${GOPATH}/bin"; fi
-export GOROOT="${TARGET_GOROOT}"
-if [[ "\${PATH}" != *"\${GOROOT}/bin"* ]]; then export PATH="\${PATH}:\${GOROOT}/bin"; fi
-EOF
-)"
chown -R "${USERNAME}:golang" "${TARGET_GOROOT}" "${TARGET_GOPATH}"
chmod -R g+r+w "${TARGET_GOROOT}" "${TARGET_GOPATH}"
@@ -246,4 +226,3 @@ find "${TARGET_GOROOT}" -type d -print0 | xargs -n 1 -0 chmod g+s
find "${TARGET_GOPATH}" -type d -print0 | xargs -n 1 -0 chmod g+s
echo "Done!"
-