Skip to content

Commit

Permalink
chore: update how we handle mod replacements (#6704)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
codyoss committed Sep 20, 2022
1 parent f1ef6d8 commit 402eb24
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/gapicgen/generator/gapics.go
Expand Up @@ -245,6 +245,7 @@ func (g *GapicGenerator) addModReplaceGenproto(dir string) error {
set -ex
go mod edit -replace "google.golang.org/genproto=$GENPROTO_DIR"
go mod tidy
`)
c.Dir = dir
c.Env = []string{
Expand All @@ -262,7 +263,8 @@ func (g *GapicGenerator) dropModReplaceGenproto(dir string) error {
c := execv.Command("bash", "-c", `
set -ex
go mod edit -dropreplace "google.golang.org/genproto"
git restore go.mod
git restore go.sum
`)
c.Dir = dir
c.Env = []string{
Expand Down

0 comments on commit 402eb24

Please sign in to comment.