[dev.link] cmd/link: panic if HeadType is not set
[dev.link] cmd/link: panic if HeadType is not set

In the code there are conditions like !ctxt.IsDarwin(). This will
accidentally be true if HeadType is not yet set. Panic when
HeadType is not set, to catch errors.

Change-Id: Ic891123f27f0276fff5a4b5d29e5b1f7ebbb94ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/229869
Run-TryBot: Cherry Zhang <d62e63aa42ce272d7b6a5055d97e942b33a34679@google.com>
Reviewed-by: Than McIntosh <4b2922593166fc595a9b1a408f34f5d3817fe9d2@google.com>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>

akutz/go,CAFxX/go,golang/go,akutz/go,golang/go,cloudflare/go,nawawi/go,cloudflare/go,nawawi/go,golang/go,cloudflare/go,cloudflare/go,golang/go,akutz/go,CAFxX/go,cloudflare/go,CAFxX/go,CAFxX/go,nawawi/go,akutz/go,golang/go,cloudflare/go,akutz/go,nawawi/go,cloudflare/go,CAFxX/go,golang/go,nawawi/go,golang/go,akutz/go,CAFxX/go,akutz/go,CAFxX/go,nawawi/go,nawawi/go,nawawi/go,cloudflare/go,CAFxX/go,golang/go,akutz/go