abiosoft/caddy-exec

Build error: undefined: httpcaddyfile.App

WingLim opened this issue · 2 comments

I use the README Installation section command to build a caddy with caddy-exec.

xcaddy build \
    --with github.com/abiosoft/caddy-exec

Got error below:

# github.com/abiosoft/caddy-exec
../../../../go/1.16.0/pkg/mod/github.com/abiosoft/caddy-exec@v0.0.0-20210304195947-67052cc32b0d/caddyfile.go:11:37: cannot use parseExec (type func(*caddyfile.Dispenser, interface {}) (interface {}, error)) as type httpcaddyfile.UnmarshalGlobalFunc in argument to httpcaddyfile.RegisterGlobalOption
../../../../go/1.16.0/pkg/mod/github.com/abiosoft/caddy-exec@v0.0.0-20210304195947-67052cc32b0d/caddyfile.go:185:9: undefined: httpcaddyfile.App
2021/04/23 12:47:46 [INFO] Cleaning up temporary folder: /Users/winglim/dev/build-caddy/exec/buildenv_2021-04-23-1247.782452213
2021/04/23 12:47:46 [FATAL] exit status 2

The caddy v2.3.0 didn't have App struct.
Take a look: https://github.com/caddyserver/caddy/blob/v2.3.0/caddyconfig/httpcaddyfile/httptype.go

Found a way to solve it
Use the beta version v2.4.0-beta.2

xcaddy build v2.4.0-beta.2 \
--with github.com/abiosoft/caddy-exec

But in this way may cause some problems we could not expected because of the beta version.

Maybe you should add the httptype.App struct in the module in some way until the new release verion of caddy is published.

Since caddy v2.4.0 is released, this problem is solved.