1. The problem I’m having:
I am trying to create a customized build of caddy, including the restic-specific restic/caddy backend maintained at GitHub - restic/caddy: A plugin for the Caddy web server to act as a backend for restic
This fails with the latest release of restic/caddy because the latest release hasn’t been updated for a (rather old) caddy API change.
2. Error messages and/or full log output:
After following the instructions for customizing a caddy build from main.go, invoking the toolchain fails with the following error:
$ go build
# github.com/restic/caddy
/home/build/go/pkg/mod/github.com/restic/caddy@v0.2.1/setup.go:42:19: multiple-value restserver.NewHandler(restConfig) (value of type (http.Handler, error)) in single-value context
/home/build/go/pkg/mod/github.com/restic/caddy@v0.2.1/setup.go:42:41: cannot use restConfig (variable of struct type restserver.Server) as *restserver.Server value in argument to restserver.NewHandler
3. Caddy version:
This is a problem as of caddy master @ a76d005a94ff8ee19fc17f5409b4089c2bfd1a60, and restic/caddy v0.2.1
4. What is needed to fix it
Assuming the following go source code to base the caddy
and restic/caddy
build on:
// Copyright 2015 Matthew Holt and The Caddy Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package main is the entry point of the Caddy application.
// Most of Caddy's functionality is provided through modules,
// which can be plugged in by adding their import below.
//
// There is no need to modify the Caddy source code to customize your
// builds. You can easily build a custom Caddy with these simple steps:
//
// 1. Copy this file (main.go) into a new folder
// 2. Edit the imports below to include the modules you want plugged in
// 3. Run `go mod init caddy`
// 4. Run `go install` or `go build` - you now have a custom binary!
//
// Or you can use xcaddy which does it all for you as a command:
// https://github.com/caddyserver/xcaddy
package main
import (
caddycmd "github.com/caddyserver/caddy/v2/cmd"
// plug in Caddy modules here
_ "github.com/caddyserver/caddy/v2/modules/standard"
_ "github.com/restic/caddy"
)
func main() {
caddycmd.Main()
}
… and following the instructions detailed in the comment, the build can be fixed by running go get github.com/restic/caddy@master && go get
before executing go build
. The resulting executable has working rest-server/restic backend support.
However, the fix that I hope will result from this thread is @matt to cut a new release from restic/caddy
master, thereby fixing the build for anyone trying it as per the unmodified instructions for building caddy modules That would also close Latest release doesn't build against caddy, master does · Issue #13 · restic/caddy · GitHub as fixed.
Thanks for reading this far, and for creating and supporting caddy