Skip to content

Revert "drop -m flag" to fix empty SBOM generation in v0.18.0#1514

Merged
imjasonh merged 2 commits intoko-build:mainfrom
0xiso:main
May 16, 2025
Merged

Revert "drop -m flag" to fix empty SBOM generation in v0.18.0#1514
imjasonh merged 2 commits intoko-build:mainfrom
0xiso:main

Conversation

@0xiso
Copy link
Contributor

@0xiso 0xiso commented May 16, 2025

This reverts commit 3f2f5a5.

Since ko v0.18.0, mostly empty SBOMs have been generated. While investigating the cause of this, I noticed that the -m flag was removed from go version -m by commit 3f2f5a5. If the -m flag is not specified, module versions are not outputted, resulting in the generation of SBOMs that do not include module information.

$ go help version
usage: go version [-m] [-v] [file ...]
[...]
The -m flag causes go version to print each file's embedded
module version information, when available. In the output, the module
information consists of multiple lines following the version line, each
indented by a leading tab character.

This PR resolves this issue by reverting the commit that removed the -m flag. As far as I tested, the output of go version -m did not differ between Go 1.23 and Go 1.24.0.

This reverts commit 3f2f5a5.
@0xiso 0xiso changed the title Revert "drop -m flag" Revert "drop -m flag" to fix empty SBOM generation in v0.18.0 May 16, 2025
imjasonh
imjasonh previously approved these changes May 16, 2025
Copy link
Member

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@0xiso
Copy link
Contributor Author

0xiso commented May 16, 2025

Oh, when an invalid non-Go binary file is passed to go version -m, Go 1.23 returns a 0 exit code, but Go 1.24 returns 1, which is causing tests to fail. This seems to be an issue with the tests themselves, so the test code will likely need to be fixed.

@0xiso 0xiso requested a review from imjasonh May 16, 2025 18:10
@imjasonh imjasonh enabled auto-merge (rebase) May 16, 2025 19:18
@imjasonh imjasonh merged commit 57cc763 into ko-build:main May 16, 2025
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants