Comments (10)
Hi brian,
Can you share the code that you use to test?
/GeertJohan
from go.rice.
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.
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.
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.
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.
Can you try renaming to sql_rice-box.go? I think it's not recognizing the source file for test..
from go.rice.
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.
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.
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.
Okay :)
from go.rice.
Related Issues (20)
- golang:alpine can not install HOT 1
- Dockerize rice binary HOT 1
- Get fails on Ubuntu 16.04 HOT 5
- Nested html templates. HOT 4
- How to run rice from vendor folder?
- How to link CSS with template in box
- Getting rice-box.go file with byte Array instead of string. HOT 2
- github.com/akavel/rsrc dependency has removed coff.NewRDATA HOT 9
- "rice:command not found" after exec the two go get command HOT 1
- Problems with paths HOT 1
- Asset loading race condition causes unexpected panic
- lotus-miner and lotus-worker installation step error HOT 1
- rice append violates Mach-O file format
- Able to skip overwrite or omit creation/modification time in embed-go
- `rice embed-go` doesn't work for go modules beyond v1?
- Report a coding bug about unused result
- Improvement to the README file
- Go install doesn't work HOT 3
- use go install instead of go get
- Dependency daaku/[email protected] incompatible with Go 1.19 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 go.rice.