You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

11 lines
313 B

#!/bin/bash
#
# Generates a Go const from the contents of a static file, and appends it at
# the line following the go:generate directive that calls this script.
#
set -euo pipefail
sed -i.sed.bak -e "$((GOLINE+1)),\$d" "$GOFILE"
rm "$GOFILE.sed.bak"
(echo -n "const $1 = \`"; cat "$2"; echo "\`") >> "$GOFILE"