add Makefile

This commit is contained in:
Владимир Фёдоров 2024-05-19 16:14:07 +07:00
parent f917aff971
commit 288f880cdd
4 changed files with 37 additions and 1 deletions

View File

@ -1 +1,5 @@
api/*.proto
Makefile
cmd/**

13
Makefile Normal file
View File

@ -0,0 +1,13 @@
generate:
rm -rf proto
mkdir -p proto
protoc -I ./api \
--go_out ./proto --go_opt paths=source_relative \
--go-grpc_out ./proto --go-grpc_opt paths=source_relative \
--grpc-gateway_out ./proto --grpc-gateway_opt paths=source_relative \
--swagger_out=allow_merge=true,merge_file_name=main:./proto \
./api/main.proto
run:
go run ./cmd/${REPO_NAME_SNAKE}/main.go

View File

@ -1,5 +1,17 @@
syntax = "proto3";
package crabs.${REPO_NAME};
package crabs.${REPO_NAME_SNAKE};
import "google/api/annotations.proto";
service ${REPO_NAME_PASCAL} {
rpc Ping(PingReq) returns (PingRsp) {
option (google.api.http) = {
get: "/ping"
};
}
}
message PingReq {}
message PingRsp {}

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}