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

推荐订阅源

C
Check Point Blog
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
G
Google Developers Blog
博客园 - 聂微东
爱范儿
爱范儿
博客园 - 叶小钗
J
Java Code Geeks
月光博客
月光博客
博客园 - Franky
MongoDB | Blog
MongoDB | Blog
The Cloudflare Blog
宝玉的分享
宝玉的分享
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
The GitHub Blog
The GitHub Blog
小众软件
小众软件
WordPress大学
WordPress大学
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Vercel News
Vercel News
Y
Y Combinator 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 文档

文档链接