caddy-dns / desec

deSEC module for Caddy
MIT License
14 stars 3 forks source link

Getting a build error with xcaddy #6

Closed Monviech closed 5 months ago

Monviech commented 5 months ago

Hello :)

My current caddy build:

https://github.com/Monviech/os-caddy-plugin/blob/main/usr/local/bin/README.md#current-build

Error I'm getting:

# github.com/libdns/desec
/root/go/pkg/mod/github.com/libdns/desec@v0.2.3/provider.go:486:14: cannot use int(prio) (value of type int) as uint value in struct literal

How I solve this build error:

On line /root/go/pkg/mod/github.com/libdns/desec@v0.2.3/provider.go:486 I change Priority: int(prio), to Priority: uint(prio),.

Then the build works for me.

znkr commented 5 months ago

libdns at HEAD (pseudoversion 0.2.2--) has a couple of incompatible changes to the latests released version, one of them is a change from int to uint. I think, the issue you're seeing is due to mixing incompatible versions of libdns/libdns (v0.2.2-0.20230227175549-2dc480633939) and libdns/desec (v0.2.3).

I don't know exactly why this is happening, but I am guessing that one of modules depends on a newer libdns version than desec. Since both versions are a v0 version minimal version selection will use the v0.2.2-... version.

The breaking change in v0.2.2-... is a bit problematic, there are ways to solve it but it will either require making the versions compatible again or a public release. For now, I think it's best to work around the issue.

The simplest option would be to remove or downgrade the dependency that introduces the v0.2.2-... dependency to a version that depends on v0.2.1. Alternatively, you can try using a newer libdns/desec: libdns/desec actually supports the newer version at HEAD (in fact, that's the version I implemented first, because I missed the incompatible changes). I think you should be able to replace the libdns/desec version using --with github.com/libdns/desec@main, if that doesn't work the xcaddy documentation has a number of examples for replacement versions that should help working around this issue.

Monviech commented 5 months ago

Thank you for your detailed response. I will try this and report back.

Another regression is that when using the Caddy Download site, the download may never start since of that compile error.

Thank you for your work on this plugin.

znkr commented 5 months ago

Another regression is that when using the Caddy Download site, the download may never start since of that compile error.

Good point. I don't know how to solve it without breaking someone else though. Maybe the solution for now needs to be in the libdns provider that depends on v0.2.2-...?

@mholt, I am sure you're aware of the general problem, but this might still be interesting to factor into a plan for how to roll out the next version of libdns.

Monviech commented 5 months ago

Thanks to your explanation I found the offending combination.

xcaddy build \
  --with github.com/caddyserver/ntlm-transport \
  --with github.com/mholt/caddy-dynamicdns \
  --with github.com/caddy-dns/vultr \
  --with github.com/caddy-dns/desec

So when I omit vultr from my build, I don't get the int/uint errors with all of the providers I had problems with.

Kinda new at this go building with its dependencies, so I was confused about who to talk to about this. I have opened multiple issues with other dns provider plugins here.

And I only need these weird build combination because of the plugin for the OPNsense that I'm maintaining that offers multiple DNS Providers selectable in the GUI.

I will just build without vultr for now and stop offering it. I doubt I have any user anyway. More people use desec so its more important to me.

znkr commented 5 months ago

Can you link the different issues, so that they are not isolated?

BTW: I am using OPNsense myself. Looking forward for caddy support :)

Monviech commented 5 months ago

I'm happy you are using OPNsense, the plugin is already finished and used by many people. You can try it out directly from my repository.

I have created an issue where all the issues are linked together, you can find it in the mentioned issue at the start of this issue.

Thank you again for your time. ^^

znkr commented 5 months ago

I have created an issue where all the issues are linked together, you can find it in the mentioned issue at the start of this issue.

Ahh missed that. Thanks :)