Skip to content

Commit 132fb43

Browse files
authored
fix: explicitly override the import paths for iam and longrunning (#1257)
1 parent da633b7 commit 132fb43

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

internal/gengapic/generator.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,21 @@ func (g *generator) commit(fileName, pkgName string) int {
204204
fmt.Fprintf(&header, "package %s\n\n", pkgName)
205205

206206
var imps []pbinfo.ImportSpec
207+
dupCheck := map[string]bool{}
207208
for imp := range g.imports {
208209
// TODO(codyoss): This if can be removed once the public protos
209210
// have been migrated to their new package. This should be soon after this
210211
// code is merged.
211-
if imp.Path == "google.golang.org/genproto/googleapis/longrunning" ||
212-
imp.Path == "google.golang.org/genproto/googleapis/iam/v1" {
213-
continue
212+
if imp.Path == "google.golang.org/genproto/googleapis/longrunning" {
213+
imp.Path = "cloud.google.com/go/longrunning/autogen/longrunningpb"
214+
}
215+
if imp.Path == "google.golang.org/genproto/googleapis/iam/v1" {
216+
imp.Path = "cloud.google.com/go/iam/apiv1/iampb"
217+
}
218+
if exists := dupCheck[imp.Path]; !exists {
219+
dupCheck[imp.Path] = true
220+
imps = append(imps, imp)
214221
}
215-
imps = append(imps, imp)
216222
}
217223
impDiv := sortImports(imps)
218224

0 commit comments

Comments
 (0)