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

assetFS is not exportable

Open Pechenn opened this issue 8 years ago • 3 comments

assetFS is not exportable. so i do : go-bindata-assetfs -pkg res resources/.. then in generated bindata_assetfs.go i changing assetFS to AssetFS and using it like import {... "bindata_assetfs" } http.Handle("/resources", http.FileServer(res.AssetFS()))

Pechenn avatar Oct 18 '16 15:10 Pechenn

I'm doing the same. Don't see why assetFS is not exported...

kmanley avatar Oct 17 '17 14:10 kmanley

it's not so bad. you can export it from the same file you generate it:

//go:generate go-bindata-assetfs -pkg swagger swagger/...

package swagger

import assetfs "github.com/elazarl/go-bindata-assetfs"

func AssetFS() *assetfs.AssetFS {
	return assetFS()
}

then serve it from your package

webServer.Handle("/swagger/", http.FileServer(swagger.AssetFS()))

the actual fileserver doesn't seem to work for me though :/

edit: fixed it. serve one folder of the same name. could probably use -prefix as well

webServer.Handle("/swagger/", http.StripPrefix("/swagger/", http.FileServer(swagger.AssetFS())))

tsraza avatar Dec 15 '17 18:12 tsraza

Whats the status on this issue?

joegasewicz avatar Apr 12 '22 12:04 joegasewicz