#!/usr/bin/make -f

export DH_GOLANG_INSTALL_EXTRA := \
 kms/gcp/test \
 ssh/test/ls \
 storage/test \
 test

include /usr/share/dpkg/architecture.mk

%:
	dh $@ --buildsystem=golang --with=golang

ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
override_dh_auto_test:
	# Backup some test data, and restore them after test
	# Since those data is modified during testing
	cp -a ssh/test/ls ssh/test/ls.orig
ifneq ($(DEB_TARGET_ARCH_BITS), 64)
# Go test build fails on 32-bit systems, so ignore the failure
	-dh_auto_test
else
	dh_auto_test
endif
	rm -rf ssh/test/ls
	mv ssh/test/ls.orig ssh/test/ls
endif
