-
Couldn't load subscription status.
- Fork 727
Open
Labels
bugSomething isn't workingSomething isn't workingecosystem:gorelating to the golang ecosystemrelating to the golang ecosystemgood-first-issueGood for newcomersGood for newcomers
Description
What happened:
It does not apply replace directive to the module version that's also in the replace directly. For example,
replace (
google.golang.org/grpc => google.golang.org/grpc v1.61.0
golang.org/x/net => golang.org/x/net v0.22.0
)
If I run syft with the working dir syft ., the result will show golang.org/x/[email protected] is being used, which is originated from [email protected]'s go.mod while both module should be overridden to the specified version.
What you expected to happen:
If I build and run syft against the binary file instead, syft <bin_file>, or go version -m <bin_file>, both will show golang.org/x/[email protected] is actually being used.
Steps to reproduce the issue:
- Create a simple project
- Import a module, let's name it module M
- Use
replacedirective with M to any specific version - Use
replacedirective with another module required by M (pick one from M's go.mod), let's name it module N cdto the project root directory, set$GOPATHwithexport GOPATH="$(pwd)/depgo mod download, to download all dependencies into./dep.- Run
syftwith the project directory, inspect the N's version, it will be the version specified in M's go.mod, while it should actually be thereplacedirective version.
Environment:
- Output of
syft version:
Application: syft
Version: 1.0.1
BuildDate: 2024-03-06T19:25:56Z
GitCommit: Homebrew
GitDescription: [not provided]
Platform: darwin/arm64
GoVersion: go1.22.1
Compiler: gc
- OS (e.g:
cat /etc/os-releaseor similar):
ProductName: macOS
ProductVersion: 14.3.1
BuildVersion: 23D60
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingecosystem:gorelating to the golang ecosystemrelating to the golang ecosystemgood-first-issueGood for newcomersGood for newcomers
Type
Projects
Status
Ready