Coder Social home page Coder Social logo

Comments (3)

davidje13 avatar davidje13 commented on May 27, 2024

This issue can be worked around by adding multiple folders to the GOPATH, but since "/src" is appended to each folder, it is not a perfect solution for the standard vendor folder.

The best workaround I have found so far:

mkdir vendor_gopath
mv vendor vendor_gopath/src # Note: cannot symlink this, since the symlink will not be followed
# GOPATH must be absolute, and make vendor take priority by listing it first
GOPATH="$(pwd)/vendor_gopath/src:$GOPATH" go generate <...>
mv vendor_gopath/src vendor
rm -rf vendor_gopath

Pretty ugly; it makes a new folder structure which is compatible with the idea of a gopath and temporarily moves the vendor folders into it. Counterfeiter is then able to run correctly. Can be made a bit safer by using exit hooks in a script, etc. But still not great.

Looks like this could be fixed by changing locator/locator.go's goSourcePaths method to include any vendor folders which are in an ancestor folder of the file being operated on. Doesn't seem like a trivial change since nothing in that source currently knows the path of the file.

from counterfeiter.

tjarratt avatar tjarratt commented on May 27, 2024

Didn't mean to close this so abruptly.

I just verified manually that the repo you lovingly created to demonstrate this problem works now; once counterfeiter is updated, you can go generate even without the github.com/ory-am/fosite package on your GOPATH, which is pretty neat.

All credit to @sykesm for contributing the fix, all I did was tap a button.

Can you verify this works for you @beatrichartz? I could close this now, but I generally don't like to close issues on behalf of a reporter; it feels rude to me because as an end user, you should have the ultimate say in whether or not software works for you.

from counterfeiter.

beatrichartz avatar beatrichartz commented on May 27, 2024

@tjarratt thanks and apologies for the late reply, did only just see this in notifications. The example works now, awesome.

@seadowg did you see this ^^ ?

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.