void-packages/common/build-style/go.sh

27 lines
540 B
Bash
Raw Normal View History

2015-02-21 13:38:37 +01:00
#
# This helper is for templates for Go packages.
#
do_build() {
2017-09-15 19:18:31 +02:00
local path="${GOPATH}/src/${go_import_path}"
2015-02-21 13:38:37 +01:00
if [[ "${go_get}" != "yes" ]]; then
mkdir -p "$(dirname ${path})"
ln -fs $PWD "${path}"
fi
if [ -x /usr/bin/dep ] && [ -f Gopkg.toml ] && [ -f Gopkg.lock ]; then
2017-09-15 19:18:31 +02:00
cd "${path}"
dep ensure
fi
go_package=${go_package:-$go_import_path}
2016-05-03 00:32:48 +02:00
go get -x -tags "${go_build_tags}" -ldflags "${go_ldflags}" ${go_package}
2015-02-21 13:38:37 +01:00
}
do_install() {
find "${GOPATH}/bin" -type f -executable | while read line
do
vbin "${line}"
done
2015-02-21 13:38:37 +01:00
}