Closed mgabeler-lee-6rs closed 3 years ago
go.mod:
module example go 1.16 require github.com/stretchr/testify v1.7.0 // indirect
example.go:
package example func Foo(in string) string { return in }
run: gotests -template testify -only '^Foo$' ./example.go
gotests -template testify -only '^Foo$' ./example.go
Output:
package example import ( "testing" "gotest.tools/assert" ) func TestFoo(t *testing.T) { // ... }
Note the import of assert from the wrong package.
assert
If I run go clean -modcache, and then go mod download and then run gotests again, it generates the proper imports.
go clean -modcache
go mod download
gotests
The output of this tool should not be broken by the presence of unrelated packages in the module cache.
It's because of how the imports process works, and testify clearly not provided. I guess I will fix this as part of #152 as it also affects my tests alongside of #154
testify
go.mod:
example.go:
run:
gotests -template testify -only '^Foo$' ./example.go
Output:
Note the import of
assert
from the wrong package.If I run
go clean -modcache
, and thengo mod download
and then rungotests
again, it generates the proper imports.The output of this tool should not be broken by the presence of unrelated packages in the module cache.