Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: use bufbuild to generate proto #1974

Merged
merged 1 commit into from
Dec 2, 2022
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
17 changes: 3 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: build build-endtoend test test-ci test-examples test-endtoend regen start psql mysqlsh
.PHONY: build build-endtoend test test-ci test-examples test-endtoend regen start psql mysqlsh proto

build:
go build ./...
Expand Down Expand Up @@ -44,16 +44,5 @@ psql:
mysqlsh:
mysqlsh --sql --user root --password mysecretpassword --database dinotest 127.0.0.1:3306

# $ protoc --version
# libprotoc 3.19.1
# $ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
# $ go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto
proto: internal/plugin/codegen.pb.go

internal/plugin/codegen.pb.go: protos/plugin/codegen.proto
protoc -I ./protos \
--go_out=. \
--go_opt=module=github.com/kyleconroy/sqlc \
--go-vtproto_out=. \
--go-vtproto_opt=module=github.com/kyleconroy/sqlc,features=marshal+unmarshal+size \
./protos/plugin/codegen.proto
proto:
buf generate
10 changes: 10 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: v1
managed:
enabled: true
plugins:
- remote: buf.build/protocolbuffers/plugins/go:v1.28.1-1
out: internal
opt: paths=source_relative
- remote: buf.build/planetscale/plugins/vtproto:v0.3.0
out: internal
opt: paths=source_relative
3 changes: 3 additions & 0 deletions buf.work.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version: v1
directories:
- protos
17 changes: 11 additions & 6 deletions internal/plugin/codegen.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading