fix: add /usr/local/go/ path to is_golang_prog()#84
Open
tedg-dev wants to merge 1 commit into
Open
Conversation
The official Go distribution (go.dev/dl) installs to /usr/local/go/. The existing check only matched /usr/lib/go-* and /usr/lib/golang/, causing bomtrace2 to silently ignore Go compile/link commands on systems using the standard install path. Fixes omnibor#81
yonhan3
approved these changes
May 6, 2026
This file contains hidden or 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
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.
Summary
Fix
is_golang_prog()inscripts/bomsh_hook2.pyto recognize Go compiler/linker binaries installed at/usr/local/go/— the default path from the official Go distribution (https://go.dev/dl/).Fixes #81
Problem
The current check only matches paths containing
lib/go:This misses
/usr/local/go/pkg/tool/linux_amd64/compileand.../link, causing bomtrace2 to silently ignore all Go compile/link commands on systems using the standard Go installation.Change
One-line fix — add
local/goas an alternative path match:Also updated the docstring to include the
/usr/local/go/example path.Testing
Verified with Go 1.22+ installed to
/usr/local/go/inside an Ubuntu 22.04 Docker container:is_golang_prog("/usr/local/go/pkg/tool/linux_amd64/compile")→Falseis_golang_prog("/usr/local/go/pkg/tool/linux_amd64/compile")→Trueis_golang_prog("/usr/lib/go-1.21/pkg/tool/linux_amd64/compile")→Trueis_golang_prog("/usr/bin/gcc")→FalseSuccessfully ran bomtrace2 Go analysis on multiple Go projects (fzf, lazygit, croc) with the patched
bomsh_hook2.py.