Skip to content

Commit f383810

Browse files
authored
chore(tool/cmd/migrate): keep go.mod and go.sum (#4082)
We need to keep `go.mod` and `go.sum` for each Go library because generating them from scratch will likely update the dependency, which should be in a separate process. This is similar to what Legacy librarian does. For #3618
1 parent 15f2807 commit f383810

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

tool/cmd/migrate/legacylibrarian.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func buildConfigFromLibrarian(ctx context.Context, input *MigrationInput) (*conf
161161
cfg.Default.ReleaseLevel = "stable"
162162
cfg.Default.Transport = "grpc+rest"
163163
} else {
164-
cfg.Default.Keep = []string{"CHANGES.md"}
164+
cfg.Default.Keep = []string{"CHANGES.md", "go.mod", "go.sum"}
165165
cfg.Default.Output = "."
166166
cfg.Default.ReleaseLevel = "ga"
167167
cfg.Libraries, err = buildGoLibraries(input)

tool/cmd/migrate/legacylibrarian_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func TestBuildConfigFromLibrarian(t *testing.T) {
116116
},
117117
},
118118
Default: &config.Default{
119-
Keep: []string{"CHANGES.md"},
119+
Keep: []string{"CHANGES.md", "go.mod", "go.sum"},
120120
Output: ".",
121121
ReleaseLevel: "ga",
122122
TagFormat: defaultTagFormat,
@@ -235,7 +235,7 @@ func TestBuildConfigFromLibrarian(t *testing.T) {
235235
},
236236
},
237237
Default: &config.Default{
238-
Keep: []string{"CHANGES.md"},
238+
Keep: []string{"CHANGES.md", "go.mod", "go.sum"},
239239
Output: ".",
240240
ReleaseLevel: "ga",
241241
TagFormat: defaultTagFormat,

0 commit comments

Comments
 (0)