Golang開發編譯環境配置

Golang 1.13

使用vim-go

  • vim-go 需要Vim 7.4.2009, 默認的centos7 上 yum 安裝的是7.4.1006, 所以先升級
[@sjs_19_176 ~]# yum install -y gcc gcc-c++ ruby ruby-devel lua lua-devel \
ctags git python python-devel \
tcl-devel ncurses-devel \
perl perl-devel perl-ExtUtils-ParseXS \
perl-ExtUtils-CBuilder \
perl-ExtUtils-Embed
[@sjs_19_176 ~]#  wget https://github.com/vim/vim/archive/v7.4.2367.tar.gz ; tar -zxf  v7.4.2367.tar.gz; cd vim-7.4.2367
[@sjs_19_176 vim-7.4.2367]#  ./configure --with-features=huge --enable-multibyte --enable-rubyinterp=yes --enable-pythoninterp=yes --with-python-config-dir=/usr/lib64/python2.7/config --enable-perlinterp=yes --enable-luainterp=yes --enable-cscope --prefix=/usr/local

不翻牆使用go mod

[@sjs_19_176 ~]$ # go env -w GOPROXY=https://goproxy.io,direct
[@sjs_19_176 ~]$ go env -w GOPROXY=https://goproxy.cn,direct
[@sjs_19_176 ~]$ go env -w GOPRIVATE=git.sogou-inc.com

Makefile

PROJECT_BIN := demo                                                                                                                                                  
all: test build
    @echo ">>>>>> building done!"
test:
    go test -v -cover ./...
# Build the binary file
# -w 禁止生成debug信息,注意使用該選項後,無法使用 gdb 進行調試
# -s 禁用符號表
build: 
    go build -ldflags "-s -w" -o $(PROJECT_BIN)  main.go
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章