freman / caddy-reauth

Auth your Caddyserver requests against another server
MIT License
27 stars 15 forks source link

Caddy's import path has changed #29

Closed mholt closed 5 years ago

mholt commented 5 years ago

Caddy's import path (and Go module name) has changed from

github.com/mholt/caddy

to

github.com/caddyserver/caddy

Unfortunately, Go modules are not yet mature enough to handle a change like this (see https://golang.org/issue/26904 - "haven't implemented that part yet" but high on priority list for Go 1.14) which caught me off-guard. Using Go module's replace feature didn't act the way I expected, either. Caddy now fails to build with plugins until they update their import paths.

I've hacked a fix into the build server, so downloading Caddy with your plugin from our website should continue working without any changes on your part, for now. However, please take a moment and update your import paths, and do a new deploy on the website, because the workaround involves ignoring module checksums and performing a delicate recursive search-and-replace.

I'm terribly sorry about this. I did a number of tests and dry-runs to ensure the change would be smooth, but apparently some unknown combination of GOPATH, Go modules' lack of maturity, and other hidden variables in the system or environment must have covered up something I missed.

This bash script should make it easy (run it from your project's top-level directory):

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

We use this script in the build server as part of the temporary workaround.

Let me know if you have any questions! Sorry again for the inconvenience.

freman commented 5 years ago

Hi Friend.

I'm having some troubles getting it to build in the caddy release system

plugin deploy failed
go vet github.com/freman/caddy-reauth@0863eef919a28e0f76cd22f8af6cb3643b4d28af: timed out (buildworker-enforced)

2019/07/03 02:11:03 exec [/tmp/buildenv_07-03-0211.864757606/main] /usr/local/bin/go mod init tmp/caddy/main
go: creating new go.mod: module tmp/caddy/main
2019/07/03 02:11:03 exec [/tmp/buildenv_07-03-0211.864757606/main] /usr/local/bin/go mod edit -replace github.com/mholt/caddy=github.com/caddyserver/caddy@latest
2019/07/03 02:11:03 exec [/tmp/buildenv_07-03-0211.864757606/main] /usr/local/bin/go get -d -x github.com/freman/caddy-reauth@0863eef919a28e0f76cd22f8af6cb3643b4d28af
mkdir -p /gopath/pkg/mod/cache/vcs # git2 https://github.com/caddyserver/caddy
# lock /gopath/pkg/mod/cache/vcs/0e556cf41b491c4aa1cce5aa987514b1ec6e12b1e54d0e7f799361de1258ed72.lock# /gopath/pkg/mod/cache/vcs/0e556cf41b491c4aa1cce5aa987514b1ec6e12b1e54d0e7f799361de1258ed72 for git2 https://github.com/caddyserver/caddy
cd /gopath/pkg/mod/cache/vcs/0e556cf41b491c4aa1cce5aa987514b1ec6e12b1e54d0e7f799361de1258ed72; git ls-remote -q https://github.com/caddyserver/caddy
0.408s # cd /gopath/pkg/mod/cache/vcs/0e556cf41b491c4aa1cce5aa987514b1ec6e12b1e54d0e7f799361de1258ed72; git ls-remote -q https://github.com/caddyserver/caddy
mkdir -p /gopath/pkg/mod/cache/vcs # git2 https://github.com/freman/caddy-reauth
# lock /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f.lock# /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f for git2 https://github.com/freman/caddy-reauth
go: finding github.com/freman/caddy-reauth 0863eef919a28e0f76cd22f8af6cb3643b4d28af
cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 0863eef919a28e0f76cd22f8af6cb3643b4d28af
0.008s # cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 0863eef919a28e0f76cd22f8af6cb3643b4d28af
cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git tag -l
0.006s # cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git tag -l
cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git ls-remote -q https://github.com/freman/caddy-reauth
0.304s # cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git ls-remote -q https://github.com/freman/caddy-reauth
cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git fetch -f --depth=1 https://github.com/freman/caddy-reauth 0863eef919a28e0f76cd22f8af6cb3643b4d28af:refs/dummy
0.565s # cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git fetch -f --depth=1 https://github.com/freman/caddy-reauth 0863eef919a28e0f76cd22f8af6cb3643b4d28af:refs/dummy
cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 0863eef919a28e0f76cd22f8af6cb3643b4d28af
0.008s # cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 0863eef919a28e0f76cd22f8af6cb3643b4d28af
cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git cat-file blob 0863eef919a28e0f76cd22f8af6cb3643b4d28af:go.mod
0.008s # cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git cat-file blob 0863eef919a28e0f76cd22f8af6cb3643b4d28af:go.mod
cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git describe --first-parent --always --abbrev=0 --match 'v[0-9]*.[0-9]*.[0-9]*' --tags 0863eef919a28e0f76cd22f8af6cb3643b4d28af
0.005s # cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git describe --first-parent --always --abbrev=0 --match 'v[0-9]*.[0-9]*.[0-9]*' --tags 0863eef919a28e0f76cd22f8af6cb3643b4d28af
cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 0863eef919a2
0.009s # cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git -c log.showsignature=false log -n1 '--format=format:%H %ct %D' 0863eef919a2
cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git cat-file blob 0863eef919a28e0f76cd22f8af6cb3643b4d28af:go.mod
0.004s # cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git cat-file blob 0863eef919a28e0f76cd22f8af6cb3643b4d28af:go.mod
go: downloading github.com/freman/caddy-reauth v0.0.0-20190703021030-0863eef919a2
cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git cat-file blob 0863eef919a28e0f76cd22f8af6cb3643b4d28af:go.mod
0.004s # cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git cat-file blob 0863eef919a28e0f76cd22f8af6cb3643b4d28af:go.mod
cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git -c core.autocrlf=input -c core.eol=lf archive --format=zip --prefix=prefix/ 0863eef919a28e0f76cd22f8af6cb3643b4d28af
0.038s # cd /gopath/pkg/mod/cache/vcs/fb190c108e4a5663aed1159977447a3d3da476ddfe64e0f71b98fe08c02c9e8f; git -c core.autocrlf=input -c core.eol=lf archive --format=zip --prefix=prefix/ 0863eef919a28e0f76cd22f8af6cb3643b4d28af
go: extracting github.com/freman/caddy-reauth v0.0.0-20190703021030-0863eef919a2
2019/07/03 02:11:06 exec [/tmp/buildenv_07-03-0211.864757606/main] /usr/local/bin/go get -d -x github.com/caddyserver/caddy@v1.0.1
2019/07/03 02:11:06 exec [/tmp/buildenv_07-03-0211.864757606/main] /usr/local/bin/go mod vendor
2019/07/03 02:11:08 exec [/tmp/buildenv_07-03-0211.864757606/main] /bin/bash /tmp/buildenv_07-03-0211.864757606/main/rewrite.bash
2019/07/03 02:11:22 exec [/tmp/buildenv_07-03-0211.864757606/main] /usr/local/bin/go mod edit -dropreplace github.com/mholt/caddy
2019/07/03 02:11:22 exec [/tmp/buildenv_07-03-0211.864757606/main] /usr/local/bin/go mod edit -droprequire github.com/mholt/caddy
2019/07/03 02:11:22 exec [/] /usr/bin/git clone https://github.com/freman/caddy-reauth.git /tmp/buildenv_07-03-0211.864757606/repo
Cloning into '/tmp/buildenv_07-03-0211.864757606/repo'...
2019/07/03 02:11:22 exec [/tmp/buildenv_07-03-0211.864757606/repo] /usr/bin/git checkout 0863eef919a28e0f76cd22f8af6cb3643b4d28af
Note: checking out '0863eef919a28e0f76cd22f8af6cb3643b4d28af'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 0863eef Beat head against go.mod for 20 minutes
2019/07/03 02:11:22 exec [/tmp/buildenv_07-03-0211.864757606/repo] /usr/local/bin/go vet github.com/freman/caddy-reauth/...

I can go get, go vet, go test, everything works fine here

example:

time go vet github.com/freman/caddy-reauth/...

real    0m1.337s
user    0m3.534s
sys 0m1.846s

I confess I don't know how empty the build environment is but I can't get it to build.

mholt commented 5 years ago

Timeout, might just be that the build worker is too busy. There's only one CPU. :) Try again a little later maybe! Keep me posted.