Skip to content

Commit cbc14d7

Browse files
committed
scripts: Use go mod instead of go list to get dependencies
Replace `go list -m` with `go mod edit -json`, as the latter can return the same information. This will be helpful when the project migrates to using a Go workspace, as it will return the current module defined in go.mod rather than all the modules from the current directory (using a workspace, the top-level go.mod will return all the child modules from the repository). Signed-off-by: Ivan Valdes <[email protected]>
1 parent ac7d3e9 commit cbc14d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: scripts/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ function bom_pass {
508508

509509
function dump_deps_of_module() {
510510
local module
511-
if ! module=$(run go list -m); then
511+
if ! module=$(run go mod edit -json | jq -r .Module.Path); then
512512
return 255
513513
fi
514514
run go mod edit -json | jq -r '.Require[] | .Path+","+.Version+","+if .Indirect then " (indirect)" else "" end+",'"${module}"'"'

0 commit comments

Comments
 (0)