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

assetFS is not exportable #45

Open
Pechenn opened this issue Oct 18, 2016 · 3 comments
Open

assetFS is not exportable #45

Pechenn opened this issue Oct 18, 2016 · 3 comments

Comments

@Pechenn
Copy link

Pechenn commented Oct 18, 2016

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()))

@kmanley
Copy link

kmanley commented Oct 17, 2017

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

@tsraza
Copy link

tsraza commented Dec 15, 2017

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())))

@joegasewicz
Copy link
Contributor

Whats the status on this issue?

joegasewicz added a commit to ONSdigital/go-bindata-assetfs that referenced this issue Apr 12, 2022
joegasewicz added a commit to ONSdigital/go-bindata-assetfs that referenced this issue Apr 12, 2022
joegasewicz added a commit to ONSdigital/go-bindata-assetfs that referenced this issue Apr 12, 2022
elazarl added a commit that referenced this issue Apr 12, 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

4 participants