What was your exact import path? (Discourse replaced whatever you typed with a link preview.) If it’s a URL, remember that Go modules don’t have schemes (they are not URLs). So no https:// prefix… try that.
Thanks for the reply – Not sure why my original post got mangled but I did remove the scheme prefix from the github URL when submitting the module that produced the above errror: github.com/pberkel/caddy-tls-permission-policy
This New() constructor is a pattern I’ve used in other Caddy modules I’ve developed previously to specify default values before Caddyfile options have been parsed and populated into the module struct, for example:
It’s useful for initialising default configuration values for the module – admittedly the current version of this module setting default values to zero / false is superfluous but future options planned may require non-zero default values.
Both github.com/pberkel/caddy-storage-redis and github.com/pberkel/caddy-redir-dns modules implement this New() constructor pattern and had no issues being parsed and accepted into the module repository, is there a specific error that is being triggered by the code in github.com/pberkel/caddy-tls-permission-policy that I need to fix?
I have updated the code in CaddyModule() to remove the New() pattern but I’m still getting an error when trying to submit the module to the registry:
Sorry, something went wrong:
unable to scan modules in package github.com/pberkel/caddy-tls-permission-policy
Please include this error ID if reporting:
46134c87-26b9-4ecb-b0c4-af33538b5092
I did create a few point releases to try to debug this issue, but without actually knowing the specific error encountered by the module scanner, it’s very difficult to debug.
Not sure if it will cause more issues, but I’ve removed all releases from the repo (I really don’t want to create a dozen different point releases just to debug this issue)
and tried to submit the module setting version to the latest commit in the main branch “f2f57d7c72e0f2bc7b6025a9827fa6110dcf3a93” but it’s still failing:
Sorry, something went wrong:
**unable to scan modules in package github.com/pberkel/caddy-tls-permission-policy**
Please include this error ID if reporting:
63e8141e-adb2-4072-86f3-77a32e1aa364
Is there any way to determine the specific underlying error so I can fix before tagging a release?
Note that you can’t reuse/repeat tags. Go’s module system won’t allow it, for security reasons. Also, tags != releases; you can make releases without tags, and vice-versa. Go’s module proxy will choose the latest tag by default, so you don’t have to release them if you’re not ready for a release. You also don’t have to use any tags, and Go will just choose the latest commit.
When you go to claim your package, you can specify a version to use. this can be any git ref, like a branch name, commit SHA, or tag.
I would fiddle with both creating a new tag that you haven’t used yet, and inputting a specific version into the “Version” textbox in the “Claim Package” form.
Thanks for the insight Matt – I’ve created a new unused tag v1.0.3 and tried to claim my package my specifying that tag in the form but ultimately receive a similar error message:
Sorry, something went wrong:
unable to scan modules in package github.com/pberkel/caddy-tls-permission-policy
Please include this error ID if reporting:
9fba5bd4-1fce-4ca0-a2f2-dd7cb7c01c6c
Is it possibly to get some insight into the errors triggering this so I can rectify on my end?
Thanks, now it’s downloading v1.0.3, but it still shows the same error:
unexpected argument to RegisterModule(): &ast.UnaryExpr{OpPos:35513337, Op:17, X:(*ast.CompositeLit)(0xc048a60e00)} - expect either composite literal or new()
Ahhhhh, looking closely this is actually a less common thing, I think the complaint is on this line:
caddy.RegisterModule(&PermissionByPolicy{})
Try removing & or using new() there instead.
Sorry, this was me being in a hurry when I replied.