Ah, that's 2nd condition to use tests in package with the "_test"
as package, which I've forgotten.
Thanks!
On Monday, April 29, 2019 at 9:04:15 PM UTC-4, vaastav anand wrote:
>
> The issue is that you have multiple package names in the same folder. In
> this specific case it is easygen and easygen_test.
> You should have 1 package per folder.
> The reason your test files did not raise this issue is because _test.go
> files are automatically excluded when packages are being compiled. But its
> not the same case with _execute.go files
>
> On Monday, 29 April 2019 16:18:29 UTC-7, sunto...@gmail.com wrote:
>>
>> What does the following error really means?
>>
>> can't load package: package ./.: found packages easygen (config.go) and
>> easygen_test (example_execute.go) in /path/to/go-easygen/easygen
>> cmd/easygen/flags.go:12:2: found packages easygen (config.go) and
>> easygen_test (example_execute.go) in /path/to/src/
>> github.com/go-easygen/easygen
>>
>> I'm been adding example tests to my package using the "_test"
>> as package without any problem. However, the one I've just added,
>>
>> https://github.com/go-easygen/easygen/blob/master/example_execute.g0
>>
>> gives me errors now. and I have no idea why.
>>
>> Here is how to duplicate the problem.
>> WIthin the `go-easygen/easygen` folder:
>>
>>
>> $ go test ./...
>> ok _/path/to/go-easygen/easygen (cached)
>> ok _/path/to/go-easygen/easygen/cmd/easygen (cached)
>> ok _/path/to/go-easygen/easygen/egCal(cached)
>> ok _/path/to/go-easygen/easygen/egVar(cached)
>>
>>
>> $ mv example_execute.g0 example_execute.go
>>
>>
>> $ go test ./...
>> can't load package: package ./.: found packages easygen (config.go) and
>> easygen_test (example_execute.go) in /path/to/go-easygen/easygen
>> cmd/easygen/flags.go:12:2: found packages easygen (config.go) and
>> easygen_test (example_execute.go) in /path/to/src/
>> github.com/go-easygen/easygen
>>
>>
>> $ head -1 example_test.go > /tmp/f1
>>
>>
>> $ head -1 example_execute.go > /tmp/f2
>>
>>
>> $ diff /tmp/f1 /tmp/f2 && echo same
>> same
>>
>>
>>
>> Please help. Thx!
>>
>>
>>
--
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.
For more options, visit https://groups.google.com/d/optout.