Skip to content

Commit 74076ab

Browse files
jimmidysondlipovetsky
authored andcommitted
fixup! test: Return root module root dir when using go.work
Use strings.Cut
1 parent 1c377a3 commit 74076ab

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/handlers/generic/lifecycle/ccm/nutanix/handler_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ func moduleRootDir() string {
209209
out),
210210
)
211211
}
212-
modules := strings.Split(string(out), "\n")
213-
rootModule := strings.TrimSpace(modules[0])
214-
return rootModule
212+
// The first line is the module root directory. When go workspaces are used,
213+
// the first line is the "root" module root directory.
214+
dir, _, _ := strings.Cut(string(out), "\n")
215+
return dir, nil
215216
}

0 commit comments

Comments
 (0)