Coder Social home page Coder Social logo

Comments (5)

cryptix avatar cryptix commented on May 28, 2024

👍 also stumbled over this.

from counterfeiter.

ljfranklin avatar ljfranklin commented on May 28, 2024

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.

devoid avatar devoid commented on May 28, 2024

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.

tjarratt avatar tjarratt commented on May 28, 2024

@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.

joefitzgerald avatar joefitzgerald commented on May 28, 2024

Is this still an issue in v6.0.0?

from counterfeiter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.