Hey there,

I have a package "test", which is only used in tests and which contains one
function: https://go.dev/play/p/Ne1xGXsQNmy

This leads to a finding when running deadcode:

$ deadcode ./...
test/testg.go:8:6: unreachable func: SkipIfIntegration

I tried several things:
- renaming the package to "test_test"
- renaming the file to "test_test.go"

I think https://github.com/golang/go/issues/31135 and
https://github.com/golang/go/issues/39565 address the same topic.

It seems that in *_test.go files you cannot import from other *_test.go
files in other packages.

My workaround: I run deadcode -test ./... but then I may miss unused code,
which may have an old test.

Is there a better way?

PS: I want to follow
https://www.konradreiche.com/blog/how-to-separate-integration-tests-in-go/

thanks
Chris

-- 
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 visit 
https://groups.google.com/d/msgid/golang-nuts/CALWqRZpziVRJ_9ifRXNEzhGk8negv7xbjwZod24sSbcuvt9KQQ%40mail.gmail.com.

Reply via email to