package static import ( "io/fs" "net/http" "git.gabrielgio.me/cerrado/static" ) func ServeStaticHandler() (func(w http.ResponseWriter, r *http.Request), error) { staticFs, err := fs.Sub(static.Static, ".") if err != nil { return nil, err } return func(w http.ResponseWriter, r *http.Request) { f := r.PathValue("file") http.ServeFileFS(w, r, staticFs, f) }, nil }