Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ jobs:
- name: Check code format
run: make fmt-check

- name: Check RPC format
run: make rpc-check

- name: compile code
run: go install -v ./...

Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ GOTEST := GO111MODULE=on go test

GOLIST := go list -deps $(PKG)/... | grep '$(PKG)'
GOLIST_COVER := $$(go list -deps $(PKG)/... | grep '$(PKG)')
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -name "*.pb.go")

RM := rm -f
CP := cp
Expand Down Expand Up @@ -131,6 +131,16 @@ lint: $(LINT_BIN)
@$(call print, "Linting source.")
$(LINT)

#? rpc: Compile protobuf definitions
rpc:
@$(call print, "Compiling protos.")
cd ./rpc; ./gen_protos_docker.sh

#? rpc-check: Make sure protobuf definitions are up to date
rpc-check: rpc
@$(call print, "Verifying protos.")
if test -n "$$(git status --porcelain rpc/walletrpc/)"; then echo "Generated protobuf files are not up-to-date. Please run 'make rpc' and commit the changes."; git status; git diff rpc/walletrpc/; exit 1; fi

#? clean: Clean source
clean:
@$(call print, "Cleaning source.$(NC)")
Expand All @@ -155,6 +165,8 @@ tidy-module-check: tidy-module
fmt \
fmt-check \
lint \
rpc \
rpc-check \
clean

#? help: Get more info on make commands
Expand Down
2 changes: 1 addition & 1 deletion rpc/documentation/serverchanges.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ A `sh` shell script is included to compile the Protocol Buffers descriptor. It
must be run from the `rpc` directory.

```bash
$ sh regen.sh
$ sh gen_protos_docker.sh
```

If a `sh` shell is unavailable, the command can be run manually instead (again
Expand Down
16 changes: 16 additions & 0 deletions rpc/gen_protos_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

# golang docker image version used in this script.
GO_IMAGE=docker.io/library/golang:1.23.12-alpine

# protobuf generator version with legacy plugins=grpc support. Using v1.4.3 to
# maintain backward compatibility - generates single file instead of separate
# .pb.go and _grpc.pb.go files (modern approach).
PROTOC_GEN_GO_VERSION=v1.4.3

docker run --rm --volume "$(pwd):/workspace" --workdir /workspace \
${GO_IMAGE} sh -c "
apk add --no-cache protobuf-dev && \
go install github.com/golang/protobuf/protoc-gen-go@${PROTOC_GEN_GO_VERSION} && \
protoc -I. api.proto --go_out=plugins=grpc:walletrpc && \
chown -R $(id -u):$(id -g) walletrpc"
3 changes: 0 additions & 3 deletions rpc/regen.sh

This file was deleted.

Loading
Loading