mbinge / gomock

Automatically exported from code.google.com/p/gomock
Apache License 2.0
0 stars 0 forks source link

Provide a decent example use #3

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Can we get a good example in the repository?  The code in the sample/ dir 
doesn't compile properly:

1001)~ % cd Software/go/src/pkg/gomock.googlecode.com/hg/sample 
1002)hg/sample % mockgen --source user.go
2011/09/30 20:18:38 Can't deduce package for a *ast.ChanType
1003)

I'm trying to figure out how to get this to work with my own code, but without 
any real working example, the sparse documentation makes using this package 
quite a challenge.

Original issue reported on code.google.com by seanerussell on 1 Oct 2011 at 12:29

GoogleCodeExporter commented 9 years ago
Grr.  This was supposed to be a feature request, not a defect.  Sorry.

Original comment by seanerussell on 1 Oct 2011 at 12:37

GoogleCodeExporter commented 9 years ago
No worries.

Can you check whether your gomock is actually up to date, and the mockgen 
binary you are invoking is up to date too? The ast.ChanType thing is something 
that I thought I fixed a while back.

Even with that, though, the sample won't work out of the box because of the 
imports, unless you install the sample package. If you comment out all the 
non-standard imports in user.go then it should work fine, though.

Original comment by dsymo...@golang.org on 1 Oct 2011 at 2:05

GoogleCodeExporter commented 9 years ago
Perhaps it would be possible to add the mock files to the sample Makefile? This 
might allow it to clean build, and would be the equivalent of: 

mock_user.go : user.go
    mockgen --destination=$@ --source=$^

user_test.go : mock_user.go

Original comment by awre...@gmail.com on 3 Oct 2011 at 10:53