1、安装库文件protobuf,地址:https://github.com/protocolbuffers/protobuf/releases

我电脑是deepin 64位的,所以我直接下载https://github.com/protocolbuffers/protobuf/releases/download/v3.9.1/protoc-3.9.1-linux-x86_64.zip

$wget https://github.com/protocolbuffers/protobuf/releases/download/v3.9.1/protoc-3.9.1-linux-x86_64.zip
$mkdir protoc
$cd protoc
$unzip protoc-3.9.1-linux-x86_64.zip
$cd bin
$cp protoc /home/dongge/go-work/bin/#复制到$GOPATH/bin目录下
$protoc --version

2、安装插件

$go get github.com/golang/protobuf/protoc-gen-go

gogoprotobuf有两个插件可以使用

  • protoc-gen-gogo:和protoc-gen-go生成的文件差不多,性能也几乎一样(稍微快一点点)

  • protoc-gen-gofast:生成的文件更复杂,性能也更高(快5-7倍)

//gogo
$go get github.com/gogo/protobuf/protoc-gen-gogo
//gofast
$go get github.com/gogo/protobuf/protoc-gen-gofast

3、安装gogoprotobuf库文件

$go get github.com/gogo/protobuf/proto
$go get github.com/gogo/protobuf/gogoproto //这个不装也没关系

4、生成go文件

//gogo
$protoc --gogo_out=. *.proto //gofast
$protoc --gofast_out=. *.proto


deepin 安装golang protobuf的更多相关文章

  1. golang protobuf SetExtension

    对golang protobuf 的扩展字段赋值时候一直提示proto: bad extension value type clkUrl:="z.cn" proto.SetExte ...

  2. CentOS6.4安装Golang环境

    什么是Go? Go是一门并发支持.垃圾回收的编译型的系统编程语言,目的是为了创造一门具有在静态编译语言的高性能和动态语言的高效开发之间拥有良好平衡点的一门编程语言. Go的主要特点有哪些? 类型安全和 ...

  3. 安装Golang 1.6及开发环境

    安装Golang 1.6及开发环境=====================================> 下载软件    * go1.4.2.linux-amd64.tar.gz     ...

  4. ubuntu 12.04 lts安装golang并设置vim语法高亮

    安装golang sudo apt-get install golang 设置vim语法高亮 sudo apt-get install vim-gocomplete gocode vim-syntax ...

  5. Intellij IDEA安装golang插件

    原文作者:Jianan - qinxiandiqi@foxmail.com 原文地址:http://blog.csdn.net/qinxiandiqi/article/details/50319953 ...

  6. 从源码(编译)安装golang 二

    h1 { margin-top: 0.6cm; margin-bottom: 0.58cm; direction: ltr; color: #000000; line-height: 200%; te ...

  7. 从源码(编译)安装golang

    从源码安装golang 通常情况下,安装go只需要在官网(https://golang.org/dl/)下载适合系统的二进制发布包,按照安装说明进行安装即可. 对于Linux, Mac OS X和Fr ...

  8. Ubuntu安装配置protobuf 2.5

    Ubuntu安装配置protobuf 2.5 一.安装配置环境 Linux 1.安装protobuf 下载文件 https://github.com/protocolbuffers/protobuf/ ...

  9. Ubuntu、deepin 安装 mysql

    在 Ubuntu 和 deepin 安装 mysql 是很简单的,只需要几条简单的命令即可   1. sudo apt-get install mysql-server 2. sudo apt-get ...

随机推荐

  1. float示例

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. LintCode_100 删除排序数组中的重复数字 ||

    题目 跟进“删除重复数字”: 如果可以允许出现两次重复将如何处理? 样例 给出数组A =[1,1,1,2,2,3],你的函数应该返回长度5,此时A=[1,1,2,2,3]. C++代码 int rem ...

  3. 在C#应用中使用Common Logging日志接口

    我在C#应用中一般使用log4net来记录日志,但如果项目中有个多个工程,那么没有工程都需要引用log4neg,感觉很不爽.不过今日在开spring.net的时候,看到了有个通用日志接口Common ...

  4. java list转换json格式

    /** * 处理返回值(转换json格式和补零) * * @param resultDto5List * @param dateList * @return */ private JSONObject ...

  5. FreeMarker 对null值的处理技巧

    以下引用官方描述: ? The FreeMarker template language doesn't know the Java language null at all. It doesn't ...

  6. linux查看现在在运行的进程 $ pstree -a$ ps aux

    这都是查看现有进程的. ps aux 的结果比较杂乱 pstree -a 的结果比较简单明了,可以看到正在运行的进程及相关用户.

  7. fileinput URL携带参数的问题,uploadExtraData,Bootstrap

    因为无法在URL中执行其他代码,通过阅读文档可知可以由uploadExtraData参数携带数据.于是在这里携带,如果uploadExtraData 无法接收到数据,一般是格式有误, 先尝试这个简单的 ...

  8. WCF 无管理员权限下启用服务

    1 使用 netsh.exe 工具 C:\Windows\system32>netsh http add urlacl url=http://+:8733/WcfServiceLibrary1 ...

  9. Django用户名密码错误提示

    from django.shortcuts import render # Create your views here. from django.shortcuts import render fr ...

  10. 转:CentOS上安装LAMP之第三步:MySQL环境及安装过程报错解决方案(纯净系统环境)

    这是AMP运行环境中最后配置的环境: 惯例传送门: 1.编译安装MySQL cd /home/zhangatle/tar tar zxvf mysql-.tar.gz cd mysql- cmake ...