Skip to content

go list -m all doesn't work with vendor directory present #189

@der-eismann

Description

@der-eismann

Hello, when trying to run the microsoft/sbom-tool with a Go project I get the following error:

[INFO] Go CLI was found in system and will be used to generate dependency graph. Detection time may be improved by activating fallback strategy (https://github.com/microsoft/component-detection/blob/main/docs/detectors/go.md#fallback-detection-strategy). But, it will introduce noise into the detected components. 
[ERROR] Go CLI command "go list -m -json all" failed with error:
 go: can't compute 'all' using the vendor directory
	(Use -mod=mod or -mod=readonly to bypass.)
 
[ERROR] Go CLI could not get dependency build list at location: /home/sysop/project/go.mod. Fallback go.sum/go.mod parsing will be used. 
[INFO] Go CLI was found in system and will be used to generate dependency graph. Detection time may be improved by activating fallback strategy (https://github.com/microsoft/component-detection/blob/main/docs/detectors/go.md#fallback-detection-strategy). But, it will introduce noise into the detected components. 
[ERROR] Go CLI command "go list -m -json all" failed with error:
 go: can't compute 'all' using the vendor directory
	(Use -mod=mod or -mod=readonly to bypass.)
 
[ERROR] Go CLI could not get dependency build list at location: /home/sysop/project/go.sum. Fallback go.sum/go.mod parsing will be used.

I'm using go 1.18.3 on my system, removing the vendor directory before the component-detection seems a bit annoying to me. Would it be possible to add the -mod=readonly in some circumstances?

Metadata

Metadata

Assignees

Labels

detector:goThe Go detectorstatus:in-progressSomeone is working on implementationtype:bugBug fix of existing functionality

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions