#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DH_GOPKG := github.com/danos/encoding

GOBUILDDIR := _build

%:
	dh $@ --buildsystem=golang --with=golang --builddirectory=$(GOBUILDDIR)

override_dh_auto_build: vet
	dh_auto_build

# We do not vet vendor code
# We would like to use '-structtag[s]=false' so the 'BadFormat' tag test in
# rfc7951/tagkey_test.go can be used, but despite promises of backwards
# compatibility, it seems that somewhere between go1.11 and go1.15 the flag
# changed from structtags to structtag.
vet:
	go doc cmd/vet; \
	if go doc cmd/vet >/dev/null 2>&1; then \
		GOPATH=$(CURDIR)/$(GOBUILDDIR) go vet $$(find . -type f -name \*.go | \
			xargs dirname | sort -u | grep -v "/vendor/"); \
	fi
