Undefined: quic.EarlySession - when building from source

I imported “github.com/caddyserver/caddy/v2/cmd” to my custom Go project. I want to build Caddy from source with go build. I face a sole error message

github.com/caddyserver/caddy/v2@v2.5.1/listeners.go:187:63: undefined: quic.EarlySession

I found an issue showing same error message. However, it does not seem relevant to my sutuation as it originated from building with caddy-ratelimit plugin, and I don’t use any plugins at the moment.

Please advise how to best tackle this issue?

Did you upgrade any dependencies while setting up your project? The problem occurs when you’re trying to build with a newer version of quic-go than Caddy was written for.

1 Like

I have run go mod tidy for my local project, and it somehow upgraded quic-go to v.0.27.0.

Thank you for the input, it helps a lot.

1 Like

Trouble was using

-compat=1.17

flag with go mod tidy. Allowing both 1.16 and 1.17 compatible versions actually does not unnecessary upgrade anything.

2 Likes