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

Unable to build with xcaddy and docker - Downgrade required Go version to 1.21 #3

Closed
taophp opened this issue Mar 20, 2024 · 6 comments

Comments

@taophp
Copy link

taophp commented Mar 20, 2024

Please, have a look to caddyserver/caddy-docker#333 and @francislavoie's comment.

I tried to build Caddy with xcaddy using a Dockerfile. It failed due to xtemplate that requires Go version 1.22.1. xcaddy-builder container currently runs with Go 1.21.

You should downgrade this requirement, at least until Caddy 2.8.0 is released.

@infogulch
Copy link
Owner

Thanks for identifying this. It's a bit silly that a caddy module is unable to build with caddy 🤦. This repo will need some CI checks to prevent such a regression in the future.

I could downgrade, but I'm pretty sure xtemplate is already using the for loop variable declaration language change in a few places. This isn't a big deal, but will require me to review loops carefully.

@taophp
Copy link
Author

taophp commented Mar 20, 2024

Thanks for identifying this.

You're welcome.

FYI, I was able to build xtemplate with upgraded xcaddy on my cloned repo. I can go on testing xtemplate (well, currently, I'm focused on Caddy Security, xtemplate will be my next step). So, from my POV, it's up to you to fix this issue or to wait for Caddy 2.8.0 (within a month wrote Francis).

@infogulch
Copy link
Owner

I remembered why Go 1.22 is actually required: xtemplate now uses the builtin http.ServeMux added in Go 1.22 1, instead of my own library that does basically the same thing. Both mine and the stdlib's implementations were adapted from julienschmidt/httprouter which is known for being very fast and providing additional features like routing based on the http method and capturing path parameters. xtemplate uses these patterns directly as the names of templates.

I moved to this because I'd rather use the stdlib if it supports the required features instead of maintaining my own library, so I won't be downgrading xtemplate to Go 1.21.

Unfortunately this is a problem for xtemplate-caddy until Caddy releases 2.8, which I didn't realize until you opened this issue. We can keep this issue open until that happens.

Footnotes

  1. https://tip.golang.org/doc/go1.22#enhanced_routing_patterns

@infogulch
Copy link
Owner

I updated the readme to include a method of building with xcaddy that references a caddy commit that seems to be working, as well as a go module-based way to build that also works.

This should tide us over until caddy releases the next version.

@taophp
Copy link
Author

taophp commented May 29, 2024

As Caddy 2.8 is now out, I think this is not an issue anymore.

@taophp taophp closed this as completed May 29, 2024
@francislavoie
Copy link

I haven't done the Docker release for 2.8.0 yet, but yeah.

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

3 participants