go-grpc

module
v0.0.0-...-76b32bc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2021 License: MIT

README

go-grpc

Install Protobuf compiler [protoc]

# mac
brew install protobuf

# linux(usage with docker)
PROTOC_ZIP=protoc-3.14.0.-linux-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP

Installing gRPC code generation libs for go

go get -u google.golang.org/grpc
go get -u github.com/golang/protobuf/protoc-gen-go

# generating codes
protoc --proto_path=proto proto/*.proto --go_out=plugins=grpc:pb

IDE extension set for proto files

# configure proto path with pasting following settings
"protoc": {
  "path": "/usr/local/bin/protoc",
  "compile_on_save": false,
  "options": [
    "--proto_path=protos"
  ]
}

# instal clang-format for proto formatting(debian)
apt install clang-format

# ADD FOLLOWING SNIPPET FOR AUTO FORMATTING
"clang-format.executable": "/usr/bin/clang-format",
"[proto3]": {
  "editor.defaultFormatter": "xaver.clang-format",
  "editor.formatOnSave": true
}

Makefile specs

  • git - git add - commit - push commands
  • gen - generate go code from proto file
  • clean - clean all generated code
  • server - run server main
  • run - run client main
  • test - run all package test with coverage

References

protobuf
protoc-linux-install
proto-package-option
grpc-io-go
protobuf-famous-types
google-uuid
golang-copier

Author

Akshit Sadana akshitsadana@gmail.com

License

Licensed under the MIT License

Directories

Path Synopsis
cmd
Package sample generated sample data
Package sample generated sample data
Package serializer serializes laptop object
Package serializer serializes laptop object
Package service impls app services
Package service impls app services

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL