Skip to content

alexcpn/golang_grpc_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This Repo is Obsolete now; (as of 2022)

There are lot of chages in go modules and Go in general and Go GRPC and builder tools in specific; See the new repo https://github.com/alexcpn/go_grpc_2022

Protobuffer/GRPC with GO (modules)

with Proto-gen-validation and protoc-gen-doc and complete Make file

Also you can use this as a sample template to generate Go Microservices. The interfaces folder is kept out so that multiple microservice interfaces can be added in different directories here and between microservice only interfaces need to be shared

See also https://medium.com/techlogs/micro-services-git-d840305e6220

Please read the documentation at protoc-gen-validate. Protobuffer is great in providing a static typed interface. However types like strings in interface is hard to 'semantically type'. With the protoc-gen-validate project you can sepicfy semantic validation in the proto buffer itself

Also added https://github.com/pseudomuto/protoc-gen-doc to generate better documentation for proto files

To build A Docker Container for your GO MS

If you need to build a slim Docker container with Go GRPC cd to microservice_x directory and run 'make make_in_docker'. If you get an error saying that grpc/go:1.12 Docker image is not available build that image first by doing to docker-go1.12 folder and docker build that

To build locally

In a (linux) machine wich has Go installed > 1.12 and
cd to microservice_x directory and run 'make all'

To Test

cd to microservice_x directory cd to integration_test and run 'go test'

To run manually

cd to microservice_x directory cd to test_server and run the generated ./test_server cd to test_client and run the generated ./test_client

To build locally without any dependencies

If you just have 'make' installed and don't have any other dependency even Go you can build the same output in a Docker container First cd to microservice_x and run 'make make_in_docker_with_vol_map' (note - some file permission changes after this)

To build in Windows

From Windows 10 onwards has docker support. You can install 'make' via Cholclatey (https://stackoverflow.com/a/54086635/429476) and run. The shell scripts for CURRENTDIR and PARENTDIR needs to be adopted to Windows Path format


(The github ci events is enabled for this- you can fork - do some dummy changes and create a pull request to see the make in action https://github.com/alexcpn/golang_grpc_example/pull/5/checks?check_run_id=372118434)

About

Demo for Protobuffer validation and documentation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published