compiler: allow //go:embed in files underscore-importing embed

The embed spec allows for //go:embed to be used in files that
underscore-import package "embed". This is useful for embeds to
[]byte and string vars because the embed.FS type may not be referenced
if those are the only types of embeds in a file. Because the compiler
previously checked whether there were any aliases to the embed
package to decide if //go:embed could be used, it would reject
files with only underscore imports of embed. Instead, record
whether the embed import is encountered at all, similar to what
is done with unsafe, to decide whether //go:embed is allowed.

Change-Id: I1b77db33f3b49c27a4ed3f186470ae93c126fb68
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/297553
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
4 files changed