go build style: move GOPATH creation to do_configure()
This commit is contained in:
parent
902807f15e
commit
92d6e1a521
3 changed files with 15 additions and 9 deletions
|
@ -2,18 +2,17 @@
|
|||
# This helper is for templates for Go packages.
|
||||
#
|
||||
|
||||
do_build() {
|
||||
local path="${GOPATH}/src/${go_import_path}"
|
||||
do_configure() {
|
||||
# This isn't really configuration, but its needed by packages
|
||||
# that do unusual things with the build where the expect to be
|
||||
# able to cd into the $GOSRCPATH
|
||||
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
|
||||
cd "${path}"
|
||||
dep ensure
|
||||
mkdir -p "$(dirname ${GOSRCPATH})"
|
||||
ln -fs $PWD "${GOSRCPATH}"
|
||||
fi
|
||||
}
|
||||
|
||||
do_build() {
|
||||
go_package=${go_package:-$go_import_path}
|
||||
go get -x -tags "${go_build_tags}" -ldflags "${go_ldflags}" ${go_package}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue