go-bindata-assetfs icon indicating copy to clipboard operation
go-bindata-assetfs copied to clipboard

Protecting users of obsolete API (pre AssetInfo)

Open peterhoward42 opened this issue 8 years ago • 0 comments

I wonder if you would consider a change to AssetFS to protect others from a problem I had, and took quite a while for me to find the root cause?

I have a project that used your older API (without the AssetInfo field).

http.Handle("/", http.FileServer( &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir}))

My project still compiled fine with the newer versions of AssetFS code despite what is now a missing initialiser, but hits a null pointer error at run time at line 148 in assetfs.go with this:

if info, err := fs.AssetInfo(name); err == nil {

All fine now I updated my call of course, but shame to require others who hit the same problem to dig into AssetFS source to work out what's happening.

Pete

peterhoward42 avatar Jun 14 '16 22:06 peterhoward42