Can't build with plugins

I’m trying to build caddy from source with two plugins: http.filemanager and http.prometheus

I tried to follow by modifying the end of the imports in caddymain/run.go to be:

        // This is where other plugins get plugged in (imported)
        _ ""
        _ ""

I performed a go get for each of those plugin github URLs. Then, while still within src/ I ran go run build.go to create the caddy binary. Next I ran caddy -plugins and didn’t see either of the two plugins listed. Running the caddy binary works fine without directives for the plugins, using the prometheus directive results in the following message:
no action found for directive ‘prometheus’ with server type ‘http’ (missing a plugin?)
Perhaps that wiki page is out of date?

Dumb question, I know, but was the source file which you edited inside your GOPATH?

I promise it should work, this is how the build server does it. :slight_smile:

No questions as dumb when debugging :smile:

$ echo $GOPATH
$ ls $PWD/caddymain/run.go

I’m on a mac, maybe something weird going on with that? Someone on Hacker News recommends creating a plugins.go file; I tried that and it did not work either.

Do something crazy, like delete a huge swath of code in run.go, save it, and run build.go. If it doesn’t throw a compile error, then something is definitely wrong with your environment…

1 Like

I tried deleting stuff and it errored out so I went nuclear and deleted everything in $GOPATH to try a fresh start.
Still couldn’t get the wiki steps to work but I did get it to work when I copy and pasted this:

go get
go get

cd "$GOPATH/src/"

cat <<EOF>caddymain/plugins.go
package caddymain

import (
_ ""
_ ""       

go get -u -v -f ... || echo "Updated dependencies"
go run build.go

EXCEPT that only http.prometheus worked, http.filemanager does not. That is, I can see prometheus with caddy -plugins and using the directive works, the metrics page works, but filemanager does not show up anywhere and gives me the message “no action found for directive ‘filemanager’ with server type ‘http’ (missing a plugin?)”.
Not sure what that says about the wiki’s method of building caddy, but either way I think there is a issue with the filemanager plugin. I think I’ll raise an issue with them tomorrow.

1 Like


you are using the wrong import. as you can read in the filemanager repo you shoud import

If your build still fails, you can clone my repo at and add this import to the plugins.go file. you will get a container with a caddy binary and a filemanager plugin.

take as a guide how to build.

1 Like

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