Skip to content

Commit 08a4be9

Browse files
change to library pkg & remove example service
1 parent 71c1aac commit 08a4be9

File tree

104 files changed

+5020
-591
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+5020
-591
lines changed

Makefile

+8-38
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,10 @@
1-
.PHONY : prepare build run
1+
.PHONY : test
22

3-
$(eval $(service):;@:)
4-
ifndef service
5-
$(error "service" is not set)
6-
endif
3+
PACKAGES = $(shell go list ./... | grep -v -e . -e mocks | tr '\n' ',')
74

8-
init:
9-
go run cmd/scaffold_maker/*.go --scope=initservice --servicename=$(service) --modules=$(modules)
10-
@$(MAKE) -f $(lastword $(MAKEFILE_LIST)) proto
11-
12-
add-module:
13-
go run cmd/scaffold_maker/*.go --scope=addmodule --servicename=$(service) --modules=$(modules)
14-
@$(MAKE) -f $(lastword $(MAKEFILE_LIST)) proto
15-
16-
prepare:
17-
@if [ ! -d "cmd/$(service)" ]; then echo "ERROR: service '$(service)' undefined"; exit 1; fi
18-
@ln -sf cmd/$(service)/main.go main_service.go
19-
20-
build: prepare
21-
go build -o bin
22-
23-
run: build
24-
./bin
25-
26-
proto:
27-
$(foreach proto_file, $(shell find api/$(service)/proto -name '*.proto'),\
28-
protoc -I . $(proto_file) --go_out=plugins=grpc:.;)
29-
30-
docker: prepare
31-
docker build --build-arg SERVICE_NAME=$(service) -t $(service):latest .
32-
33-
run-container:
34-
docker run --name=$(service) --network="host" -d $(service)
35-
36-
generate-rsa-key:
37-
sh scripts/generate_rsa_key.sh
38-
39-
clear:
40-
rm main_service.go bin backend-microservices
5+
# unit test & calculate code coverage
6+
test:
7+
@if [ -f coverage.txt ]; then rm coverage.txt; fi;
8+
@echo ">> running unit test and calculate coverage"
9+
@go test ./... -cover -coverprofile=coverage.txt -covermode=count -coverpkg=$(PACKAGES)
10+
@go tool cover -func=coverage.txt

cmd/auth-service/.env.sample

-49
This file was deleted.

cmd/auth-service/main.go

-29
This file was deleted.

cmd/scaffold_maker/main.go cmd/gendon/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
"text/template"
1313
)
1414

15-
const packageName = "agungdwiprasetyo.com/backend-microservices"
15+
const packageName = "pkg.agungdwiprasetyo.com/gendon"
1616

1717
type param struct {
1818
PackageName string
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

cmd/line-chatbot/.env.sample

-64
This file was deleted.

cmd/line-chatbot/README.md

-21
This file was deleted.

cmd/line-chatbot/main.go

-29
This file was deleted.

cmd/notification-service/.env.sample

-55
This file was deleted.

0 commit comments

Comments
 (0)