Help building Caddy with a local plugin

Hello!

I’m a Golang beginner and I’m trying to develop a new plugin for Caddy.

I want to build Caddy with my plugin which is only available locally. I tried to include it in the import section of run.go according to the documentation but that doesn’t seem to work:

build caddy: cannot load antibot: cannot find module providing package antibot

While searching before posting here I found about Go modules and Golang 1.12, so I tried to include my plugin in the go.mod by following the To build Caddy with plugins (and with version information) section in the README of Caddy but that doesn’t work as well:

/home/unixfox/Documents/caddydev/go.mod:7: usage: require module/path v1.2.3

What’s the correct way to include a local plugin when building Caddy for development purposes?
My golang version is go version go1.12.4 linux/amd64.

That’s the correct way, and I believe it should work just fine locally as long as your plugin is properly defined as a module. There’s a bit of reading linked by Caddy’s developer here when Caddy was initially moving to go modules, I’m not sure if it’ll help.

https://github.com/golang/go/wiki/Modules#how-to-define-a-module

1 Like

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