Widge.Go.Grpc.Testing
grpc go官方文档
开发依赖
2.1 Golang 环境
export PATH="$PATH:$(go env GOPATH)/bin"
2.2 Protocol buffer 编译器
brew install protobuf
apt install -y protobuf-compiler
或者下载可执行文件自行配置
2.3 Go 插件
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
proto 编译
Windows 运行 powershell 脚本,需要先设置Set-ExecutionPolicy Unrestricted
bash ./build.bash
.\build.ps1
运行
go mod tidy
go run .
打包
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
构建镜像
docker build --pull --rm -f "Dockerfile" -t <name=grpc.testing>:<version=latest> <workspace=".">