Problem building v1.0.1 with go get

Hello,

First: Congratulations for 1.0.0, we do use it in production and it works as expected! Hooray \o/

I am trying to build caddy v1.0.1 using go get:

$ go version
go version go1.12.4 linux/amd64
$ cd `mktemp -d`
$ export GOPATH=`pwd`
$ export GO111MODULE=on
$ go get github.com/mholt/caddy/caddy@v1.0.1
go: finding github.com/mholt/caddy/caddy v1.0.1
go: finding github.com/mholt/caddy v1.0.1
go: downloading github.com/mholt/caddy v1.0.1
go: extracting github.com/mholt/caddy v1.0.1
go: github.com/mholt/caddy@v1.0.1: parsing go.mod: unexpected module path "github.com/caddyserver/caddy"
go: error loading module requirements

It worked fine for v1.0.0:

$ go get github.com/mholt/caddy/caddy@v1.0.0
go: finding github.com/mholt/caddy/caddy v1.0.0
go: finding github.com/mholt/caddy v1.0.0
go: downloading github.com/mholt/caddy v1.0.0
go: extracting github.com/mholt/caddy v1.0.0
go: finding github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a
go: finding github.com/lucas-clemente/quic-go v0.10.2
go: finding github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348
go: finding github.com/hashicorp/go-syslog v1.0.0
go: finding github.com/klauspost/cpuid v1.2.0
go: finding github.com/naoina/toml v0.1.1
go: finding github.com/dustin/go-humanize v1.0.0
...
go: downloading golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e
go: extracting golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e
go: extracting golang.org/x/text v0.3.0
$ ls bin/caddy 
bin/caddy

Is it related to KNOWN ISSUE

Building Caddy with plugins is difficult due to the repository move.

of 1.0.1?

Will it be fixed in > v1.0.1?

I assumed that go get way with pinned tag/revision is the good way [tm] to build caddy from source, but is that approach really supported?

Regards,
Łukasz

1 Like

Indeed, the build instructions have changed; and unfortunately it’s a little more complicated until plugins update their import paths. Many have already, which is good. :slight_smile:

Will it be fixed in > v1.0.1?

This is what 1.0.1 fixes, actually.

Here are the updated build instructions: GitHub - caddyserver/caddy: Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Make sure to be working solely out of the caddyserver/caddy repo, and remove the mholt/caddy folder(s) from your system, including any in $GOPATH/pkg/mod, just to be sure.

If plugins you’ve plugged in still refer to mholt/caddy, they will have to be modified to use caddyserver/caddy… our build server does this automatically for now as a shim, but it’s not awesome and is just temporary. Basically it’s a global search-replace:

find . -name '*.go' | while read -r f; do
	sed -i.bak 's/\/mholt\/caddy/\/caddyserver\/caddy/g' $f && rm $f.bak
done
1 Like

Hello,

It was my fault.

I used:

go get github.com/mholt/caddy/caddy@v1.0.1

Instead of

go get github.com/caddyserver/caddy/caddy@v1.0.1

With the former one it works fine.

Regards,
Łukasz

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.