[buildout]
extends =
  ../../component/golang/buildout.cfg

parts =
  caddy

[gowork]
# Caddy 1.x+ uses go modules, for which gowork does not work yet
golang  = ${golang1.12:location}
gcc-bin-directory  = ${golang1.12:gcc-bin-directory}

install =

[gowork.goinstall]
command = :
depends =
  ${caddy:recipe}

[caddy]
# revision and repository can be used to control which caddy version is used
revision = v1.0.3
repository = github.com/caddyserver/caddy/caddy

recipe  = plone.recipe.command
update-command = ${:command}
stop-on-error = True
# GO111MODULE=on enables go modules support
# the chmod is needed as modules are fetched with u-w
command =
  . ${gowork:env.sh} &&
  cd ${gowork:directory} &&
  export GO111MODULE=on &&
  go get ${:repository}@${:revision} &&
  chmod -R u+w .
output = ${gowork:bin}/caddy
location = ${:output}
