clipperhouse / gen

Type-driven code generation for Go
http://clipperhouse.com/gen/overview/
Other
1.43k stars 90 forks source link

Bug when _test.go files contains package_test as package name #86

Closed SchumacherFM closed 8 years ago

SchumacherFM commented 9 years ago

Nice project! :+1:

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?

clipperhouse commented 9 years ago

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

SchumacherFM commented 9 years ago

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.

clipperhouse commented 9 years ago

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

SchumacherFM commented 9 years ago
$ 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?

SchumacherFM commented 8 years ago

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

redbaron commented 7 years ago

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

SchumacherFM commented 7 years ago

I wrote my own internal code gen stuff ;-)