Plugin authors: here is how you can turn your Caddy plugin into a Go module that relies on the current beta release of Caddy, which should allow builds to succeed.
These instructions are derived from the Go wiki about how to define a module. I recommend giving that a solid read (yes, there is lots to read). These instructions assume Mac or Linux.
-
export GO111MODULE=on
-
From your plugin’s repo directory, run
go mod init
. Since it already exists in VCS, it should be able to infer the import path. -
Pin the beta version of Caddy, otherwise Go will try to use the “latest” (by which it means “latest non-prerelease tag”, which is confusing, but arguably good behavior). Remember that the “latest” version of Caddy does not have module support yet, so run:
go get github.com/mholt/caddy@v1.0.0-beta2
(or whatever the latest beta is at the time). -
Once you are sure that
go test ./...
succeeds, tag that commit with a version and push it. -
Update your plugin on the Caddy website to use that new tag of your plugin. Note that
origin/master
is no longer a valid version to release on the Caddy site; it has to be a branch, commit hash, or tag. We always recommend tags, especially now with Go modules in the loop.
Hopefully the deploy succeeds.
Remember that after the stable 1.0 tag of Caddy, pinning a specific version will not be strictly necessary, in fact, might not be advisable. I am not sure what using an older Caddy version will do to the size of the binary. In the future, letting Go resolve the latest should be just fine…