Skip to content

fix: add /usr/local/go/ path to is_golang_prog()#84

Open
tedg-dev wants to merge 1 commit into
omnibor:mainfrom
tedg-dev:fix/golang-path-usr-local-go
Open

fix: add /usr/local/go/ path to is_golang_prog()#84
tedg-dev wants to merge 1 commit into
omnibor:mainfrom
tedg-dev:fix/golang-path-usr-local-go

Conversation

@tedg-dev

@tedg-dev tedg-dev commented May 4, 2026

Copy link
Copy Markdown

Summary

Fix is_golang_prog() in scripts/bomsh_hook2.py to 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:

if "lib/go" not in prog or "pkg/tool" not in prog:
    return False

This misses /usr/local/go/pkg/tool/linux_amd64/compile and .../link, causing bomtrace2 to silently ignore all Go compile/link commands on systems using the standard Go installation.

Change

One-line fix — add local/go as an alternative path match:

if ("lib/go" not in prog and "local/go" not in prog) or "pkg/tool" not in prog:
    return False

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:

  • Before fix: is_golang_prog("/usr/local/go/pkg/tool/linux_amd64/compile")False
  • After fix: is_golang_prog("/usr/local/go/pkg/tool/linux_amd64/compile")True
  • Existing paths still work: is_golang_prog("/usr/lib/go-1.21/pkg/tool/linux_amd64/compile")True
  • Non-Go paths still rejected: is_golang_prog("/usr/bin/gcc")False

Successfully ran bomtrace2 Go analysis on multiple Go projects (fzf, lazygit, croc) with the patched bomsh_hook2.py.

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
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.

is_golang_prog() does not match /usr/local/go/ install path

3 participants