Closed gfvh closed 3 months ago
Needs to be the full module path: github.com/caddyserver/replace-response
Also, it fails on github.com/mitchellh/osext
, which is private. I don't see github.com/mitchellh/osext
in the deps of replace-response
nor in Caddy. There are other modules in your command. It might have to do with https://github.com/mitchellh/osext being a private repo now, for which GitHub requires authentication and the Go command asking for the proper config for that.
Here is how i did try now:
xcaddy build --with github.com/caddyserver/replace-response
2024/07/12 19:18:54 [INFO] Initializing Go module
2024/07/12 19:18:54 [INFO] exec (timeout=0s): /usr/bin/go mod init caddy
go: creating new go.mod: module caddy
2024/07/12 19:18:54 [INFO] Pinning versions
2024/07/12 19:18:54 [INFO] exec (timeout=0s): /usr/bin/go get -d -v github.com/caddyserver/caddy/v2
go: finding github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f
go: github.com/mitchellh/osext@v0.0.0-20151018003038-5e2d6d41470f: git fetch -f https://github.com/mitchellh/osext refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /root/go/pkg/mod/cache/vcs/49dab62ca2a62ee258e74313908bf5f65445f26e5e920f6219c1a0d47ec30abe: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
go: error loading module requirements
2024/07/12 19:18:58 [FATAL] exit status 1
perhaps you can try your self as well and see why is osext as required module?
It works fine for me:
~ $ xcaddy build --with github.com/caddyserver/replace-response
2024/07/12 22:29:07 [INFO] absolute output file path: /Users/mohammed/caddy
2024/07/12 22:29:07 [INFO] Temporary folder: /Users/mohammed/buildenv_2024-07-12-2229.3196199093
2024/07/12 22:29:07 [INFO] Writing main module: /Users/mohammed/buildenv_2024-07-12-2229.3196199093/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/caddyserver/replace-response"
)
func main() {
caddycmd.Main()
}
2024/07/12 22:29:07 [INFO] Initializing Go module
2024/07/12 22:29:07 [INFO] exec (timeout=0s): /usr/local/bin/go mod init caddy
go: creating new go.mod: module caddy
go: to add module requirements and sums:
go mod tidy
2024/07/12 22:29:07 [INFO] Pinning versions
2024/07/12 22:29:07 [INFO] exec (timeout=0s): /usr/local/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.8.4
go: added github.com/caddyserver/certmagic v0.21.3
go: added github.com/caddyserver/zerossl v0.1.3
go: added github.com/cespare/xxhash/v2 v2.2.0
go: added github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572
go: added github.com/google/pprof v0.0.0-20231212022811-ec68065c825e
go: added github.com/google/uuid v1.6.0
go: added github.com/klauspost/cpuid/v2 v2.2.7
go: added github.com/libdns/libdns v0.2.2
go: added github.com/mholt/acmez/v2 v2.0.1
go: added github.com/miekg/dns v1.1.59
go: added github.com/onsi/ginkgo/v2 v2.13.2
go: added github.com/prometheus/client_golang v1.19.1
go: added github.com/prometheus/client_model v0.5.0
go: added github.com/prometheus/common v0.48.0
go: added github.com/prometheus/procfs v0.12.0
go: added github.com/quic-go/qpack v0.4.0
go: added github.com/quic-go/quic-go v0.44.0
go: added github.com/zeebo/blake3 v0.2.3
go: added go.uber.org/mock v0.4.0
go: added go.uber.org/multierr v1.11.0
go: added go.uber.org/zap v1.27.0
go: added go.uber.org/zap/exp v0.2.0
go: added golang.org/x/crypto v0.23.0
go: added golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
go: added golang.org/x/mod v0.17.0
go: added golang.org/x/net v0.25.0
go: added golang.org/x/sync v0.7.0
go: added golang.org/x/sys v0.20.0
go: added golang.org/x/term v0.20.0
go: added golang.org/x/text v0.15.0
go: added golang.org/x/time v0.5.0
go: added golang.org/x/tools v0.21.0
go: added google.golang.org/protobuf v1.34.1
2024/07/12 22:29:14 [INFO] exec (timeout=0s): /usr/local/bin/go get -d -v github.com/caddyserver/replace-response github.com/caddyserver/caddy/v2
go: downloading github.com/caddyserver/replace-response v0.0.0-20240710174758-f92bc7d0c29d
go: added github.com/caddyserver/replace-response v0.0.0-20240710174758-f92bc7d0c29d
go: added github.com/icholy/replace v0.6.0
2024/07/12 22:29:41 [INFO] exec (timeout=0s): /usr/local/bin/go get -d -v
2024/07/12 22:29:57 [INFO] Build environment ready
2024/07/12 22:29:57 [INFO] Building Caddy
2024/07/12 22:29:57 [INFO] exec (timeout=0s): /usr/local/bin/go mod tidy -e
2024/07/12 22:29:57 [INFO] exec (timeout=0s): /usr/local/bin/go build -o /Users/mohammed/caddy -ldflags -w -s -trimpath -tags nobadger
2024/07/12 22:30:05 [INFO] Build complete: ./caddy
2024/07/12 22:30:05 [INFO] Cleaning up temporary folder: /Users/mohammed/buildenv_2024-07-12-2229.3196199093
././caddy version
v2.8.4 h1:q3pe0wpBj1OcHFZ3n/1nl4V4bxBrYoSoab7rL9BMYNk=
What's your Go version? Are you already inside another module's directory?
mine goes for looking so many modules.. it several gigabytes later and wont build. tried with different user as well to be sure i don't have dep file anywhere.
go version go1.12.2 gccgo (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 linux/amd64
go version go1.12.2
There's your issue. Go1.12 is 5 years old. Update your Go version.
with never go builds indeed but i think go1.12.2 version comes with ubuntu 20.04 distro
You shouldn't use the distro version. It's way too old. It exists at that version for stability of building packages that are in that distro version, not for development or building of new software.
building with xcaddy build --with replace-response results to
go: finding github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f go: github.com/mitchellh/osext@v0.0.0-20151018003038-5e2d6d41470f: git fetch -f https://github.com/mitchellh/osext refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /root/go/pkg/mod/cache/vcs/49dab62ca2a62ee258e74313908bf5f65445f26e5e920f6219c1a0d47ec30abe: exit status 128: fatal: could not read Username for 'https://github.com': terminal prompts disabled go: error loading module requirements 2024/07/12 17:14:56 [FATAL] exit status 1