Install GoLang
- Used Env: OSX 10.9.x or higher
- used tool: brew or Tarball
install go
- case i) brew
# brew install go
- case ii) tarball
cd $HOME
wget https://storage.googleapis.com/golang/go1.2.2.src.tar.gz
tar zxvf go1.2.2.src.tar.gz
cd go/src
./all.bash
Installed at "$HOME/go"
Enviroment Variable setting
if [ -x "`which go`" ]; then
export _GOROOT=`go env GOROOT`
export GOPATH=$HOME/.goproj
PATH=$PATH:$GOPATH/bin:$_GOROOT/bin
fi
- GOROOT is not needed
- PATH setting for godoc
godoc
go get code.google.com/p/go.tools/cmd/godoc
vim setting
go get github.com/nsf/gocode
go get code.google.com/p/go.tools/cmd/goimports
if $_GOROOT != ''
set rtp+=${_GOROOT}/misc/vim
set rtp+=${GOPATH}/src/github.com/nsf/gocode/vim
endif
"use goimports instead of gofmt
let g:gofmt_command = 'goimports'
"When save :Fmt
au BufWritePre *.go Fmt
au BufNewFile,BufRead *.go set sw=4 noexpandtab ts=4
au FileType go compiler go
댓글 없음:
댓글 쓰기