GithubHelp home page GithubHelp logo

Comments (10)

GeertJohan avatar GeertJohan commented on June 2, 2024

Hi brian,

Can you share the code that you use to test?

/GeertJohan

from go.rice.

bfallik avatar bfallik commented on June 2, 2024

Unfortunately I can't, it's not open source. I can try to come up with a smaller test case or help answer any specific questions you might have.

I just uncovered another data point. If I compile the test binary (go test -c pkgname) and then run it (./src/pkgname/pkgname.test) I encounter the same panic. Since the backtraces are the same I suspect that the -coverprofile flag causes similar behavior to go test -c pkgname && ./src/pkgname/pkgname.test.

brian

from go.rice.

GeertJohan avatar GeertJohan commented on June 2, 2024

I think the error that results in a panic is from this call: https://github.com/GeertJohan/go.rice/blob/master/box.go#L55

Probably the runtime.Caller(3) frame returns a path that doesn't exist anymore because it was temporarily created for the test build. Maybe we can detect this and resolve the correct path?

Buy you're saying it also fails when you embed the code in go source.. This is strange, because then the panic should not occur. Is it possible that the panic or failure occuring with rice embed-ed version is different from the one you posted?

from go.rice.

bfallik avatar bfallik commented on June 2, 2024

Interesting.

It does seem like the panic() is caused by stat() since the error text is "panic: stat datastore/_test/_obj_test/sql: no such file or directory".

I'm not exactly sure how to provide more info. It's possible I saw different panics but I'm not able to differentiate them now. If I remove the embedded code (rm src/pkgname/*.sql-box.go) I still see the same error. Is there a way to determine if rice is using the embedded data vs. the local files? Is there a way to force it to use one or the other?

I wonder if I should add some debugging code to findBox() to see what's going on?

brian

from go.rice.

bfallik avatar bfallik commented on June 2, 2024

Geert-Johan,

I've added some print debugging to findBox() and it seems like len(embedded.EmbeddedBoxes) is always 0, so I'm a bit confused. I'm running 'rice embed' inside the package dir, which generates a file sql.rice-box.go that seems to contain the binary data. I would expect 'go test' to embed the contents of this file automatically since it's just go source code but I can't find any evidence of that.

from go.rice.

GeertJohan avatar GeertJohan commented on June 2, 2024

Can you try renaming to sql_rice-box.go? I think it's not recognizing the source file for test..

from go.rice.

GeertJohan avatar GeertJohan commented on June 2, 2024

In which case I'll update rice to use underscore instead of dot.. I have already been thinking about that recently.. So please let me know if that works.

from go.rice.

bfallik avatar bfallik commented on June 2, 2024

No, that didn't work either. I even tried renaming the file to box.go.

Any suggestions on how to debug this further? Can I inspect the binary to see which boxes are embedded? Can I debug the build process to understand why the generated code doesn't seem to be included?

from go.rice.

bfallik avatar bfallik commented on June 2, 2024

OK, I've determine this issue is in our build. I believe it's related to how we're vendoring our third-party dependencies. Feel free to close this issue if you'd like.

from go.rice.

GeertJohan avatar GeertJohan commented on June 2, 2024

Okay :)

from go.rice.

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.