caddy: Build error regarding h2quic
When I try to build the server I’m receiving:
package github.com/lucas-clemente/quic-go/h2quic:
cannot find package "github.com/lucas-clemente/quic-go/h2quic"
I noticed there was a recent change on the library renaming the directory from h2quic to http3:
Example here.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 57 (12 by maintainers)
Commits related to this issue
- readme: Update build instructions Fix #2560 — committed to caddyserver/caddy by elcore 5 years ago
- Remove incompatible restic plugin Because of this issue: https://github.com/caddyserver/caddy/issues/2560 — committed to klingtnet/klingt.net by klingtnet 5 years ago
Nothing needs to be done here. Caddy has its vendored version of quic-go, so the current state of the quic-go repository is irrelevant.
I have the same issue when building from source. I don’t see the vendored code in caddy. Could you please re-open this issue?
I’m following the build instructions from the README.md
Frankly, you shouldn’t be relying on
masterfor any kind of stability. That’s effectively the development trunk of this repo. If you want stability you should always be using a tagged release or specific commits. It feels like you’re asking for the Caddy repo to stifle progress in the name of stability in themasterbranch, but that’s unrealistic.I can definitely vouch for @elcore and that he’s doing what he can to help you. He’s not trolling.
We’ve also learned a lot here when it comes to
go getandgo mod. See the issue that @mholt opened on the Go upstream describing some of your complaints: https://github.com/golang/go/issues/31529.go modis still a new tool, and everyone’s just trying to figure out how to use it properly.With all that said, your feedback about this is definitely appreciated, it’s helping uncover edge cases of the build tooling. Thanks for that.
I’ve been playing with modules + Caddy all day to try to understand what is going on.
A few things that are not obvious:
-betarelease, andgotools don’t honor pre-releases unless they’re the only tag. This is buried here in the go tool docs:Because of that design decision,
go get github.com/mholt/caddy/caddypulls down v0.11.5, the latest non-prerelease tag, which is not a module.Because Caddy v0.11.5 is not a module, running
go get -uhas no constraints on which version ofrussross/blackfridayis pulled down, so it gets the latest, which is v2, which is not compatible with Caddy’s current implementation which uses v1. Hence the errorsundefined: blackfriday.HtmlRendereretc.go getwill always pull into a GOPATH:I haven’t yet figured out why everyone saw the errors they described here, but I suspect it has to do with a combination of these things, and lots of hidden magic in the Go tooling:
vendorfolder for the beta releaseGO111MODULEenv variablegit clonewas used firstIn my testing, I’ve seen wildly different, difficult-to-explain behavior when any and all of these variables change the slightest bit.
It’s very sensitive.
However, it appears that starting from scratch, and once we have a stable
1.0release, we can finally test the transition to Go modules… in production! AFTER tagging the stable release. (Edit: Someone suggested to me that usingreplacein go.mod might help.)Sigh.
Hi,
I hope I can help you. Caddy v0.11.5 does not support modules. Because of this, these problems occur.
If you want to build Caddy v0.11.5, you will have to use these instructions. (
GO111MODULESshould be set toauto-export GO111MODULES=auto)go get github.com/mholt/caddygo get github.com/caddyserver/buildscd $GOPATH/src/github.com/mholt/caddy/caddygit checkout tags/v0.11.5go run build.goIf you want to build Caddy v1.0.0-beta1, you will have to use these instructions.
export GO111MODULES=onThis will not be necessary with Go 1.13 (it should be the default)go get github.com/mholt/caddygo get github.com/caddyserver/buildscd $GOPATH/src/github.com/mholt/caddy/caddygo run build.goor
git clone https://github.com/mholt/caddycd caddy/caddygo run build.goGood evening,
I am running into this issue as well. Setting
GO111MODULEtoondoes allow thego getcall to continue, but I then run into the error shown below:Is there something else I should be doing or setting?
Great to hear that from you.
Your reasons are totally valid, it does pull some thirdparty repos over the network.
I was trying to show you, that the build will be successful, if you follow instructions I have provided.
I am very sorry, if you felt like I was trolling you! I was just trying to be helpful, the transition to modules is not as easy as it should have been. I do not expect anything in return, I am using my resources available to help this project and its community.
I even created a simple Docker container as a proof of concept a few minutes ago. https://github.com/elcore/caddy-docker
It is great that you have found a solution that works for you.
I feel much less stupid now.
Disabling modules will not help. You still have to do
git clone, asgo get(even with-d) will fail.😕 The whole point of me writing all that text is to explain the behavior there. It’s pretty easy to grasp if you know the rules of old vendoring and new modules system, however not everyone reads the release notes thoroughly.
That is okay, you can use an older version of Caddy.
It is not broken,
go get github.com/mholt/caddyworksWhat is the issue?
Caddy is go-get-able…
We no longer use vendor, starting with 1.0 beta 1.
Are you in a GOPATH? Try setting
export GO111MODULE=onand try again.Alright, thanks. Closing this then.
Ok, let’s go through what
go getdoes currently withGO111MODULE=off. First of all, it doesn’t crash - that’s good, but it means something have changed since I last lloked into it. Nontheless. It does load extra dependencies from the thirdparty repos, which is undesireable for the following reasons:The worst this is what exactly is being attemped to be downloaded depends on the state of the current
masterbranch of thecaddyrepo. And there was the case of this setup breaking the build, and there’s no evidence that there are any measures taken to prevent that in the future. Speaking of evidence, I don’t think just providing and example of the command running successfully now proves that it’s the right approach. At this point it looks like some kind of trolling from you, @elcore. I know you have something that works for you, but have to try and explain why it works and what are the potential downsides of the solution. For us it still won’t work, as we tried that, and now we know better, and will be using much more strightforward git cloning.Regarding Go 1.12.4 - definetly a good idea. We already got our toolchain updated after we encountered this issue.
This works pretty well, you don’t have to use
git clone, justgit checkoutIn my case the behavior is pretty obvious. Remember, I need an older version of caddy. With modules enabled usual
go getwill pullv0.11.5that hasvendordir, which will, however, be ignored, andgo getwill try to download the dependencies from the respective sources. And those won’t be pinned by the mod file (and not fromvendordir). This obviously fails. The behavior is the same even if I dogo get -d. That’s why I ended up doinggit cloneinstead ofgo get -d, and then the good oldgit checkout <rev-i-want>to enforce proper version. This works like a charm because oldercaddyversion still providesvendordirectory - and everything that’s needed for it to work is actually vendored, as opposed to just version-pinned. Personally I like vendoring more than version pinning, and mostly because it’s much more easier to build some very old app version from just the app git repo. With pinning a lot of external services have to be up and provide old package versions - which is currently problematic for go.By the way, it would be great if somebody notify go team about the issues we encounter here - as this is the very feedback they look on the new mod system.
I am here to help 😄. I wish you a wonderful day.
Hi,
None of the instructions in the thread above are working for me in the current (go 1.12) docker container.
The reason is that
go run build.goin the README doesn’t work, as go modules are not actually git repositories, and are stored in$GOPATH/pkg/mod.Here’s the procedure that is actually working for v1.0.0-beta1, starting from an empty GOPATH:
Not sure what the correct fix is for the documentation @mholt ?
Hi @elcore,
Thank you for the clear instructions, this helped me get it working! Much appreciated.