From cbc14d78e617661ad671ee8b8852cc4376385840 Mon Sep 17 00:00:00 2001 From: Ivan Valdes Date: Fri, 14 Feb 2025 15:37:42 -0800 Subject: [PATCH] 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 --- scripts/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test.sh b/scripts/test.sh index b7932bbad17..e7176dfce25 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -508,7 +508,7 @@ function bom_pass { function dump_deps_of_module() { local module - if ! module=$(run go list -m); then + if ! module=$(run go mod edit -json | jq -r .Module.Path); then return 255 fi run go mod edit -json | jq -r '.Require[] | .Path+","+.Version+","+if .Indirect then " (indirect)" else "" end+",'"${module}"'"'