mholt/caddy-ratelimit

Cannot build using xcaddy 0.3.1

khanakia opened this issue · 3 comments

Getting Error building with new xcaddy

root@ip:/tmp# xcaddy build --with github.com/mholt/caddy-ratelimit --output ./caddy1
2022/10/03 11:16:04 [INFO] Temporary folder: /tmp/buildenv_2022-10-03-1116.2667582345
2022/10/03 11:16:04 [INFO] Writing main module: /tmp/buildenv_2022-10-03-1116.2667582345/main.go
package main

import (
        caddycmd "github.com/caddyserver/caddy/v2/cmd"

        // plug in Caddy modules here
        _ "github.com/caddyserver/caddy/v2/modules/standard"
        _ "github.com/mholt/caddy-ratelimit"
)

func main() {
        caddycmd.Main()
}
2022/10/03 11:16:04 [INFO] Initializing Go module
2022/10/03 11:16:04 [INFO] exec (timeout=10s): /usr/local/go/bin/go mod init caddy 
go: creating new go.mod: module caddy
go: to add module requirements and sums:
        go mod tidy
2022/10/03 11:16:04 [INFO] Pinning versions
2022/10/03 11:16:04 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2 
go: added github.com/beorn7/perks v1.0.1
go: added github.com/caddyserver/caddy/v2 v2.6.1
go: added github.com/caddyserver/certmagic v0.17.1
go: added github.com/cespare/xxhash/v2 v2.1.2
go: added github.com/fsnotify/fsnotify v1.5.1
go: added github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
go: added github.com/golang/mock v1.6.0
go: added github.com/golang/protobuf v1.5.2
go: added github.com/google/uuid v1.3.0
go: added github.com/klauspost/cpuid/v2 v2.1.0
go: added github.com/libdns/libdns v0.2.1
go: added github.com/lucas-clemente/quic-go v0.28.2-0.20220813150001-9957668d4301
go: added github.com/marten-seemann/qpack v0.2.1
go: added github.com/marten-seemann/qtls-go1-18 v0.1.2
go: added github.com/marten-seemann/qtls-go1-19 v0.1.0
go: added github.com/matttproud/golang_protobuf_extensions v1.0.1
go: added github.com/mholt/acmez v1.0.4
go: added github.com/miekg/dns v1.1.50
go: added github.com/nxadm/tail v1.4.8
go: added github.com/onsi/ginkgo v1.16.4
go: added github.com/prometheus/client_golang v1.12.2
go: added github.com/prometheus/client_model v0.2.0
go: added github.com/prometheus/common v0.32.1
go: added github.com/prometheus/procfs v0.7.3
go: added go.uber.org/atomic v1.9.0
go: added go.uber.org/multierr v1.6.0
go: added go.uber.org/zap v1.21.0
go: added golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa
go: added golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
go: added golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3
go: added golang.org/x/net v0.0.0-20220812165438-1d4ff48094d1
go: added golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10
go: added golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
go: added golang.org/x/text v0.3.8-0.20211004125949-5bd84dd9b33b
go: added golang.org/x/tools v0.1.10
go: added golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: added google.golang.org/protobuf v1.28.0
go: added gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
2022/10/03 11:16:06 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/mholt/caddy-ratelimit github.com/caddyserver/caddy/v2 
go: github.com/mholt/caddy-ratelimit@upgrade (v0.0.0-20220930195153-598f4b82c131) requires github.com/caddyserver/caddy/v2@v2.6.2-0.20220930193937-fe91de67b62c, not github.com/caddyserver/caddy/v2@upgrade (v2.6.1)
2022/10/03 11:16:06 [FATAL] exit status 1

Yeah, it looks like this commit 598f4b8 was pushed too early to use an unreleased version of Caddy.

You have two options to work around this. Either use an older commit of this plugin, or tell xcaddy to use the same commit from Caddy.

xcaddy build --with github.com/mholt/caddy-ratelimit@163fde700dd7
xcaddy build fe91de67b62c --with github.com/mholt/caddy-ratelimit

Thanks

mholt commented

My bad. Totally forgot about that. Will fix soon.