Skip to content

Commit

Permalink
Prevent infinite loop on package name collision
Browse files Browse the repository at this point in the history
Fixes #17.  Based on suggestion by Seongjin Cho (@w4-sjcho).
  • Loading branch information
yugui committed Jun 1, 2015
1 parent 319c1bb commit f748a47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion protoc-gen-grpc-gateway/gengateway/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func New(reg *descriptor.Registry) *generator {
if err := reg.ReserveGoPackageAlias(pkg.Name, pkg.Path); err != nil {
for i := 0; ; i++ {
alias := fmt.Sprintf("%s_%d", pkg.Name, i)
if err := reg.ReserveGoPackageAlias(pkg.Name, pkg.Path); err != nil {
if err := reg.ReserveGoPackageAlias(alias, pkg.Path); err != nil {
continue
}
pkg.Alias = alias
Expand Down

0 comments on commit f748a47

Please sign in to comment.