Generating gRPC files for Flutter and Golang using Make file

308 Views Asked by At

Is this the right Make file code if I want to deploy my Golang server on Amazon AWS EC2 with this configuration:

Im not allowed to embed image so click here to see the image

Here is the Make File Code:

Shipping package

Assumes user is on MacOS, if other OS, please change PROTO_ROOT_DIR to the path of protobuf installation PROTO_ROOT_DIR = $(shell brew

--prefix)/Cellar/protobuf/3.6.0/include PROJECT_NAME = hello-grpc

Dart requires you to manually ship all google provided proto files too.

_gendart: @mkdir -p model/gen/ship/dart @protoc -I=model/protodefs --dart_out=grpc:model/gen/ship/dart model/protodefs/.proto @protoc -I$(PROTO_ROOT_DIR) --dart_out=model/gen/ship/dart $(PROTO_ROOT_DIR)/google/protobuf/.proto

_gengo: @mkdir -p model/gen @protoc -I=model/protodefs --go_out=plugins=grpc:model/gen model/protodefs/*.proto

gen: _gengo _gendart

build: get gen @env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags '-w -extldflags "-static"' -o build/${PROJECT_NAME}_linux_amd64 . @env GOARCH=amd64 go build -ldflags '-w -extldflags "-static"' -o build/${PROJECT_NAME}_macosx_amd64 .

get: @go get -u github.com/golang/dep/cmd/dep @dep ensure

install: get gen @cp config_template.json config.json

My confusion is that for building files for Amazon AWS EC2 with the above configuration I need to use (assuming my server go file name is main):

GOOS=linux GOARCH=amd64 go build -o main

But in the Make file this "GOARCH=386" is mentioned in this line:

build: get gen @env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build

What could be the right make file code when Im building Go gRPC Server on Mac OS for the above mentioned Amazon AWS EC2 instance

Please help me :(

0

There are 0 best solutions below