Cannot get the version

I can’t get the version number after compiling, and prompt unknown, how can I solve it?

$ git clone
$ cd caddy/caddy/
$ go build
root@ip:~/caddy/caddy# ./caddy -version

Hi Adrian, please try following the instructions in the README under the heading"To build Caddy with plugins (and with version information)":

There is no need to modify the Caddy code to build it with plugins. We will create a simple Go module with our own main() that you can use to make custom Caddy builds.

  1. Set the transitional environment variable for Go modules: export GO111MODULE=on
  2. Create a new folder anywhere and within create a Go file (extension .go ) with the contents below, adjusting to import the plugins you want to include:
    (snippet omitted here)
  3. go mod init caddy
  4. Run go get
  5. go install will then create your binary at $GOPATH/bin , or go build will put it in the current directory.

That will embed version information.

I really like how the install works with Go modules – really nice!

I started an Ansible plugin that automates this:


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