Golang Notes
Installation Using ASDF Install asdf: git clone https://github.com/asdf-vm/asdf.git ~/.asdf Create a global tool-versions file at ~/.tool-versions: tool_versions_file="$HOME/.tool-versions" cat > "$tool_versions_file" << EOF ruby 3.1.2 # not necessary for this example golang 1.20.5 python 3.11.3 # not necessary for this example EOF echo "Created $tool_versions_file" Add the following to your dotfiles: # Get setup file from my dotfiles # Please read the code before executing! setup_asdf_url="https://raw.githubusercontent.com/l50/dotfiles/main/files/setup_asdf.sh" curl -s "${setup_asdf_url}" -o "${setup_asdf_path}" # Get helper func from setup_asdf.sh # shellcheck source=/dev/null source "${HOME}/${setup_asdf_path}" source "$HOME/.asdf/asdf.sh" # Define language versions from global .tool-versions file setup_language "golang" "global" setup_language "python" "global" # not necessary for this example setup_language "ruby" "global" # not necessary for this example # Set and export environment variables GOPATH=$(go env GOPATH) GOROOT=$(go env GOROOT) FILES="${HOME}/.dotfiles/files" export GOPATH GOROOT GOBIN FILES export PATH=$PATH:$GOPATH/bin:$GOROOT/bin Resource: https://www.ookangzheng.com/asdf-to-manage-multiple-golang-on-mac ...