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

cmd/cert_manager and otel: Failed to load package: main module does not contain package #618

Open
dshukla2510 opened this issue Mar 10, 2025 · 1 comment

Comments

@dshukla2510
Copy link

dshukla2510 commented Mar 10, 2025

I added cmd/path for cert-manager(controller, cainjector, and webhook) and otel when creating the json file with command "cyclonedx-gomod app -assert-licenses -json -licenses -output-version 1.4 -output base.json -main cmd/controller/"

It gives error "11:13AM ERR error="failed to load package: main module (github.com/cert-manager/cert-manager) does not contain package github.com/cert-manager/cert-manager/cmd/controller"

But, when I ran it inside "cmd/controller/", it generates files.

Why it is not generating the file with cmd/path?

It should generate the json with this command "cyclonedx-gomod app -assert-licenses -json -licenses -output-version 1.4 -output base.json -main cmd/controller/"

Instead of, "cmd/controller/ && cyclonedx-gomod app -assert-licenses -json -licenses -output-version 1.4 -output base.json -main . "

Image

FYI, It is working with cmd/path with otherpackages though, like ingress-nginx, argo-cd, argo-events, cloudnative-pg. Only not working with otel and cert_manager

@nscuro
Copy link
Member

nscuro commented Mar 10, 2025

Looks like it's working as intended. Refer to cyclonedx-gomod app's help text:

USAGE
  cyclonedx-gomod app [FLAGS...] [MODULE_PATH]

...

The -main flag should be used to specify the path to the application's main package.
It must point to a directory within MODULE_PATH. If not set, MODULE_PATH is assumed.

In your case, because controller is its own separate module, you need to point MODULE_PATH to it, like so:

cyclonedx-gomod app -assert-licenses -json -licenses -output-version 1.4 -output base.json ./cmd/controller

Note how you no longer need to set the -main flag as well.

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

No branches or pull requests

2 participants