common/build-style/go: add a default do_check function

This commit is contained in:
classabbyamp 2024-08-09 13:34:15 -04:00 committed by classabbyamp
parent 05adb308ff
commit 332756ed08
1 changed files with 7 additions and 1 deletions

View File

@ -29,7 +29,7 @@ do_build() {
fi fi
done done
go_package=${go_package:-$go_import_path} : ${go_package:=$go_import_path}
# Build using Go modules if there's a go.mod file # Build using Go modules if there's a go.mod file
if [ "${go_mod_mode}" != "off" ] && [ -f go.mod ]; then if [ "${go_mod_mode}" != "off" ] && [ -f go.mod ]; then
@ -60,6 +60,12 @@ do_build() {
fi fi
} }
do_check() {
: ${make_check_target:=./...}
go test -p "$XBPS_MAKEJOBS" -v -tags "${go_build_tags}" -ldflags "${go_ldflags}" ${make_check_args} ${make_check_target}
}
do_install() { do_install() {
for f in ${GOPATH}/bin/* ${GOPATH}/bin/**/*; do for f in ${GOPATH}/bin/* ${GOPATH}/bin/**/*; do
if [ -f "$f" ] && [ -x "$f" ]; then if [ -f "$f" ] && [ -x "$f" ]; then