#!/usr/bin/make -f

# Upstream requires github.com/cheggaaa/pb; Debian ships the same code as
# gopkg.in/cheggaaa/pb.v1 (golang-gopkg-cheggaaa-pb.v1-dev), which is also
# what upstream's own go.mod lists as the indirect module.
export DH_GOLANG_MODULE_MAPPINGS := github.com/cheggaaa/pb:gopkg.in/cheggaaa/pb.v1

# Fixtures of the archive permissions tests.
export DH_GOLANG_INSTALL_EXTRA := test-fixtures/

%:
	dh $@ --builddirectory=debian/_build --buildsystem=golang --with=golang

# The -dev package is arch:all, so the go-getter command is not shipped.
# At compat 14 an explicit dh_auto_install call installs into debian/tmp.
override_dh_auto_install:
	dh_auto_install --destdir=debian/golang-github-hashicorp-go-getter-dev -- --no-binaries

# These S3, GCS, http2 and git tests need the network.
override_dh_auto_test:
	dh_auto_test -- -skip 'TestS3Getter|TestGCSGetter|TestHttpGetter_http2server|^TestGitGetter_(sshKey|sshSCPStyle|sshExplicitPort|BadGitConfig|BadGitDirName)$$'

# The tests check the checksums and file modes of the fixture archives.
override_dh_strip_nondeterminism:
	dh_strip_nondeterminism -Xtestdata/ -Xtest-fixtures/
