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/e2b64e01a62b296eea9bfc9ea7f141b264944222.camel%40gmail.com.

Reply via email to