Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose whether build in debug mode #31

Closed
josharian opened this issue May 17, 2020 · 7 comments
Closed

expose whether build in debug mode #31

josharian opened this issue May 17, 2020 · 7 comments

Comments

@josharian
Copy link

Use case: I have go templates as assets. In debug mode, I want to re-parse the template every time, in case it has changed. In non-debug mode, I want to parse only once. This decision and the code around it can't be done in go-bindata (unless you want to add template parsing helpers into the generated code). So I propose we add a AssetDebug() bool function or the like to the generated code.

@kevinburke
Copy link
Owner

Sure... why a function instead of a constant, is the idea that someone else could change a constant?

@kevinburke
Copy link
Owner

kevinburke commented May 17, 2020

I suspect this use case might come up again so it might be good to either have a BuildInfo() struct or function that we can add e.g. compile time etc. to, as well as debug/non-debug.

@josharian
Copy link
Author

A constant seems fine. I was just not thinking clearly.

@josharian
Copy link
Author

Thanks for the fix! I was going to send a PR but delighted you beat me to it.

One thought: should it be called AssetDebug or the like? Debug might conflict with existing identifiers in peoples packages.

@kevinburke
Copy link
Owner

kevinburke commented May 18, 2020 via email

@kevinburke
Copy link
Owner

kevinburke commented May 18, 2020 via email

@josharian
Copy link
Author

I guess it depends on whether people generate code into a separate package or directly into their own. Since the default package path is main, not asset, I assume that that is common. Maybe I’m wrong though.

kssion pushed a commit to kssion/go-bindata that referenced this issue Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants