grpc-golang windows环境搭建说明

下载protoc,打开链接 下载后将对应的文件解压到gopath的bin目录。 下载protoc的golang插件。下载地址 链接 下载后放在protoc的同级目录(需要改扩展名为exe) 测试,定义一个Proto syntax = "proto3";option go_package = ".;hello";package main; message String { string value = 1;}然后执行命令 protoc hello.proto --go_out=. ,大功告成,生成的文件内容如下: // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.24.0-devel // protoc v3.12.3 // source: hello.proto package hello import ( proto "github.com/golang/protobuf/proto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" ) const ( // Verify that this generated code is sufficiently up-to-date....

February 28, 2022 · 3 min · czyt