-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add grpc * Ignore generated files * Update makefile command * Fix docker
- Loading branch information
Showing
7 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,7 @@ | |
config/override.toml | ||
bin/ | ||
dist.zip | ||
frontend/dist/ | ||
frontend/dist/ | ||
|
||
# Ignore generated files | ||
*.pb.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,17 @@ get-front: | |
.PHONY: install-tools | ||
install-tools: | ||
go install github.com/swaggo/swag/cmd/swag@latest | ||
@# Referencing https://grpc.io/docs/protoc-installation/ | ||
@./script/install-protoc.sh | ||
@# Track https://grpc.io/docs/languages/go/quickstart/ for update | ||
go install google.golang.org/protobuf/cmd/[email protected] | ||
go install google.golang.org/grpc/cmd/[email protected] | ||
|
||
.PHONY: gen-proto | ||
gen-proto: install-tools | ||
protoc --go_out=. --go_opt=paths=source_relative \ | ||
--go-grpc_out=. --go-grpc_opt=paths=source_relative \ | ||
service/proto/*.proto | ||
|
||
.PHONY: build | ||
build: install-tools | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
# Check if protoc is installed | ||
if ! [ -x "$(command -v protoc)" ]; then | ||
echo "Installing protoc" | ||
# Check has sudo | ||
if ! [ -x "$(command -v sudo)" ]; then | ||
apt-get install -y protobuf-compiler | ||
else | ||
sudo apt-get install -y protobuf-compiler | ||
fi | ||
else | ||
echo "protoc is already installed" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
syntax = "proto3"; | ||
|
||
package oj_lab_stream.protos; | ||
|
||
option go_package = "github.com/OJ-lab/oj-lab-services/service/proto"; | ||
|
||
service Messaging { | ||
rpc StartStream (StreamRequest) returns (stream StreamResponse) {} | ||
} | ||
|
||
message StreamRequest { | ||
string id = 1; | ||
} | ||
|
||
message StreamResponse { | ||
string id = 1; | ||
string message = 2; | ||
} |