cmd/vet: fix name check for examples in _test package
cmd/vet: fix name check for examples in _test package

This fixes the obvious bug and makes go vet look for identifiers in foo
package when checking example names in foo_test package.

Note that for this check to work the foo package have to be
installed (using go install).

This commit however doesn't fix TestDivergentPackagesExamples test that
is not implemented correctly and passes only by chance.

Updates #16189

Change-Id: I5c2f675cd07e5b66cf0432b2b3e422ab45c3dedd
Reviewed-on: https://go-review.googlesource.com/24487
Reviewed-by: Dmitri Shuralyov <0c2a7749d909c8353e59c3f9c6a4d19a5ce000c1@gmail.com>
Run-TryBot: Rob Pike <4dc7c9ec434ed06502767136789763ec11d2c4b7@golang.org>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>
Reviewed-by: Rob Pike <4dc7c9ec434ed06502767136789763ec11d2c4b7@golang.org>

nawawi/go,codestation/go,4ad/go,christopher-henderson/Go,polyverse-security/go,josharian/go,goodlang/good,linux-on-ibm-z/go,polyverse-security/go,4ad/go,josharian/go,codestation/go,ImJasonH/go,vsekhar/elastic-go,vsekhar/elastic-go,suncycheng/go,suncycheng/go,vsekhar/elastic-go,goodlang/good,nawawi/go,CAFxX/go,ImJasonH/go,Cofyc/go,ImJasonH/go,linux-on-ibm-z/go,polyverse-security/go,cloudflare/go,golang/go,momchil-velikov/go,linux-on-ibm-z/go,cloudflare/go,derekmarcotte/go,nawawi/go,suncycheng/go,vsekhar/elastic-go,CAFxX/go,Cofyc/go,akutz/go,Cofyc/go,nawawi/go,derekmarcotte/go,polyverse-security/go,josharian/go,nawawi/go,goodlang/good,josharian/go,suncycheng/go,akutz/go,akutz/go,nawawi/go,suncycheng/go,vsekhar/elastic-go,akutz/go,akutz/go,josharian/go,4ad/go,4ad/go,4ad/go,ImJasonH/go,4ad/go,goodlang/good,codestation/go,golang/go,ImJasonH/go,Cofyc/go,cloudflare/go,golang/go,derekmarcotte/go,CAFxX/go,nawawi/go,derekmarcotte/go,Cofyc/go,vsekhar/elastic-go,ImJasonH/go,momchil-velikov/go,vsekhar/elastic-go,josharian/go,4ad/go,derekmarcotte/go,akutz/go,Cofyc/go,polyverse-security/go,Cofyc/go,golang/go,CAFxX/go,cloudflare/go,momchil-velikov/go,golang/go,akutz/go,akutz/go,cloudflare/go,derekmarcotte/go,cloudflare/go,linux-on-ibm-z/go,polyverse-security/go,codestation/go,derekmarcotte/go,linux-on-ibm-z/go,4ad/go,derekmarcotte/go,vsekhar/elastic-go,goodlang/good,josharian/go,suncycheng/go,suncycheng/go,momchil-velikov/go,suncycheng/go,codestation/go,golang/go,codestation/go,linux-on-ibm-z/go,cloudflare/go,codestation/go,CAFxX/go,goodlang/good,golang/go,momchil-velikov/go,goodlang/good,polyverse-security/go,CAFxX/go,CAFxX/go,cloudflare/go,josharian/go,linux-on-ibm-z/go,momchil-velikov/go,momchil-velikov/go,Cofyc/go,nawawi/go,ImJasonH/go,codestation/go,goodlang/good,polyverse-security/go,CAFxX/go,linux-on-ibm-z/go,momchil-velikov/go,ImJasonH/go,golang/go