Hmm ... obviously not as simple a problem as I first thought. I'll need to start with the definitely failing code and reduce it to as simple a case as possible that still exhibits the problem. Had (wrongly) assumed it would happen in all cases hence the simple example given initially.
On Friday, 27 August 2021 at 11:22:42 UTC+1 seank...@gmail.com wrote: > 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/dc3589dc-63cc-42ca-8da9-9ba37705c09an%40googlegroups.com.