Skip to content

Commit

Permalink
Merge pull request #103 from twirphp/twirp-error
Browse files Browse the repository at this point in the history
Only generate global templates when there are services in a namespace
  • Loading branch information
sagikazarmark committed Jan 28, 2022
2 parents 3e654b1 + 7206e44 commit e15d932
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions protoc-gen-twirp_php/internal/gen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ func Generate(plugin *protogen.Plugin, version string) error {
namespaces := map[string]bool{}

for _, file := range plugin.Files {
namespaces[php.Namespace(file)] = true

for _, svc := range file.Services {
// Namespaces are only relevant when there are services defined in them
namespaces[php.Namespace(file)] = true

for _, tpl := range serviceTemplates.Templates() {
fileName := fmt.Sprintf(
"%s/%s%s",
Expand Down

0 comments on commit e15d932

Please sign in to comment.