Skip to content

harryosmar/grpc-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

setup

https://grpc.io/docs/languages/go/quickstart/

1. GO PATH

Make sure gopath has been setup and added to path

export PATH="$PATH:$(go env GOPATH)/bin"

2. Protocol Compiler= ProtoBuf/ProtocolBuffer Compiler = protoc

https://github.com/protocolbuffers/protobuf/releases https://grpc.io/docs/protoc-installation/

	curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protoc-3.17.3-osx-x86_64.zip \
	&& unzip -o protoc-3.17.3-osx-x86_64.zip -d /usr/local/bin/protoc \
	&& unzip -o protoc-3.17.3-osx-x86_64.zip -d /usr/local/include/*' \
	&& rm -f protoc-3.17.3-osx-x86_64.zip

verify protoc installation

protoc --version

3. Code Generator / protoc-gen-

Protobuf support go programming language https://github.com/protocolbuffers/protobuf-go in package google.golang.org/protobuf

ProtoBuf/protoc compiler plugins for code generator

Protocol buffer compiler requires a plugin to generate code

https://grpc.io/docs/languages/go/quickstart/

# The protocol buffer `compiler` requires a plugin to generate Go code
go get google.golang.org/protobuf/cmd/[email protected]

# The protocol buffer `compiler` requires a plugin to generate grpc Go code
go get google.golang.org/grpc/cmd/[email protected]

Example

cd helloword

# after changes in helloworld.proto
protoc --go_out=. --go_opt=paths=source_relative \
    --go-grpc_out=. --go-grpc_opt=paths=source_relative \
    helloworld/helloworld.proto


go run greeter_server/main.go

go run greeter_client/main.go

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages