Skip to content

Commit 6eb27c0

Browse files
authored
setup bufbuild to generate proto (sqlc-dev#1974)
1 parent 9e13aa7 commit 6eb27c0

File tree

6 files changed

+577
-21
lines changed

6 files changed

+577
-21
lines changed

Makefile

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build build-endtoend test test-ci test-examples test-endtoend regen start psql mysqlsh
1+
.PHONY: build build-endtoend test test-ci test-examples test-endtoend regen start psql mysqlsh proto
22

33
build:
44
go build ./...
@@ -44,16 +44,5 @@ psql:
4444
mysqlsh:
4545
mysqlsh --sql --user root --password mysecretpassword --database dinotest 127.0.0.1:3306
4646

47-
# $ protoc --version
48-
# libprotoc 3.19.1
49-
# $ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
50-
# $ go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto
51-
proto: internal/plugin/codegen.pb.go
52-
53-
internal/plugin/codegen.pb.go: protos/plugin/codegen.proto
54-
protoc -I ./protos \
55-
--go_out=. \
56-
--go_opt=module=github.com/kyleconroy/sqlc \
57-
--go-vtproto_out=. \
58-
--go-vtproto_opt=module=github.com/kyleconroy/sqlc,features=marshal+unmarshal+size \
59-
./protos/plugin/codegen.proto
47+
proto:
48+
buf generate

buf.gen.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: v1
2+
managed:
3+
enabled: true
4+
plugins:
5+
- remote: buf.build/protocolbuffers/plugins/go:v1.28.1-1
6+
out: internal
7+
opt: paths=source_relative
8+
- remote: buf.build/planetscale/plugins/vtproto:v0.3.0
9+
out: internal
10+
opt: paths=source_relative

buf.work.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version: v1
2+
directories:
3+
- protos

internal/plugin/codegen.pb.go

+11-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)