-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading Input Failed: prog.go:14:2: use of internal package not allowed #64
Comments
Hi @relnod, This won't work. The point of internal packages is that other packages do not get access to them. That includes their interfaces. Hence, you cannot generate a mock for those. If you own that package yourself, you can move it out of I hope this helps, |
Hi @petergtz , |
Hi @relnod, Hm, I guess I'm having difficulties to really understand your use case. Could you provide a sample setup so I can reproduce this? Definitely agree that an error would be better than a panic. Will improve that once I can reproduce your problem. |
Hi, I got the following error when generating mocks outside of the GOPATH:
panic: Loading input failed: exit status 1 caused by:
prog.go:14:2: use of internal package not allowed
goroutine 1 [running]:
github.com/petergtz/pegomock/pegomock/filehandling.GenerateMockSourceCode(0xc42000c5c0, 0x2, 0x2, 0x7fff0d647602, 0x4, 0x0, 0x0, 0xc420000100, 0x7a84a0, 0xc420098010, ...)
/home/----/go/src/github.com/petergtz/pegomock/pegomock/filehandling/filehandling.go:108 +0x5c4
github.com/petergtz/pegomock/pegomock/filehandling.GenerateMockFile(0xc42000c5c0, 0x2, 0x2, 0x7fff0d6475ed, 0xa, 0x7fff0d647602, 0x4, 0x0, 0x0, 0x0, ...)
/home/----/go/src/github.com/petergtz/pegomock/pegomock/filehandling/filehandling.go:62 +0xc3
github.com/petergtz/pegomock/pegomock/filehandling.GenerateMockFileInOutputDir(0xc42000c5c0, 0x2, 0x2, 0xc42001a0f4, 0x20, 0x7fff0d6475ed, 0xa, 0x7fff0d647602, 0x4, 0x0, ...)
/home/----/go/src/github.com/petergtz/pegomock/pegomock/filehandling/filehandling.go:39 +0x162
main.Run(0xc4200a0000, 0x8, 0x8, 0x7a84a0, 0xc420098010, 0xc42013c000, 0xc4200200c0)
/home/----/go/src/github.com/petergtz/pegomock/pegomock/main.go:80 +0x160a
main.main()
/home/----/go/src/github.com/petergtz/pegomock/pegomock/main.go:35 +0x90
It does work with a non internal package and it also works perfectly when I'm generating the mocks in the normal package (inside GOPATH).
The text was updated successfully, but these errors were encountered: