zoukankan      html  css  js  c++  java
  • [Go] protobuffer 的环境配置

    一般使用gprc是需要使用protobuf作为数据传输的格式标准,可以对要传输的对象结构体进行序列化

    先安装protoc,找到对应版本,下载直接把二进制文件复制到环境变量可以访问到的地方就行

    https://github.com/protocolbuffers/protobuf/releases

    安装go的依赖包和工具

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

    git clone https://github.com/golang/protobuf.git $GOPATH/src/github.com/golang/protobuf
    go install github.com/golang/protobuf/protoc-gen-go

    创建文件比如orders.proto,required必填 ,后面那个1和2是字段顺序

    syntax = "proto2";
    message Orders {
    required int32 order_id=1;
    required string title=2;
    }
     
     
  • 相关阅读:
    python
    爬虫
    python 自动登录
    day22 cookie session 中间件 Form
    day10进程、异步IO、
    python第五课
    day21
    day20 Django
    day 19
    day18
  • 原文地址:https://www.cnblogs.com/taoshihan/p/11973997.html
Copyright © 2011-2022 走看看