Before we start you should have golang on your machine, so lets get it, or if you already has one, just install useful libraries
- For Linux:
sudo apt install golang-go- For MacOS:
brew install goAdd next lines into you .bashrc or .zshrc, depends on what terminal emulatar you use.
export GOPATH=$HOME/go
export PATH="$PATH:$GOPATH/bin:$PATH"- Goimports
go get golang.org/x/tools/cmd/goimports- Go Linter
- For Linux:
go get -u github.com/golangci/golangci-lint
cd $(go env GOPATH)/src/github.com/golangci/golangci-lint/cmd/golangci-lint
go install -ldflags "-X 'main.version=$(git describe --tags)' -X 'main.commit=$(git rev-parse --short HEAD)' -X 'main.date=$(date)'"- For MacOS:
brew install golangci/tap/golangci-lint
brew upgrade golangci/tap/golangci-lint