From 9d7089ea44070f0b13b69fa2cacef14afa3617a0 Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Tue, 16 Jul 2024 12:11:16 +0300 Subject: [PATCH] {bash,zsh}rc: add goenv support --- rc/bashrc | 10 ++++++++++ rc/zshrc | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/rc/bashrc b/rc/bashrc index b238ea8a..40d3d25e 100755 --- a/rc/bashrc +++ b/rc/bashrc @@ -296,6 +296,16 @@ if [ -d ~/.nodenv/bin ]; then # git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build fi +# https://github.com/go-nv/goenv +if [ -d ~/.goenv/bin ]; then + export GOENV_ROOT="$HOME/.goenv" + PATH="$HOME/.goenv/bin:$PATH" + #goenv init > /dev/null 2>&1 + eval "$(goenv init -)" + PATH="$GOROOT/bin:$PATH" + PATH="$PATH:$GOPATH/bin" +fi + # Removes duplicates from $PATH. Copied from https://unix.stackexchange.com/a/14896 PATH=$(echo "$PATH" | awk -v RS=':' -v ORS=":" '!a[$1]++{if (NR > 1) printf ORS; printf $a[$1]}') diff --git a/rc/zshrc b/rc/zshrc index 0da4acf1..c3e99965 100755 --- a/rc/zshrc +++ b/rc/zshrc @@ -261,6 +261,16 @@ if [ -d ~/.nodenv/bin ]; then # git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build fi +# https://github.com/go-nv/goenv +if [ -d ~/.goenv/bin ]; then + export GOENV_ROOT="$HOME/.goenv" + PATH="$HOME/.goenv/bin:$PATH" + #goenv init > /dev/null 2>&1 + eval "$(goenv init -)" + PATH="$GOROOT/bin:$PATH" + PATH="$PATH:$GOPATH/bin" +fi + # Removes duplicates from $PATH. Copied from https://unix.stackexchange.com/a/14896 PATH=$(echo "$PATH" | awk -v RS=':' -v ORS=":" '!a[$1]++{if (NR > 1) printf ORS; printf $a[$1]}')