https://github.com/akmamun/go-grpc
Basic gRPC with Go Lang
https://github.com/akmamun/go-grpc
go-grpc golang grpc grpc-service
Last synced: 28 days ago
JSON representation
Basic gRPC with Go Lang
- Host: GitHub
- URL: https://github.com/akmamun/go-grpc
- Owner: akmamun
- Created: 2019-02-18T13:11:53.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-18T13:23:39.000Z (about 6 years ago)
- Last Synced: 2025-02-01T18:43:31.271Z (3 months ago)
- Topics: go-grpc, golang, grpc, grpc-service
- Language: Go
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Install gRPC
```go
go get -u google.golang.org/grpc
```## Install the protoc plugin for Go
```go
go get -u github.com/golang/protobuf/protoc-gen-gogo install github.com/golang/protobuf/protoc-gen-go
```
## Install protobuf 3 on Ubuntu
```bash
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.7.0rc2/protoc-3.7.0-rc-2-linux-x86_64.zip# Unzip
unzip protoc-3.7.0-rc-2-linux-x86_64.zip -d protoc3# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/# Move protoc3/include to /usr/local/include/
sudo mv protoc3/include/* /usr/local/include/
```## Run Proto Buffer Generator
- Dot means same directory of proto file
```go
protoc folder_name/file_name.proto --go_out=plugins=grpc:.
example: protoc proto/helloworld.proto --go_out=plugins=grpc:.
```
### if want to change write name of directory
```go
protoc folder_name/file_name.proto --go_out=plugins=grpc:/directory_name
example: protoc proto/helloworld.proto --go_out=plugins=grpc:/proto
```### Run both server/main.go and client/main.go
```go
go run main.go
```