iterate on a date...
@@ -20,15 +20,8 @@ build:
- pushd {{ pkg_src }}
- for /F "delims=" %%i in ('date.exe +%Y-%m-%dT%H:%M:%S%:z') DO set BUILT=%%i # [win]
- export BUILT=$(date -u +%Y-%m-%dT%H:%M:%S%:z) # [unix]
- - >-
- go install -v
- -ldflags "-X {{ import_path }}/common.NAME='{{ name }}'
- -X {{ import_path }}/common.VERSION='{{ version }}'
- -X {{ import_path }}/common.REVISION='deadbeef'
- -X {{ import_path }}/common.BRANCH='{{ branch }}'
- -X {{ import_path }}/common.BUILT='%BUILT%'" # [win]
- -X {{ import_path }}/common.BUILT='$BUILT'" # [unix]
- .
+ {% set flags = dict(VERSION=version, REVISION="deadbeef", BRANCH=branch, BUILD="%BUILT%" if win else "$BUILT") %}
+ - go install -v -ldflags "{% for key,value in flags.items() %}-X {{ import_path }}/common.{{ key }}='{{ value }}' {% endfor %}" .
requirements:
build:
