golang环境搭建及grpc学习

qingu · · 677 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

一、golang环境搭建

  1. 安装golang IDE,选择vs code, 安装golang,配置环境变量GOPATH,GOROOT,安装GIT
  2. 安装golang插件

   3. go tools安装

https://github.com/Microsoft/vscode-go/wiki/Go-tools-that-the-Go-extension-depends-on

go get -u -v github.com/ramya-rao-a/go-outline
go get -u -v github.com/acroca/go-symbols
go get -u -v github.com/mdempsky/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v golang.org/x/tools/cmd/godoc
go get -u -v github.com/zmb3/gogetdoc
go get -u -v golang.org/x/lint/golint
go get -u -v github.com/fatih/gomodifytags
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v github.com/cweill/gotests/...
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v github.com/josharian/impl
go get -u -v github.com/haya14busa/goplay/cmd/goplay
go get -u -v github.com/uudashr/gopkgs/cmd/gopkgs
go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
go get -u -v github.com/alecthomas/gometalinter
gometalinter --install

   4. 工作区配置

USER SETTINGS

{

    "git.ignoreMissingGitWarning": true

}

 

WORKSPACE SETTINGS

{

    "files.autoSave": "onFocusChange",

    "go.buildOnSave": "package",

    "go.lintOnSave": "package",

    "go.vetOnSave": "package",

    "go.buildTags": "",

    "go.buildFlags": [],

    "go.lintFlags": [],

    "go.vetFlags": [],

    "go.coverOnSave":false,

    "go.useCodeSnippetsOnFunctionSuggest": false,

    "go.formatTool": "goreturns",

    "go.goroot": "C:\\go",

    "go.gopath": "F:\\work\\go",

    "go.gocodeAutoBuild":false

}

 

二、gRPC

1.  gRPC官方文档中文版

http://doc.oschina.net/grpc?t=58009

2. 安装gRPC

git clone https://github.com/grpc/grpc-go.git $GOPATH/src/google.golang.org/grpc

git clone https://github.com/golang/net.git $GOPATH/src/golang.org/x/net

git clone https://github.com/golang/text.git $GOPATH/src/golang.org/x/text 

go get -u github.com/golang/protobuf/{proto,protoc-gen-go}

git clone https://github.com/google/go-genproto.git $GOPATH/src/google.golang.org/genproto

cd $GOPATH/src/

go install google.golang.org/grpc

                                                                           

gRPC 4类服务方法例子:google.golang.org\grpc\examples\route_guide 如果报错,需要下载对应的安装包

go get github.com/golang/mock/gomock

go get github.com/golang/mock/mockgen


有疑问加站长微信联系(非本文作者)

本文来自:CSDN博客

感谢作者:qingu

查看原文:golang环境搭建及grpc学习

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

677 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传