{"id":4437,"date":"2021-09-22T19:57:26","date_gmt":"2021-09-22T11:57:26","guid":{"rendered":"https:\/\/www.ookangzheng.com\/?p=4437"},"modified":"2022-02-20T15:41:10","modified_gmt":"2022-02-20T07:41:10","slug":"asdf-to-manage-multiple-golang-on-mac","status":"publish","type":"post","link":"https:\/\/www.ookangzheng.com\/asdf-to-manage-multiple-golang-on-mac\/","title":{"rendered":"asdf to manage multiple Golang on Mac"},"content":{"rendered":"\n
<\/p>\n\n\n\n
git clone https:\/\/github.com\/asdf-vm\/asdf.git ~\/.asdf --branch v0.8.1<\/code><\/pre>\n\n\n\nAdd asdf<\/code> to zsh<\/h2>\n\n\n\nZSH & Homebrew<\/h3>\n\n\n\n
Add asdf.sh<\/code> to your ~\/.zshrc<\/code> with:<\/p>\n\n\n\necho -e \"\\n. $(brew --prefix asdf)\/libexec\/asdf.sh\" >> ${ZDOTDIR:-~}\/.zshrc<\/code><\/pre>\n\n\n\nZSH & Git<\/h3>\n\n\n\n
Add the following to ~\/.zshrc<\/code>:<\/p>\n\n\n\n. $HOME\/.asdf\/asdf.sh<\/code><\/pre>\n\n\n\nInstall plugin dependencies<\/h2>\n\n\n\nbrew install gpg gawk<\/code><\/pre>\n\n\n\nInstall Golang <\/h2>\n\n\n\n
Version control config file: ~\/.tool-versions<\/code><\/p>\n\n\n\n## Install golang plugin\nasdf plugin-add golang\n\n# Install global version golang\nasdf install golang 1.17.7\n\n# Setup global golang version\nasdf global golang 1.17.7\n\n# Setup local version of golang\n\nasdf local golang 1.16<\/code><\/pre>\n\n\n\nSetup Golang environment<\/h2>\n\n\n\n
Paste it into your .bashrc<\/code> or .zshrc<\/code><\/p>\n\n\n\nexport GOPATH=$(go env GOPATH)\nexport GOROOT=$(go env GOROOT)\nexport GOBIN=$(go env GOBIN)\nexport PATH=$PATH:$GOPATH\/bin\nexport PATH=$PATH:$GOROOT\/bin\nexport PATH=$PATH:$GOBIN\n\n# Source\n# https:\/\/gist.github.com\/vsouza\/77e6b20520d07652ed7d#file-zshrc<\/code><\/pre>\n\n\n\nSave and restart your terminal<\/p>\n\n\n\n
Try to install something useful<\/h2>\n\n\n\n# shfmt lint \ngo install mvdan.cc\/sh\/v3\/cmd\/shfmt@latest\n\n# Git Semantic Versioning\ngo get -u github.com\/linyows\/git-semv\/cmd\/git-semv<\/code><\/pre>\n\n\n\nReferences:<\/p>\n\n\n\n
- https:\/\/gist.github.com\/rubencaro\/5ce32fb30bbfa70e7db6be14cf42a35c<\/li>
- https:\/\/gist.github.com\/rubencaro\/5ce32fb30bbfa70e7db6be14cf42a35c<\/li>
- https:\/\/stackoverflow.com\/questions\/25216765\/gobin-not-set-cannot-run-go-install<\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"
Installation Add asdf to zsh ZSH & Homebrew Add asdf.sh to your ~\/.zshrc with: ZSH & Git Add the following…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43,39,32],"tags":[],"class_list":["post-4437","post","type-post","status-publish","format-standard","hentry","category-dev","category-mac","category-technology"],"_links":{"self":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts\/4437","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/comments?post=4437"}],"version-history":[{"count":7,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts\/4437\/revisions"}],"predecessor-version":[{"id":4554,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/posts\/4437\/revisions\/4554"}],"wp:attachment":[{"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/media?parent=4437"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/categories?post=4437"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ookangzheng.com\/wp-json\/wp\/v2\/tags?post=4437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}