You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I understood correctly, all of these libraries implements the same behaviour: they convert static files into arrays of bytes and saves them into .go files. Then compiles application with these files so they can be accessible from the memory when the program runs. To access files content one can use an implementation of the http.FileSystem interface like in the following example of the packr library.
I can change the type of the Storage.OutputDir to http.FileSystem to initialize new storage as storage, err := NewStorage(box). But http.FileSystem doesn't allow to list files in directory or get directory's path. Thus Storage.CollectStatic method will not work.
The only chance to make it work is to limit the workflow to the single use case:
Collect static to output dir with the cli tool collectstatic --output output/staticfiles --input input/assets
Embed output/staticfiles with packr or similar tool
But this implementation is very limited. It will not be possible to use storage.CollectStatic, storage directories listing will not work and also will not be possible to disable storage.Enabled. On the other hand storage.Resolve will work as expected.
I think a good plus would be the embedding of files in go with some of these projects: https://github.com/avelino/awesome-go/blob/master/README.md#resource-embedding.
None of those projects has an hashing system/strategy as far as I know.
The text was updated successfully, but these errors were encountered: