proto/lint: Add protobuf GitHub action and linter (#943)

* Buf upgrades

* Buf format and basic endpoint fixes

* gRPC linter fixes

* Amend buf.yaml linter exceptions

* Update README

* Freshly generated gRPC code after depends update

* Nitterinos
This commit is contained in:
Adrian Gallagher
2022-05-10 15:38:50 +10:00
committed by GitHub
parent 5266437b27
commit 61212fb8ea
19 changed files with 7206 additions and 6853 deletions

View File

@@ -52,13 +52,13 @@ This will place the following binaries in your `$GOBIN`;
Make sure that your `$GOBIN` is in your `$PATH`.
### Linux / macOS
### Linux / macOS / Windows
GoCryptoTrader requires a local installation of the `buf` cli tool that tries to make Protobuf handling more easier and reliable,
after [installation](https://docs.buf.build/installation) you'll need to run:
```shell
buf beta mod update
buf mod update
```
After previous command, make necessary changes to the `rpc.proto` spec file and run the generation command:
@@ -67,10 +67,4 @@ After previous command, make necessary changes to the `rpc.proto` spec file and
buf generate
```
### Windows
After the above dependencies are required, make necessary changes to the `rpc.proto`
spec file and run the generation scripts:
Run `gen_pb_win.bat`
If any changes were made, ensure that the `rpc.proto` file is formatted correctly by using `buf format -w`

View File

@@ -1,4 +1,4 @@
version: v1beta1
version: v1
plugins:
- name: go
out: ./

View File

@@ -2,16 +2,10 @@
version: v1
deps:
- remote: buf.build
owner: beta
owner: googleapis
repository: googleapis
branch: main
commit: 1c473ad9220a49bca9320f4cc690eba5
digest: b1-unlhrcI3tnJd0JEGuOb692LZ_tY_gCGq6mK1bgCn1Pg=
create_time: 2021-06-23T20:16:47.788079Z
commit: 8ab0a452adb64b36ac7a40ae95bd59b2
- remote: buf.build
owner: grpc-ecosystem
repository: grpc-gateway
branch: main
commit: d19475fa22444a289c46af009acce62c
digest: b1-_zhDPyr_Ctc1QRAKuad6_0xvoyPd6QaB22ldm9gzS0Q=
create_time: 2021-04-26T15:19:26.742789Z
commit: febd9e8be39b4f4b878b9c64bcc203fd

View File

@@ -1,5 +1,17 @@
version: v1beta1
version: v1
name: buf.build/gocryptotrader/grpc
lint:
use:
- DEFAULT
except:
- RPC_REQUEST_RESPONSE_UNIQUE
- PACKAGE_DIRECTORY_MATCH
- PACKAGE_VERSION_SUFFIX
- RPC_RESPONSE_STANDARD_NAME
- RPC_REQUEST_STANDARD_NAME
breaking:
use:
- FILE
deps:
- buf.build/beta/googleapis
- buf.build/googleapis/googleapis
- buf.build/grpc-ecosystem/grpc-gateway

View File

@@ -1,9 +0,0 @@
echo "GoCryptoTrader: Generating gRPC, proxy and swagger files."
# You may need to include the go mod package for the annotations file:
# $GOPATH/pkg/mod/github.com/grpc-ecosystem/grpc-gateway/v2@v2.0.1/third_party/googleapis
export GOPATH=$(go env GOPATH)
protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go_out=paths=source_relative:. rpc.proto
protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go-grpc_out=paths=source_relative:. rpc.proto
protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --grpc-gateway_out=paths=source_relative,logtostderr=true:. rpc.proto
protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --openapiv2_out=logtostderr=true:. rpc.proto

View File

@@ -1,9 +0,0 @@
@echo off
echo GoCryptoTrader: Generating gRPC, proxy and swagger files.
REM You may need to include the go mod package for the annotations file:
REM %GOPATH%\pkg\mod\github.com\grpc-ecosystem\grpc-gateway\v2@v2.0.1\third_party\googleapis
protoc -I=. -I=%GOPATH%\src -I=%GOPATH%\src\github.com\grpc-ecosystem\grpc-gateway\third_party\googleapis --go_out=paths=source_relative:. rpc.proto
protoc -I=. -I=%GOPATH%\src -I=%GOPATH%\src\github.com\grpc-ecosystem\grpc-gateway\third_party\googleapis --go-grpc_out=paths=source_relative:. rpc.proto
protoc -I=. -I=%GOPATH%\src -I=%GOPATH%\src\github.com\grpc-ecosystem\grpc-gateway\third_party\googleapis --grpc-gateway_out=paths=source_relative,logtostderr=true:. rpc.proto
protoc -I=. -I=%GOPATH%\src -I=%GOPATH%\src\github.com\grpc-ecosystem\grpc-gateway\third_party\googleapis --openapiv2_out=logtostderr=true:. rpc.proto

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff