windows下安装golang使用protobuf

栏目: Go · 发布时间: 7年前

一、安装protobuf

1.去github下载protobuf,网址是 https://github.com/google/protobuf ,按照readme的步骤来编译安装。

2.确保你的电脑上安装了 go 的编译器以及相关工具,具体参考go编译器的安装方式,安装好了,所需的 工具 就有了

3.安装git工具

4.在命令提示行中输入go get github.com/golang/protobuf/protoc-gen-go,稍等片刻会生成protoc-gen-go.exe等相关工具,将该文件夹添加到环境变量Path中

5.安装protobuf,输入go get github.com/golang/protobuf/proto

6.找到protoc.exe将其添加到环境变量

二、测试

1.新建test.proto文件添加以下内容

syntax = "proto3";

package Test;

message test_msg

{

int32 num= 1;

}

2.输入命令protoc --go_out=. test.proto

如果成功会生成test.pb.go文件


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Database Design and Implementation

Database Design and Implementation

Edward Sciore / Wiley / 2008-10-24 / 1261.00 元

* Covering the traditional database system concepts from a systems perspective, this book addresses the functionality that database systems provide as well as what algorithms and design decisions will......一起来看看 《Database Design and Implementation》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

随机密码生成器
随机密码生成器

多种字符组合密码