-
Notifications
You must be signed in to change notification settings - Fork 602
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
Cant use syft with go mod vendor because invalid case of microsoft module #2026
Comments
👋 Barnuri where do you see I just checked the libraries go.mod file and found: Is there another place this could be pulled from that's causing the uppercase to matter? |
I don't think I understand the nature of the failure. That is, when I run the given steps:
I have a grype build that works:
@barnuri what's the failure you expected here? |
its happening when trying to do go mod vendor inside docker
|
Even in docker we were still not able to reproduce the issue. FROM golang:1.20
WORKDIR /app
COPY . .
RUN go mod tidy
RUN go mod vendor
RUN go build -mod vendor -o /tmp/grype ./cmd/grype $ docker build -t localhost/grype:latest -f Dockerfile .
[+] Building 185.7s (11/11) FINISHED
=> [internal] load build definition from Dockerfile.test 0.0s
=> => transferring dockerfile: 226B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 83B 0.0s
=> [internal] load metadata for docker.io/library/golang:1.20 0.0s
=> CACHED [1/6] FROM docker.io/library/golang:1.20 0.0s
=> [internal] load build context 0.4s
=> => transferring context: 446.73kB 0.4s
=> [2/6] WORKDIR /app 0.0s
=> [3/6] COPY . . 1.8s
=> [4/6] RUN go mod tidy 59.8s
=> [5/6] RUN go mod vendor 11.3s
=> [6/6] RUN go build -mod vendor -o /tmp/grype ./cmd/grype 84.3s
=> exporting to image 27.9s
=> => exporting layers 27.9s
=> => writing image sha256:a78fe18e8a1972e6e8703418a7f09f31d054ddec7e8ba751c0ebbb8d0 0.0s
=> => naming to localhost/grype:latest 0.0s I tried this in grype, but take note of the go mod why output: $ go mod why github.com/microsoft/go-rustaudit
# github.com/microsoft/go-rustaudit
github.com/anchore/grype/grype
github.com/anchore/syft/syft/pkg/cataloger
github.com/anchore/syft/syft/pkg/cataloger/rust
github.com/microsoft/go-rustaudit
$ go mod why github.com/Microsoft/go-rustaudit
# github.com/Microsoft/go-rustaudit
(main module does not need package github.com/Microsoft/go-rustaudit) Note that the only consumer of this go-rustaudit module is syft, which we know references this module via the lowercase variant. Do you have multiple dependencies that use this module in your application? If so I would check the import statements for these dependent libs as they might be using the uppercase variant. Also, are you blocked by this PR not making it in? If so you can put the replace line in you application's go.mod to unblock your work. We don't want to merge this fix since we don't have a good understanding as to why |
Closing this as will not fix for now - if there is more to add after the above please let us know and we can reconsider opening with any additional comments - thanks! |
Seeing the same issue for buildkit-syft-scanner that depends on several Microsoft libraries. GoLang appears to treat mods as case-insensitive and syft causes issues due to use of lowercase "microsoft" |
What happened:
in code you used github.com/microsoft/go-rustaudit instead of github.com/Microsoft/go-rustaudit
What you expected to happen:
to use github.com/Microsoft/go-rustaudit
Steps to reproduce the issue:
install syft as dependency of another go project
run
go mod tidy
go mod vendor
go build -mod vendor
Anything else we need to know?:
Environment:
syft version
:cat /etc/os-release
or similar):The text was updated successfully, but these errors were encountered: