Closed GoogleCodeExporter closed 9 years ago
Hmm. I suspect that's a Windows problem.
Can you see what other files are created in that directory?
Original comment by dsymo...@golang.org
on 1 Apr 2013 at 9:52
The directory doesn't seems to exist after mockgen exits.
C:\Users\Bruno>mockgen net/http Client
2013/04/01 17:54:55 Loading input failed: exec:
"C:\\Users\\Bruno\\AppData\\Local\\Temp\\gomock_reflect_736510951\\prog.bin":
file does not exist
C:\Users\Bruno>dir
C:\\Users\\Bruno\\AppData\\Local\\Temp\\gomock_reflect_736510951
Le chemin d’accès spécifié n'est pas valide.
(the last line mean the directory doesn't exists)
Original comment by bigras.b...@gmail.com
on 1 Apr 2013 at 9:58
Can you try one more thing for me? (sorry, I don't have easy access to a
Windows machine)
Wherever gomock has been installed (probably
$GOPATH/src/code.google.com/p/gomock), edit mockgen/reflect.go, find the line
that says
defer func() { os.RemoveAll(tmpDir) }()
and delete or comment it out. Then run
go install code.google.com/p/gomock/mockgen
and try again? The temporary directory should be left behind so we can see
what's going wrong.
Original comment by dsymo...@golang.org
on 1 Apr 2013 at 10:03
Without the defer, I got 'prog.bin' and 'prog.go' in the directory.
I played a bit with the code and I was able to temporary fix it by changing :
const progBinary = "prog.bin"
to:
const progBinary = "prog.bin.exe"
It seems Run() whine if it doesn't think the file is an executable.
Now I got :
C:\Users\Bruno>mockgen net/http Client
Reflection: http.Client is not an interface
2013/04/01 18:28:48 Loading input failed: exit status 1
C:\Users\Bruno>C:\Users\Bruno\AppData\Local\Temp\gomock_reflect_132250887\prog.b
in.exe
Reflection: http.Client is not an interface
How can I mock http.Client (without using httptest)?
Original comment by bigras.b...@gmail.com
on 1 Apr 2013 at 10:32
I've got a fix on the way for the filename extension muck. Thanks for helping
debug that.
mockgen only produces mocks for interfaces. http.Client isn't an interface.
Depending on what you are trying to test, you might want to mock
http.RoundTripper instead, and plug that into a real http.Client.
Original comment by dsymo...@golang.org
on 2 Apr 2013 at 2:53
Ok, thanks!
Original comment by bigras.b...@gmail.com
on 2 Apr 2013 at 2:57
This issue was closed by revision 25dd25bab010.
Original comment by dsymo...@golang.org
on 2 Apr 2013 at 10:55
Thanks!
Original comment by bigras.b...@gmail.com
on 2 Apr 2013 at 10:58
Original issue reported on code.google.com by
bigras.b...@gmail.com
on 1 Apr 2013 at 8:35