Giter VIP home page Giter VIP logo

install-pb's Introduction

install-pb

linux centos一键安装pb

1. linux 安装protoc 3

下载二进制文件到本地

wget https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protoc-3.14.0-linux-x86_64.zip

解压并移动到用户目录

unzip protoc-3.14.0-linux-x86_64.zip
mv bin/protoc /usr/local/bin/
mv include/ /usr/local/include/

查看是否生效

protoc --version
libprotoc 3.14.0

1. 常见问题

这样设置以后,找不到命令

解决方案

修改$PATH环境变量

2. protoc 没有执行权限

解决方案

chmod +x /usr/local/bin/protoc 

2. 生成xxx_grpc.pb.go

protoc  --go-grpc_out=./ xxx.proto

3. 生成xxx.pb.go

protoc  --go_out=./ xxx.proto

4. proto 3 demo

syntax = "proto3";
option go_package = "./";
message Request {
    string name = 1;
}

message Response {
    string name = 1;
}
// 定义服务
service Speak {

        // 定义方法
        rpc SpeakData(Request) returns (Response) {}

}

install-pb's People

Contributors

niuxiaodong778 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.