This example demonstrates the basic usage of dubbo-go as an RPC framework. Check Quick Start on our official website for detailed explanation.
Install `protoc version3 Please refer to Protocol Buffer Compiler Installation.
Install protoc-gen-go
and protoc-gen-triple
Install the version of your choice of protoc-gen-go. here use the latest version as example:
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31
Install the latest version of protoc-gen-triple:
go install dubbo.apache.org/dubbo-go/v3/cmd/protoc-gen-go-triple@v3.0.1
Generate stub code
Generate related stub code with protoc-gen-go and protoc-gen-go-triple:
protoc --go_out=. --go_opt=paths=source_relative --go-triple_out=. --go-triple_opt=paths=source_relative ./proto/greet.proto
go run ./go-server/cmd/main.go
test server work as expected:
curl \ --header "Content-Type: application/json" \ --data '{"name": "Dubbo"}' \ http://localhost:20000/greet.GreetService/Greet
go run ./go-client/cmd/main.go