{% macro goreplace(path="/usr/local/bin", version="22.10.0") -%}
    ## Install go-replace
    && wget -O "{{ path }}/go-replace" "https://github.com/webdevops/go-replace/releases/download/{{ version }}/go-replace.linux.amd64" \
    && chmod +x "{{ path }}/go-replace" \
    && "{{ path }}/go-replace" --version
{%- endmacro %}

{% macro gosu(path="/sbin", arch="amd64", version="1.10") -%}
    # Install gosu
    && wget -O "{{ path }}/gosu" "https://github.com/tianon/gosu/releases/download/{{ version }}/gosu-{{ arch }}" \
    && wget -O "/tmp/gosu.asc" "https://github.com/tianon/gosu/releases/download/{{ version }}/gosu-{{ arch }}.asc" \
    && export GNUPGHOME="$(mktemp -d)" \
    && gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
    && gpg --batch --verify /tmp/gosu.asc "{{ path }}/gosu" \
    && rm -rf "$GNUPGHOME" /tmp/gosu.asc \
    && chmod +x "{{ path }}/gosu" \
    && "{{ path }}/gosu" nobody true
{%- endmacro %}
