惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
D
Docker
Jina AI
Jina AI
The GitHub Blog
The GitHub Blog
博客园 - 聂微东
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
博客园 - 叶小钗
爱范儿
爱范儿
D
DataBreaches.Net
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
Recent Announcements
Recent Announcements
U
Unit 42
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
宝玉的分享
宝玉的分享
量子位
Stack Overflow Blog
Stack Overflow Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog

博客园 - zakun

适配 WSL 的 proxy 完整脚本 Gitlab CI 本地开发部署 Mongo 聚合演示 真・一键激活 JetBrains 全家桶! Kafka 分区细说 解决国内Homebrew安装 Homebrew How to Install PHP Install Elasticsearch with Docke wsl2 网络相关设置 php docker image nginx 反向代理常用设置说明 Golang常见的并发模式 Gin框架的几种热加载方法 协程 Mysql Full-Text Index 介绍 gitlab runner 使用摘要 Gitlab Docker 使用摘要 Docker 简介 linux-查看文件夹大小 Linux 如何删除乱码文件-inode删除 Nginx反爬虫: 禁止某些User Agent抓取网站 PHP添加$_SERVER服务器环境变量
Golang grpc 实践
zakun · 2026-06-13 · via 博客园 - zakun

golang grpc 实践

golang grpc 参考文档

安装工具

golang 安装

  • 此处省略...

protocol buffer 编译器-protoc 命令安装

参考链接

  • Linux
apt install -y protobuf-compiler
protoc --version  # Ensure compiler version is 33.0+
  • macOS
brew install protobuf
protoc --version  # Ensure compiler version is 33.0+
> winget install protobuf
> protoc --version # Ensure compiler version is 33.0+

Go 代码生成插件

  1. Install the protocol compiler plugins for Go using the following commands:
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
  1. Update your PATH so that the protoc compiler can find the plugins:
export PATH="$PATH:$(go env GOPATH)/bin"
  1. 代码生成命令
protoc --go_out=. --go_opt=paths=source_relative \
    --go-grpc_out=. --go-grpc_opt=paths=source_relative \
    helloworld/helloworld.proto

Get the example code

git clone -b v1.81.1 --depth 1 https://github.com/grpc/grpc-go

protocol buffer 文档

文档链接