Comments (5)
👍 also stumbled over this.
from counterfeiter.
We also ran into this. Any ideas on how we might fix this? We could change the package or the imports, but we'd rather not do either, as the package we're counterfeiting is purposely named the same as the package it imports as we are shadowing. e.g.
package sql
import (
"database/sql"
)
type DB interface {
Exec(query string, args ...interface{}) (sql.Result, error)
Query(query string, args ...interface{}) (Rows, error)
}
from counterfeiter.
Running into this issue as well. A simple solution would be to allow counterfeiter to generate a source file within the same package as the counterfeited interface. Is there any particular reason that the "${pkgname}/fakes" package was chosen?
from counterfeiter.
@devoid mypackagename/fakes
was chosen because it's separate from your implementation and it's fairly clear what is inside there. It's a good idea to keep your test doubles and test helpers separate from your actual code. Check out net/http
and net/http/httptest
in the standard library for some inspiration there.
That said, I think that this should be fixed. Any takers? Would love to help anyone that wants to work on a PR for this.
from counterfeiter.
Is this still an issue in v6.0.0?
from counterfeiter.
Related Issues (20)
- Support overriding destination package name and type naming template in "-generate" call HOT 5
- Support for DoThingsCallsOnCall(callCount, stub ...) similar to DoThingsReturnsOnCall(callCount)
- How to use shorthand generate directive for external packages? HOT 1
- cannot find GOROOT directory HOT 1
- Go 1.18 generics HOT 8
- cannot write tests in package being tested due to import cycle
- [CVE-2020-11022] Update of counterfeiter/v6 needed HOT 2
- Homebrew: Does not complete test on Go 1.20rc1 HOT 4
- disable CircleCI HOT 2
- cannot use json.Marshal(h) (value of type []byte) as driver.Value value in return statement HOT 1
- Support for callback func stub? HOT 1
- Cannot regenerate fakes if they are relied upon and deleted - go1.19.10 HOT 1
- About the latest release HOT 6
- Allow setting destination package name independent of directory name
- Excessive memory usage when generating multiple fakes with `counterfeiter:generate` directives.
- Counterfeiter does not generate private interface methods (used in `grpc-go`) HOT 1
- generation fails when interfaces are declared in a type block.
- Generate doesn't import packages referenced in type args
- Import cycle is not allowed in test
- Support Go 1.22 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from counterfeiter.