Config ZSH for Golang

April 12, 2022

Setting Up Golang Environment Variables

Edit your ZSH configuration file:

vim ~/.zshrc

Add Environment Variables

Add these lines to your .zshrc file:

export GOPATH=/Users/superlaptop/Web/go
export GOROOT=/usr/local/opt/go/libexec
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOPATH
export PATH=$PATH:$GOROOT/bin

Apply Changes

Reload your ZSH configuration:

source ~/.zshrc

Environment Variables Explained

  • GOPATH: Your Go workspace location
  • GOROOT: Go installation directory
  • GOBIN: Go binary executables location
  • PATH: System path including Go directories
#Golang #ZSH #Configuration #Environment