Skip to content

Commit 17180f2

Browse files
committed
multi: format test proto with generic script
1 parent 996f100 commit 17180f2

File tree

9 files changed

+356
-214
lines changed

9 files changed

+356
-214
lines changed

pricesrpc/.clang-format

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
Language: Proto
3+
BasedOnStyle: Google
4+
IndentWidth: 4
5+
AllowShortFunctionsOnASingleLine: None
6+
SpaceBeforeParens: Always
7+
CompactNamespaces: false

pricesrpc/gen_protos.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -e
66
function generate() {
77
echo "Generating root gRPC server protos"
88

9-
PROTOS="prices.proto"
9+
PROTOS="*.proto"
1010

1111
# For each of the sub-servers, we then generate their protos, but a restricted
1212
# set as they don't yet require REST proxies, or swagger docs.
@@ -20,6 +20,11 @@ function generate() {
2020
--go-grpc_out . --go-grpc_opt paths=source_relative \
2121
"${file}"
2222

23+
# Stop here if we don't need to generate anything REST.
24+
if [[ "$1" == "skip_rest" ]]; then
25+
return
26+
fi
27+
2328
# Generate the REST reverse proxy.
2429
annotationsFile=${file//proto/yaml}
2530
protoc -I/usr/local/include -I. \
@@ -73,6 +78,11 @@ format
7378
generate
7479
popd
7580

81+
pushd proxy/testdata
82+
format
83+
generate skip_rest
84+
popd
85+
7686
if [[ "$COMPILE_MOBILE" == "1" ]]; then
7787
pushd mobile
7888
./gen_bindings.sh $FALAFEL_VERSION

pricesrpc/prices.proto

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ package pricesrpc;
44

55
option go_package = "github.com/lightninglabs/aperture/pricesrpc";
66

7-
service Prices { rpc GetPrice(GetPriceRequest) returns (GetPriceResponse); }
7+
service Prices {
8+
rpc GetPrice (GetPriceRequest) returns (GetPriceResponse);
9+
}
810

911
message GetPriceRequest {
10-
string path = 1;
12+
string path = 1;
1113

12-
string http_request_text = 2;
14+
string http_request_text = 2;
1315
}
1416

15-
message GetPriceResponse { int64 price_sats = 1; }
17+
message GetPriceResponse {
18+
int64 price_sats = 1;
19+
}

proxy/proxy_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ type testCase struct {
5555
}
5656

5757
// helloServer is a simple server that implements the GreeterServer interface.
58-
type helloServer struct{}
58+
type helloServer struct {
59+
proxytest.UnimplementedGreeterServer
60+
}
5961

6062
// SayHello returns a simple string that also contains a string from the
6163
// request.

proxy/testdata/.clang-format

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
Language: Proto
3+
BasedOnStyle: Google
4+
IndentWidth: 4
5+
AllowShortFunctionsOnASingleLine: None
6+
SpaceBeforeParens: Always
7+
CompactNamespaces: false

proxy/testdata/gen_protos.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)