Contains the source code for the example explained in the fRPC Quick Start Guide. This one actually works...
- go >= 1.18
- protoc >= 3
brew install go
brew install protoc
Create a directory to serve as the workspace for your go projects
mkdir $HOME/go
Setup GOPATH
, GOBIN
and PATH
env variables as follows
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN
Ensure these variables are also present on every new shell session running the following code to change your shell rc file:
echo "export GOPATH=$HOME/go" >> $HOME/.zshrc
echo "export GOBIN=$GOPATH/bin" >> $HOME/.zshrc
echo "export PATH=$PATH:$GOBIN" >> $HOME/.zshrc
Install protoc-gen-go-frpc
plugin running the following command:
go install github.com/loopholelabs/frpc-go/protoc-gen-go-frpc@latest
Verify the package was installed correctly running the following command:
which protoc-gen-go-frpc
From the root of this project, run the following comand to generate the server and client code using the specs in echo.proto
protoc --go-frpc_out=. echo.proto
Verify that echo/echo.frpc.go
was created in the root of the project. Open it and change github.com/loopholelabs/polyglot-go
to github.com/loopholelabs/polyglot
in the imports section, and save.
go mod download
Open a new terminal and start the server running the following command
go run server/main.go
Open a new terminal and start the client running the following command
go run client/main.go