Pls help me , I get an error when I build Caddy

1. My Caddy version (caddy version):

Not successfully installed,I followed README.md to build caddy.

2. How I run Caddy:

run go get github.com/caddyserver/caddy/caddy to install caddy

a. System environment:

Ubuntu 16.04 and Debian 9, both of them get the same error after I type the command above

b. Command:

go get github.com/caddyserver/caddy/caddy

c. Service/unit/compose file:

Not have

d. My complete Caddyfile or JSON config:

Not have

3. The problem I’m having:

I have followed every steps from README.md and tried it in my other server.However, the following error still occurs

4. Error messages and/or full log output:

root@molitei:~# go get github.com/caddyserver/caddy/caddy

github.com/caddyserver/caddy/caddytls

go/src/github.com/caddyserver/caddy/caddytls/config.go:119:4: cannot use func literal (type func(certmagic.Certificate) (certmagic.Config, error)) as type certmagic.ConfigGetter in field value
go/src/github.com/caddyserver/caddy/caddytls/setup.go:135:19: config.Manager.Email undefined (type *certmagic.Config has no field or method Email)
go/src/github.com/caddyserver/caddy/caddytls/setup.go:153:19: config.Manager.CA undefined (type *certmagic.Config has no field or method CA)
go/src/github.com/caddyserver/caddy/caddytls/setup.go:160:19: config.Manager.KeyType undefined (type *certmagic.Config has no field or method KeyType)
go/src/github.com/caddyserver/caddy/caddytls/setup.go:257:19: config.Manager.DNSProvider undefined (type *certmagic.Config has no field or method DNSProvider)
go/src/github.com/caddyserver/caddy/caddytls/setup.go:269:9: undefined: certmagic.HostQualifies
go/src/github.com/caddyserver/caddy/caddytls/setup.go:361:27: config.Manager.KeyType undefined (type *certmagic.Config has no field or method KeyType)
go/src/github.com/caddyserver/caddy/caddytls/tls.go:74:4: undefined: certmagic.HostQualifies
go/src/github.com/caddyserver/caddy/caddytls/tls.go:80:42: not enough arguments in call to certmagic.NewDefault().RevokeCert
have (string, bool)
want (context.Context, string, bool)

5. What I already tried:

I tried it in my other server Debian 9 and install the old go version 1.13 but still give me the error

6. Links to relevant resources:

Relevant issue: https://github.com/caddyserver/caddy/issues/3165

Looks like @Mohammed90 gave you a solution:

$ git clone https://github.com/caddyserver/caddy caddy-v1
$ cd caddy-v1/caddy
$ go build

Thank you very much! Can you help me how to build it with plugins(tls.dns.dnspod)

Just follow the steps in the README: https://github.com/caddyserver/caddy#build

And the instructions for DNS plugins: https://github.com/caddyserver/dnsproviders/blob/master/README.md

Thx for your help, I use instruction of "To build Caddy with plugins (and with version information) "which from README.md and now succefully install Caddy v1.0.5 (h1:5B1Hs0UF2x2tggr2X9jL2qOZtDXbIWQb9YLbmlxHSuM=)

However, I get a dnspod json error when I run caddy Caddyfile. I remember that the issue has been solved in v1.0.5 but why I use it and still get the error?

I find that when I run go build , it still downloading the lego v3.2.0 instead of v3.3.0 which solve the issue
go build
go: downloading github.com/klauspost/cpuid v1.2.0
go: finding module for package github.com/caddyserver/dnsproviders/dnspod
go: downloading github.com/mholt/certmagic v0.8.3
go: downloading github.com/lucas-clemente/quic-go v0.13.1
go: downloading github.com/gorilla/websocket v1.4.0
go: downloading github.com/dustin/go-humanize v1.0.0
go: downloading github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a
go: downloading github.com/go-acme/lego/v3 v3.2.0

Can you just help me how to upgrade the lego to v3.3.0 and tell me why it download v3.3.0 while my caddy’s version is v1.0.5? Thank you!

Run

go get -u github.com/go-acme/lego/v3

before running go build. It will upgrade to v3.5.0.