Can't claim package

Hey guys, I tried to claim my package Coraza-waf (now without CGO) but I’m getting the following error:

Sorry, something went wrong:

**unable to scan modules in package github.com/jptosso/coraza-caddy**

Please include this error ID if reporting:
4e5ebe7a-5a22-401b-af6b-b8acfaa15ca2

Hope you can help me
Thank you!

Apparently your package still uses cgo, here’s a snippet of some of the errors:

Aug 23 21:14:37 portal caddy[198276]: # github.com/jptosso/coraza-waf/utils/libinjection
Aug 23 21:14:37 portal caddy[198276]: /var/lib/caddy/go/pkg/mod/github.com/jptosso/coraza-waf@v1.0.0-beta.5/utils/libinjection/libinjection_cgo.go:21:10: fatal error: libinjection.h: No such file or directory
Aug 23 21:14:37 portal caddy[198276]:    21 | #include "libinjection.h"
Aug 23 21:14:37 portal caddy[198276]:       |          ^~~~~~~~~~~~~~~~
Aug 23 21:14:37 portal caddy[198276]: compilation terminated.
Aug 23 21:14:37 portal caddy[198276]: # github.com/jptosso/coraza-waf/utils/regex
Aug 23 21:14:37 portal caddy[198276]: /var/lib/caddy/go/pkg/mod/github.com/jptosso/coraza-waf@v1.0.0-beta.5/utils/regex/regex_pcre.go:60:10: fatal error: pcre.h: No such file or directory
Aug 23 21:14:37 portal caddy[198276]:    60 | #include <pcre.h>
Aug 23 21:14:37 portal caddy[198276]:       |          ^~~~~~~~
Aug 23 21:14:37 portal caddy[198276]: compilation terminated.

Coraza uses // +build cgo to determine whether to use libinjection_cgo.go or libinjection_go.go, is it possible that the caddy plug-in builder is using CGO_ENABLED=1 ? Otherwise it should not import cgo and it’s fully covered by tests

The cgo tool is enabled by default for native builds on systems where it is expected to work. It is disabled by default when cross-compiling. You can control this by setting the CGO_ENABLED environment variable when running the go tool: set it to 1 to enable the use of cgo, and to 0 to disable it.

The build server does not explicitly turn it off, so it is on by default for builds of the same arch as the machine it’s building on.

Frankly I think this is correct, so that it makes sure the dependencies are actually pure Go, because those defaults also apply to other users who may try to make builds of Caddy themselves.

So do you think, turning off CGO for the builder is an option?
Otherwise I would have to create a fork without CGO support at all.
I hope next year there will be a non CGO version but libpcre is way too important right now and it can’t be replaced with RE2.

This topic was automatically closed after 30 days. New replies are no longer allowed.