-
Notifications
You must be signed in to change notification settings - Fork 117
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
Add support for AssetInfo #23
Conversation
Currently only uses `ModTime` from `AssetInfo`.
I think this will currently break the API of anyone relying on Motivation: Currently the modtime returned is the time of the binary starting. If you have two instances behind a reverse-proxy they will return different modtimes. This causes cache control headers to frequently invalidate. |
I could be wrong, but it seems unlikely that there would be code relying on It would break if using unkeyed composite literals, but not if using field-keyed syntax. It's not up to me to make API decisions here, but it seems like a reasonable and favorable change. The implementation details LGTM. |
@elazarl ping |
Add support for AssetInfo, custom file info function
@keegancsmith thanks, apologize for the delay. Sounds like a good idea. |
Just FYI: This causes a runtime error if you don't specify AssetInfo when creating the struct, and later try to access the data. |
Just adding a note here for anyone who comes looking for this answer: if you start seeing panics after this change, it could be that you need to re-generate and update the output of
|
Hmm... I was assuming that people who update their go-bindata-assetfs dir, Do you think it's better to revert this change? I'm not sure. On Fri, Dec 25, 2015 at 5:04 AM, Ryan Uber [email protected] wrote:
|
@@ -137,7 +144,11 @@ func (fs *AssetFS) Open(name string) (http.File, error) { | |||
name = name[1:] | |||
} | |||
if b, err := fs.Asset(name); err == nil { | |||
return NewAssetFile(name, b), nil | |||
timestamp := defaultFileTimestamp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add something like this here, to prompt people to re-generate:
if fs.AssetInfo == nil {
log.Fatalln("go-bindata-assetfs: you're using a new version of the library but haven't re-generated the file, so it's not compatible; regenerate to avoid this problem")
}
Or something like that.
Currently only uses
ModTime
fromAssetInfo
.