Caddy: go get installation failing

Created on 25 Jan 2020  路  12Comments  路  Source: caddyserver/caddy

Installation via go get is failing for me:

$ go get -u github.com/caddyserver/caddy/caddy
# github.com/caddyserver/caddy/caddytls
../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)

Same result for me with go version go1.13.6 linux/amd64 and go version go1.13.5 darwin/amd64

Most helpful comment

The magic command is

$ go mod edit -replace "github.com/mholt/certmagic=github.com/mholt/[email protected]"

which will put this in your go.mod:

replace github.com/mholt/certmagic => github.com/mholt/certmagic v0.8.3

All 12 comments

@jkriss check out the recently closed bug: https://github.com/caddyserver/caddy/issues/2975

Ah, sorry I didn't find that one鈥揑 did search the existing issues, but it didn't come up for some reason.

I'm new to Go, so please excuse any ignorance here, but how can I pass in a context when I'm just running go get to download the dependency? And I do still get this error, even though I'm presumably fetching the latest version.

I am new too so no worries.

I actually went into the certmagic repo and reverted it to this commit. mholt/certmagic@32e52d6 (The go get should have put the files in your GOPATH/src/github.com/mhold/certmagic.)

If you run a go get on this repo again the compile should work.

Which go get command(s) should work? None of these work for me:

go get -u github.com/caddyserver/caddy/caddy
go get github.com/mholt/certmagic && go get github.com/caddyserver/caddy/caddy

go get github.com/caddyserver/caddy/caddy seemed to work for me. If you already ran it earlier then don't need to fetch the dependencies.

For reverting simply do a git checkout 32e52d625259ceb3254d291a3d0ba78ff1a7ac9b in the certmagic repo. Then run the above go get Worked for me. The only caveat is that 2.0 doesn't seem to be working on FreeBSD. Got some nasty errors on startup. So if you're compiling for a BSD system I wouldn't bother. 1.0 does have a ton of binaries for different platforms.

@jaredwolff Can you list the compilation errors on FreeBSD so we can look into them?

@Mohammed90 check out https://github.com/caddyserver/caddy/issues/3007 for more info

The magic command is

$ go mod edit -replace "github.com/mholt/certmagic=github.com/mholt/[email protected]"

which will put this in your go.mod:

replace github.com/mholt/certmagic => github.com/mholt/certmagic v0.8.3

@Gurpartap is this run within the caddyserver/caddy or caddyserver/caddy/caddy dir?

After that, is it simply run another go get github.com/caddyserver/caddy/caddy? Still having trouble here..

I used it on my project's go.mod. Didn't touch anything inside caddy or certmagic.

Latest version of Caddy

go/src/github.com/caddyserver/caddy/caddytls/tls.go

Line: 80

This particular call to

return certmagic.NewDefault().RevokeCert(domainName, true)

This call to RevokeCert is missing the first parameter (context).

@jaredwolff was correct, checking out that specific version is compatible with the code in the latest version of Caddy. That being said, version 0.8.3 (tag) IS COMPATIBLE, so why it doesn't work when importing might simply might be if you already had the latest version of the repo installed and thus it didn't install it???

I was able to get the latest beta compiling on FreeBSD. (following the instructions in the Readme) For anyone curious here we're the steps.

Thanks @mholt!

Was this page helpful?
0 / 5 - 0 ratings