#!/usr/bin/make -f

# cloudwatch requires feyeleanor/sets
# dynamodb requires cbroglie/mapstructure and bitly/go-simplejson
export DH_GOLANG_EXCLUDES := \
	cloudwatch \
	dynamodb

export DH_GOLANG_INSTALL_ALL := 1 # need testdata

override_dh_auto_test:
	# "Note: running all tests with the command `go test ./...` will currently fail as tests do not tear down their HTTP listeners."
	set -e; \
		for pkg in $$( \
			cd obj-$(DEB_BUILD_GNU_TYPE)/src; \
			find github.com/AdRoll/goamz -name '*_test.go' \
				| xargs dirname \
				| sort -u \
		); do \
			for excl in $(DH_GOLANG_EXCLUDES); do if [ "$$pkg" != "$${pkg%*$$excl*}" ]; then continue 2; fi; done; \
			DH_GOLANG_BUILDPKG="$$pkg" dh_auto_test; \
		done

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