Best-Way-To-Structuring-Golang-Code
Best-Way-To-Structuring-Golang-Code copied to clipboard
This is example for how to designing a simple, clear, easy to read, and powefull structure in golang
Note
This repo is a example for this article https://arisharyanto.medium.com/best-way-to-structuring-golang-code-6e619e70ce38
How to Run
Run environment
$ docker-compose up -d
Install GRPC
follow this http://google.github.io/proto-lens/installing-protoc.html to install protobuf in your PC
and then run this in you cli
$ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
Activate Proto Shell
open bash_profile file
$ nano ~/.bash_profile
add this code inside
export GO_PATH=~/go
export PATH=$PATH:/$GO_PATH/bin
then save.
and then run this
$ source ~/.bash_profile
Generate Your Proto file
$ protoc -I./proto --go_out=./proto --go-grpc_out=./proto ./proto/*.proto
Run the code
$ go run cmd/*.go