Skip to content

Commit b55398b

Browse files
committed
Handle workspaces
1 parent 77f5bc6 commit b55398b

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

provider-ci/internal/pkg/migrations/consolidate_modules.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ func (consolidateModules) Migrate(_, outDir string) error {
5151
if _, err := run("git", "mv", "-f", "provider/go.sum", "go.sum"); err != nil {
5252
return fmt.Errorf("moving provider/go.sum: %w", err)
5353
}
54+
// Update our workspace, if it exists. It's OK if these fail.
55+
_, _ = run("go", "work", "edit", "-dropuse=./provider")
56+
_, _ = run("go", "work", "edit", "-use=./")
5457

5558
// Load the module as JSON.
5659
out, err := run("go", "mod", "edit", "-json", "go.mod")
@@ -91,6 +94,8 @@ func (consolidateModules) Migrate(_, outDir string) error {
9194
_, _ = run("git", "rm", "examples/go.sum")
9295
_, _ = run("git", "rm", "tests/go.mod")
9396
_, _ = run("git", "rm", "tests/go.sum")
97+
_, _ = run("go", "work", "edit", "-dropuse=./examples")
98+
_, _ = run("go", "work", "edit", "-dropuse=./tests")
9499

95100
// Rewrite our module path and determine our new import, if it's changed.
96101
//

provider-ci/internal/pkg/migrations/migrations_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func assertDirectoryContains(t *testing.T, dir1, dir2 string) {
6363
}
6464

6565
stat, err := os.Stat(filepath.Join(dir1, entry.Name()))
66-
assert.NoError(t, err)
66+
require.NoError(t, err)
6767
assert.Equal(t, entry.IsDir(), stat.IsDir())
6868

6969
subPath1 := filepath.Join(dir1, entry.Name())
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
go 1.23.3
2+
3+
use (
4+
./examples
5+
./provider
6+
./tests
7+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
go 1.23.3
2+
3+
use ./

0 commit comments

Comments
 (0)