Goland 不识别.proto
文件
goland 可以安装插件识别.proto
文件File->setting->plugins
go get 报错\git clone报错
package google.golang.org/grpc: unrecognized import path "google.golang.org/grpc"(https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
- 建议直接到
github
下载压缩包,自行放到goroot
或gopath
下,取决于GO111MODULE
的设置 - 或者检查
golang
环境,有时会因为go mod
的问题导致不能go get
,检查set GO111MODULE=on
,并不好用 - 不要在网上随便找个私人的镜像就用了,
google.golang.org\grpc
和google.golang.org\protobuf
可能版本不一致,最后代码报错飘红 https://github.com/grpc/grpc
https://github.com/protocolbuffers/protobuf
安装流程
- 官网下载
protoc.exe
- 配好环境变量
protoc-gen-go.exe
命令行go get github.com/golang/protobuf/protoc-gen-go
- 下载
https://github.com/grpc/grpc
放到GOROOT下 - 下载
https://github.com/protocolbuffers/protobuf
放到GOROOT下 - 目录名
C:\Go\src\google.golang.org\grpc