I can't reproduce the error you're seeing either in 1.15 or in later 
versions with the code you provided

On Friday, August 27, 2021 at 10:11:07 AM UTC+2 wji...@gmail.com wrote:

> Hi,
>
> We've recently moved from using 'go tool vet' to 'go vet' (we need to 
> stick to the Go versions shipped with Debian) and have found that it is not 
> finding public methods that we export for test only by putting them in 
> _test.go files (error is 'undeclared name'). Disable go vet, and you can 
> build and run the test code fine. Problematic code is something like this:
>
> export_for_test.go:
>
> package foo
>
> func ExportedForTest() {
> // Do something
> }
>
> ---
>
> foo_test.go
>
> package foo_test
>
> import (
> "foo"
> "testing"
> )
>
> func TestFoo(t *testing.T) {
> foo.ExportedForTest()
> }
>
> ---
>
> We are using Go 1.15 in Debian 10.
>
> This would appear to be a bug in 'go vet' given the actual build and 
> running of test code works fine. Is there any way to work around this, and 
> has it been fixed in more recent releases (not that this would solve our 
> problem as we are stuck with the buster-backport version of Go for now, and 
> Debian 11 is also using Go 1.15).
>
> Thanks,
>
> William
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/a141f3af-9eac-44a8-aa8e-4613c7eb0a1dn%40googlegroups.com.

Reply via email to