Table of Contents
- clean up go-build cache
$ go clean
- remove binary go tools
$ rm -rf $GOPATH/bin
- remove official src
$ rm -rf $GOPATH/src/golang.org
- (optional) remove source code folder.
$ cd $GOPATH/src/github.com/
$ ls
$ rm -rf folder-that-you-want-to-delete
- IF YOU use homebrew to install go or any go tools
$ brew list
$ brew uninstall some-go-tools
$ brew uninstall go
$ brew cleanup
IF YOU install go by dmg installer. checking uninstall doc at Go Official Uninstall doc
- remove env file
$ rm -rf ~/.spacemacs.d/.spacemacs.env
$ rm -rf ~/.spacemacs.env
- (optional) remove .spacemacs configuration file
$ rm ~/.spacemacs
- remove spacemacs
$ rm -rf ~/.emacs.d
- remove emacs
$ brew cask uninstall emacs
$ brew uninstall emacs
$ brew cleanup
- install go by homebrew
$ brew install go
- setup GOROOT & GOPATH into $PATH
you can change GOPATH if you want.
⚠️ check more info at Officail GOPATH Doc
export GOROOT=/usr/local/opt/go/libexec
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
- check go env
$ go env
- (optional) install go tools which will use by spacemacs.
GO111MODULE=on go get -v golang.org/x/tools/gopls@latest
GO111MODULE=on CGO_ENABLED=0 go get -v -trimpath -ldflags '-s -w' github.com/golangci/golangci-lint/cmd/golangci-lint
go get -u -v golang.org/x/tools/cmd/godoc
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v github.com/cweill/gotests/...
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
go get -u -v github.com/fatih/gomodifytags
go get -u -v github.com/godoctor/godoctor
go get -u -v github.com/haya14busa/gopkgs/cmd/gopkgs
go get -u -v github.com/josharian/impl
go get -u -v github.com/mdempsky/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/zmb3/gogetdoc
go get -u -v github.com/alecthomas/gometalinter
gometalinter --install --update
- (optional) install for go LSP
git clone https://github.com/saibing/bingo.git $GOPATH/src/github.com/saibing/bingo
cd $GOPATH/src/github.com/saibing/bingo
git checkout 5963059ef41a42c6a7e88f3f5266f32182fbbb35
GO111MODULE=on go install
or
go get -u github.com/sourcegraph/go-langserver
- (optional) install vendor manually for autocomplete support . check go-layer's autocomplete
$ gocode set autobuild true
$ go install ./vendor/...
- (optional workaround) if guru is broken in spacemacs (SPC m f d).
ln -s $GOPATH/bin/guru /usr/local/bin/guru
- install emacs by homebrew
$ brew cask install emacs
- install spacemacs by cloning repository.
$ git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d
OR
$ git clone -b develop https://github.com/syl20bnr/spacemacs ~/.emacs.d