Skip to content

Commit 402eb24

Browse files
authored
chore: update how we handle mod replacements (#6704)
- Add a tidy after replace. The genproto dependency is getting more complex as it now associates with many aliases. A tidy is now requried. - Since we are tidying we can no longer just simply drop the replace as there would have been dependency updates because of the tidy. Instead we can achive the same effect by using git restore.
1 parent f1ef6d8 commit 402eb24

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/gapicgen/generator/gapics.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ func (g *GapicGenerator) addModReplaceGenproto(dir string) error {
245245
set -ex
246246
247247
go mod edit -replace "google.golang.org/genproto=$GENPROTO_DIR"
248+
go mod tidy
248249
`)
249250
c.Dir = dir
250251
c.Env = []string{
@@ -262,7 +263,8 @@ func (g *GapicGenerator) dropModReplaceGenproto(dir string) error {
262263
c := execv.Command("bash", "-c", `
263264
set -ex
264265
265-
go mod edit -dropreplace "google.golang.org/genproto"
266+
git restore go.mod
267+
git restore go.sum
266268
`)
267269
c.Dir = dir
268270
c.Env = []string{

0 commit comments

Comments
 (0)