download latest Protocol Buffers or which version you need.
link: https://github.com/protocolbuffers/protobuf/releases
proto_buf version: protoc-21.10-osx-x86_64.zip
- cp protoc-21.10-osx-x86_64.zip to you local path /usr/local/{YourPathName}
>> tar -xzvf protoc-21.10-osx-x86_64.zip
- open bash_profile and edit
>> vim ~/.bash_profile
export PROTOBUF=/usr/local/{YourPathName}
export PATH=$PATH:$PROTOBUF/bin
- source
>> source ~/.bash_profile
- it's ok
>> protoc --version
libprotoc 3.21.10
link: https://github.com/grpc-ecosystem/grpc-gateway
git clone git@github.com:thatshinji/micro-gogrpc-gateway.git
change directory to micro-gogrpc-gateway
>> go run main.go
>> cd client
>> go run main.go
you will see the response in the terminal
open browser and tap localhost:8080/tarce/{id}, you will see:
// http://localhost:8080/trace/123
{
"id": "123",
"trace": {
"time": "1670424996",
"location": "shanghai",
"staySec": "100",
"vieePage": "hompage"
}
}