Skip to content

Commit

Permalink
fix: add import for error only proto
Browse files Browse the repository at this point in the history
  • Loading branch information
qazwsxedckll committed Mar 8, 2024
1 parent 1426311 commit f9650ee
Show file tree
Hide file tree
Showing 17 changed files with 442 additions and 437 deletions.
8 changes: 4 additions & 4 deletions protobuf/protoc-gen-go-grain/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.PHONY: testdata
testdata:
protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. testdata/hello/*.proto
protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. testdata/reenter/*.proto
protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. testdata/multi-services/*.proto
protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. testdata/error/*.proto
protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. test/hello/*.proto
protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. test/reenter/*.proto
protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. test/multi-services/*.proto
protoc --go_out=. --go_opt=paths=source_relative --plugin=protoc-gen-go-grain=protoc-gen-go-grain.sh --go-grain_out=. --go-grain_opt=paths=source_relative -I../../ -I. test/error/*.proto

.PHONY: options
options:
Expand Down
5 changes: 3 additions & 2 deletions protobuf/protoc-gen-go-grain/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ func generateHeader(gen *protogen.Plugin, g *protogen.GeneratedFile, file *proto
func generateContent(g *protogen.GeneratedFile, file *protogen.File) {
g.P("package ", file.GoPackageName)

g.QualifiedGoIdent(clusterPackage.Ident(""))
g.QualifiedGoIdent(fmtPackage.Ident(""))

for _, enum := range file.Enums {
if enum.Desc.Name() == "ErrorReason" {
generateErrorReasons(g, enum)
Expand All @@ -75,9 +78,7 @@ func generateContent(g *protogen.GeneratedFile, file *protogen.File) {
}

g.QualifiedGoIdent(actorPackage.Ident(""))
g.QualifiedGoIdent(clusterPackage.Ident(""))
g.QualifiedGoIdent(protoPackage.Ident(""))
g.QualifiedGoIdent(fmtPackage.Ident(""))
g.QualifiedGoIdent(timePackage.Ident(""))
g.QualifiedGoIdent(slogPackage.Ident(""))

Expand Down
132 changes: 132 additions & 0 deletions protobuf/protoc-gen-go-grain/test/error/error.pb.go

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

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

157 changes: 157 additions & 0 deletions protobuf/protoc-gen-go-grain/test/hello/hello.pb.go

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

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

Loading

0 comments on commit f9650ee

Please sign in to comment.