-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract go module versions from ldflags for binaries built by go #1832
Merged
wagoodman
merged 5 commits into
main
from
extract-go-binary-versions-from-known-build-flags
May 23, 2023
Merged
Extract go module versions from ldflags for binaries built by go #1832
wagoodman
merged 5 commits into
main
from
extract-go-binary-versions-from-known-build-flags
May 23, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Weston Steimel <[email protected]>
…sions-from-known-build-flags Signed-off-by: Alex Goodman <[email protected]>
Signed-off-by: Alex Goodman <[email protected]>
Signed-off-by: Alex Goodman <[email protected]>
Signed-off-by: Alex Goodman <[email protected]>
wagoodman
changed the title
Extract go binary versions from known build flags
Extract go module versions from ldflags for binaries built by go
May 19, 2023
Benchmark Test ResultsBenchmark results from the latest changes vs base branch
|
spiffcs
approved these changes
May 23, 2023
@@ -113,36 +94,6 @@ classifiers/dynamic/helm-3.10.3: | |||
/usr/local/bin/helm \ | |||
$@/helm | |||
|
|||
classifiers/dynamic/kubectl-1.24.11: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice - glad to see all of these specific cases removed in favor of the more generic solution.
This was referenced May 23, 2023
Merged
Closed
spiffcs
added a commit
that referenced
this pull request
Jun 5, 2023
* main: (21 commits) chore(deps): bump github.com/sirupsen/logrus from 1.9.2 to 1.9.3 (#1862) chore(deps): bump modernc.org/sqlite from 1.22.1 to 1.23.0 (#1863) feat: source-version flag (#1859) chore(deps): bump github.com/spf13/viper from 1.15.0 to 1.16.0 (#1851) accept main.version ldflags even without vcs (#1855) feat: add scope to pom properties (#1779) chore(deps): bump github.com/stretchr/testify from 1.8.3 to 1.8.4 (#1852) chore(deps): bump github.com/docker/docker (#1849) Add test to ensure package metadata is represented in the JSON schema (#1841) Fix directory resolver to consider CWD and root path input correctly (#1840) Migrate location-related structs to the file package (#1751) chore(deps): bump github.com/go-git/go-git/v5 from 5.6.1 to 5.7.0 (#1843) fix: add panic recovery for license parse (#1839) chore: return both failures when failed to retrieve an image with a scheme (#1801) Extract go module versions from ldflags for binaries built by go (#1832) fix: duplicate packages, support pnpm lockfile v6 (#1778) chore(deps): update stereoscope to e14bc4437b2eac481c5b6f101890b22df4f33596 (#1834) chore(deps): bump github.com/stretchr/testify from 1.8.2 to 1.8.3 (#1829) chore(deps): bump github.com/docker/docker (#1833) Keep original FileInfo persisted on file.Metadata structs (#1794) ... Signed-off-by: Christopher Phillips <[email protected]>
This was referenced Jun 5, 2023
This was referenced Jun 12, 2023
GijsCalis
pushed a commit
to GijsCalis/syft
that referenced
this pull request
Feb 19, 2024
…hore#1832) * wip Signed-off-by: Weston Steimel <[email protected]> * with golang bin ldflags refactor Signed-off-by: Alex Goodman <[email protected]> * add test for golang binary cataloger for ldflag extraction Signed-off-by: Alex Goodman <[email protected]> * remove binary classfiers that overlap with new go ldflags detection Signed-off-by: Alex Goodman <[email protected]> --------- Signed-off-by: Weston Steimel <[email protected]> Signed-off-by: Alex Goodman <[email protected]> Co-authored-by: Weston Steimel <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR brings @westonsteimel s branch across the finish line -- adding pattern matching against ldflags for the main module package for the go binary cataloger. This allows us to extract from:
a more useful version value:
allowing us to replace the known useless value of
(devel)
for a version withv2.7.1
. 🎉 !There is notable overlap in the binary cataloger, so this PR additionally removes classifiers that are against go binaries that set their versions via the ldflags approach and have been demonstrated to work with the versions that were already captured as binary cataloger tests (these have been added as gobinary cataloger tests now).
There is some room for improvement with this approach... in a future PR we could try more aggressive patterns if the first set of patterns find nothing.
Closes #1785