clipperhouse/gen

Bug when _test.go files contains package_test as package name

SchumacherFM opened this issue · 7 comments

Nice project! 👍

My package utils contains test files with the package name utils_test to test the public API.

File stringSlice.go contains e.g.:

// +gen slice:"Where,Count,GroupBy[int64]"
type Int64Slice []int64

Running then gen gives me the following error:

stringSlice_test.go:20:2: could not import github.com/project/csfw/utils (can't find import: github.com/project/csfw/utils)

Renaming util_test to utils and then running gen does work. But I don't want to do that.

Am I doing something wrong?

It’s likely I haven’t tested with test packages having different names. Can you point to your code so I can repro?

That is the package https://github.com/corestoreio/csfw/tree/master/utils
You can run tests inside the package utils without setting up anything.
Running gen will of course fail.

Sorry for the late response – am not getting a repro here. @SchumacherFM

$ go get github.com/corestoreio/csfw
$ cd $GOPATH/src/github.com/corestoreio/csfw/utils
$ gen
Int64Slice_test.go:20:2: could not import github.com/corestoreio/csfw/utils (can't find import: github.com/corestoreio/csfw/utils)

Can you now reproduce it?

Won't fix - it's an internal "Go bug"

@SchumacherFM , I see same problem, could you please share what it was caused with and maybe possible workarounds you found?

I wrote my own internal code gen stuff ;-)