Skip to content
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

mod failed due to calculating has of non go file #201

Open
rucciva opened this issue Oct 12, 2022 · 8 comments
Open

mod failed due to calculating has of non go file #201

rucciva opened this issue Oct 12, 2022 · 8 comments
Labels
bug Something isn't working triage:needs-reproducer

Comments

@rucciva
Copy link

rucciva commented Oct 12, 2022

Command:

cyclonedx-gomod mod -verbose

Error:

....
1:33AM DBG skipping license detection module=golang.org/x/[email protected] reason="no detector provided"
1:33AM DBG calculating module hash module=golang.org/x/[email protected]
1:33AM DBG converting module to component module=golang.org/x/[email protected]
1:33AM DBG skipping license detection module=golang.org/x/[email protected] reason="no detector provided"
1:33AM DBG calculating module hash module=golang.org/x/[email protected]
1:33AM DBG converting module to component module=golang.org/x/[email protected]
1:33AM DBG skipping license detection module=golang.org/x/[email protected] reason="no detector provided"
1:33AM DBG calculating module hash module=golang.org/x/[email protected]
1:33AM DBG converting module to component module=golang.org/x/[email protected]
1:33AM DBG skipping license detection module=golang.org/x/[email protected] reason="no detector provided"
1:33AM DBG calculating module hash module=golang.org/x/[email protected]
1:33AM DBG converting module to component module=golang.org/x/[email protected]
1:33AM DBG skipping license detection module=golang.org/x/[email protected] reason="no detector provided"
1:33AM DBG calculating module hash module=golang.org/x/[email protected]
1:33AM DBG converting module to component module=google.golang.org/[email protected]
1:33AM DBG skipping license detection module=google.golang.org/[email protected] reason="no detector provided"
1:33AM DBG calculating module hash module=google.golang.org/[email protected]
1:33AM DBG converting module to component module=google.golang.org/[email protected]
1:33AM DBG skipping license detection module=google.golang.org/[email protected] reason="no detector provided"
1:33AM DBG calculating module hash module=google.golang.org/[email protected]
{"level":"error","error":"failed to convert modules: failed to calculate module hash: open /.env.development: no such file or directory","time":"2022-10-12T01:33:05Z"}
@nscuro
Copy link
Member

nscuro commented Nov 3, 2022

Hey @rucciva, thanks for reporting!

And sorry for the long wait. This error is very odd, and I can't reproduce it with any setup so far. Would it be possible to provide a minimal example project that triggers this error?

@rucciva
Copy link
Author

rucciva commented Nov 4, 2022

hi @nscuro , no problem.

Unfortunately the repo is private so i can't share it.

But, i tried running go mod tidy first before running cyclonedx-gomod mod -verbose and its working fine. Attached are the changes on go.mod and go.sum. Maybe it can give some clue?

Screen Shot 2022-11-04 at 08 54 43

Screen Shot 2022-11-04 at 08 55 51

@Aaronzinhoo
Copy link

Aaronzinhoo commented Jan 27, 2023

I am experiencing a similar issue on a private repo as well. I will try your fix @rucciva and see if it works. I can provide the packages I am using if that helps as well @nscuro

@nscuro
Copy link
Member

nscuro commented Jan 27, 2023

@Aaronzinhoo Thanks, if you could provide a minimal Go project that triggers this behavior, that would make reproducing it a lot easier.

@nscuro nscuro added bug Something isn't working triage:needs-reproducer labels Aug 3, 2023
@nluzgin
Copy link

nluzgin commented Feb 9, 2024

Got the same output with -verbose
can i help somehow?

I have a go mod graph out, go.mod and go.sum

@nscuro
Copy link
Member

nscuro commented Feb 9, 2024

@nluzgin The biggest help would be providing a simple reproducer project, or instructions to reproduce it reliably.

@nluzgin
Copy link

nluzgin commented Feb 27, 2024

@nscuro sorry, i'm lost in time

My repo is private too, but i think i found the way to reproduce.

in "wat.zip" impersonal sample of code with .git folder, which seems a problem one:
ERR error="failed to convert modules: failed to calculate module hash: open /.git/FETCH_HEAD: no such file or directory"

wat.zip
gitlab_out.txt

@nluzgin
Copy link

nluzgin commented Feb 27, 2024

Anyway it seems like a some missed check before starting calculate hashes.
As idea:

  1. add .git folder to default "exclude list" (not sure about this)
  2. add an option to exclude some files or folders (or i miss this?)
  3. check file existence before any action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage:needs-reproducer
Projects
None yet
Development

No branches or pull requests

4 participants