Which go version for building Caddy 2.4.5?

Summary:

I’m getting a build failure.
I’m using xcaddy 0.2.0 to build caddy 2.4.5 with go 1.15.6, which is what is stated as required in the docs, but it fails telling me I need go 1.6, for the net.ErrClosed api. Since this seems to have been added to go 1.6 perhaps specifically for Caddy, I suspect the build page needs to be updated.

1. Caddy version (caddy version): 2.4.5

2. How I run Caddy:

Right now, I’m simply trying to build.

a. System environment:

Build machine is Ubuntu 20, x86_64.

go version is:

go version go1.15.8 linux/amd64

Note that Build from source — Caddy Documentation says:

Requirements:
    Go 1.15 or newer

b. Command:

I’m cross building for 386, because although Caddy provides over a dozen downloadable architectures, 386 isn’t among them. (Color me seriously puzzled about that. :-/ )

I’m running the following command, using xcaddy v0.2.0:

GOOS=linux GOARCH=386 xcaddy build

3. The problem I’m having:

Build failure, error message claims it needs go 1.16.

2021/09/05 09:32:57 [INFO] Temporary folder: /tmp/buildenv_2021-09-05-0932.1712691006
2021/09/05 09:32:57 [INFO] Writing main module: /tmp/buildenv_2021-09-05-0932.1712691006/main.go
2021/09/05 09:32:57 [INFO] Initializing Go module
2021/09/05 09:32:57 [INFO] exec (timeout=10s): /usr/local/go/bin/go mod init caddy 
go: creating new go.mod: module caddy
2021/09/05 09:32:57 [INFO] Pinning versions
2021/09/05 09:32:57 [INFO] exec (timeout=0s): /usr/local/go/bin/go get -d -v github.com/caddyserver/caddy/v2 
go: downloading github.com/caddyserver/caddy/v2 v2.4.5
go: github.com/caddyserver/caddy/v2 upgrade => v2.4.5
go: downloading github.com/prometheus/client_golang v1.11.0
go: downloading go.uber.org/zap v1.19.0
go: downloading golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
go: downloading google.golang.org/protobuf v1.27.1
go: downloading github.com/google/uuid v1.3.0
go: downloading github.com/caddyserver/certmagic v0.14.5
go: downloading golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e
go: downloading github.com/mholt/acmez v1.0.0
go: downloading golang.org/x/net v0.0.0-20210614182718-04defd469f4e
go: downloading github.com/klauspost/cpuid/v2 v2.0.9
2021/09/05 09:33:28 [INFO] Build environment ready
2021/09/05 09:33:28 [INFO] Building Caddy
2021/09/05 09:33:28 [INFO] exec (timeout=0s): /usr/local/go/bin/go mod tidy 
go: downloading github.com/klauspost/compress v1.13.4
go: downloading github.com/smallstep/certificates v0.16.4
go: downloading github.com/lucas-clemente/quic-go v0.23.0
go: downloading google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08
go: downloading github.com/smallstep/cli v0.16.1
go: downloading github.com/stretchr/testify v1.7.0
go: downloading github.com/google/go-cmp v0.5.6
go: downloading github.com/yuin/goldmark v1.4.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
go: downloading github.com/onsi/gomega v1.13.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/alecthomas/chroma v0.9.2
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading github.com/smallstep/nosql v0.3.8
go: downloading github.com/benbjohnson/clock v1.1.0
go: downloading github.com/urfave/cli v1.22.5
go: downloading howett.net/plist v0.0.0-20181124034731-591f970eefbb
go: downloading github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262
go: downloading go.step.sm/crypto v0.9.0
go: downloading go.uber.org/goleak v1.1.10
go: downloading github.com/Masterminds/sprig v2.22.0+incompatible
go: downloading github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38
go: downloading go.step.sm/linkedca v0.0.0-20210611183751-27424aae8d25
go: downloading github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1
go: downloading github.com/dgraph-io/badger/v2 v2.2007.4
go: downloading github.com/golang/mock v1.6.0
go: downloading github.com/sergi/go-diff v1.2.0
go: downloading github.com/BurntSushi/toml v0.3.1
go: downloading github.com/mattn/go-isatty v0.0.13
go: downloading gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
go: downloading go.step.sm/cli-utils v0.4.1
go: downloading github.com/sirupsen/logrus v1.7.0
go: downloading go.etcd.io/bbolt v1.3.6
go: downloading google.golang.org/grpc v1.38.0
go: downloading github.com/onsi/ginkgo v1.16.4
go: downloading github.com/kylelemons/godebug v1.1.0
go: downloading github.com/mattn/go-colorable v0.1.8
go: downloading github.com/Masterminds/semver v1.5.0
go: downloading github.com/go-sql-driver/mysql v1.6.0
go: downloading github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897
go: downloading golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
go: downloading github.com/chzyer/logex v1.1.10
go: downloading github.com/marten-seemann/qtls-go1-17 v0.1.0
go: downloading golang.org/x/tools v0.1.3
go: downloading go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1
go: downloading github.com/micromdm/scep/v2 v2.0.0
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/marten-seemann/qtls-go1-16 v0.1.4
go: downloading github.com/go-kit/kit v0.10.0
go: downloading golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
go: downloading github.com/aws/aws-sdk-go v1.37.0
go: downloading github.com/kr/pretty v0.2.1
go: downloading github.com/mitchellh/reflectwalk v1.0.1
go: downloading github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721
go: downloading github.com/go-stack/stack v1.8.0
go: downloading github.com/kr/text v0.2.0
go: downloading github.com/nxadm/tail v1.4.8
go: downloading github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
go: downloading golang.org/x/mod v0.4.2
go: downloading github.com/OneOfOne/xxhash v1.2.2
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading github.com/spaolacci/murmur3 v1.1.0
go: downloading github.com/go-logfmt/logfmt v0.5.0
go: downloading cloud.google.com/go v0.83.0
go: downloading github.com/googleapis/gax-go v2.0.2+incompatible
go: downloading google.golang.org/api v0.48.0
go: downloading github.com/fsnotify/fsnotify v1.4.9
go: downloading go.opencensus.io v0.23.0
go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
go: downloading golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c
go: downloading google.golang.org/appengine v1.6.7
go: downloading github.com/jmespath/go-jmespath v0.4.0
go: downloading github.com/jmespath/go-jmespath/internal/testify v1.5.1
2021/09/05 09:33:45 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /home/pgf/go/caddy2/i386/caddy -ldflags -w -s -trimpath 
go build github.com/lucas-clemente/quic-go/internal/qtls: build constraints exclude all Go files in /home/pgf/go/pkg/mod/github.com/lucas-clemente/quic-go@v0.23.0/internal/qtls
# github.com/caddyserver/caddy/v2/cmd
/home/pgf/go/pkg/mod/github.com/caddyserver/caddy/v2@v2.4.5/cmd/commandfuncs.go:123:24: undefined: net.ErrClosed
note: module requires Go 1.16
2021/09/05 09:34:27 [INFO] Cleaning up temporary folder: /tmp/buildenv_2021-09-05-0932.1712691006
2021/09/05 09:34:27 [FATAL] exit status 2

Caddy since v2.4.4 requires Go 1.16 at minimum, but Go 1.17 is recommended.

You can find the required version in the README on GitHub or in the go.mod file in the source repo.

You’re right that the docs do mention Go 1.15, we forgot to update that. I’ll fix it for next time we push updates to the website. docs: Update minimum required Go version · caddyserver/website@c60bf70 · GitHub

1 Like

Thank you. I would have simply upgraded, but since go, like caddy, needs hand installation, I’m always reluctant to perturb what’s there, and working.

Can you explain why the 32-bit version of Caddy isn’t in the set of pre-built binaries? I find it hard to believe that the s390x architecture, for example, is more popular than 386.

paul

i386 binaries were downloaded less than 0.1% of the time when we did offer them, but we’ve had actual requests and contributions from the community for s390x.

Well, you can consider this an “actual request” from me, if that helps. :wink:

No worries. I now have the recipes documented for a) upgrading xcaddy, b) upgrading go, and c) upgrading caddy. Just a nuisance, is all.

It’s still far less pain than I’ve eliminated overall by switching to caddy. So overall, thank you!

paul

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.