If anyone's curious I've already devised a patch and submitted a PR to add
hooks for styling directory pages served from http.FileServer(): (no
warranty, of course)

https://github.com/Russtopia/go/commit/ff2a26eee79f8c9338c94c30d2fa1d2b9934daf6

-R.

On Fri, 25 Jan 2019 at 18:46, Russtopia <rma...@gmail.com> wrote:

> Hi all,
>
> I'm doing an app which serves out its own endpoints via http.HandleFunc()
> and so on, and of course it's easy to customize the content and layout of
> these endpoints; but I also server out some filesystem trees using
> http.FileServer().
>
> This unfortunately seems to restrict one to the very plain-vanilla output
> for directories hardcoded within the un-exposed dirList() function within
> fs.go.
>
> https://golang.org/src/net/http/fs.go?s=20537:20577#L598
>
> Is there a clever go way of extending net/http just to change dirList(),
> without duplicating most of its code?
>
> If only dirList() were enhanced to check for an optionally-set user
> override func(), calling that instead when specified, anyone could easily
> style their fileservers' directory views. I'm not proposing bringing
> templates into net/http -- it would be the user's responsibility to use
> such things in their custom handlers, if desired.
>
> Any ideas of another way to do this short of cloning net/http and internal
> dependencies?
>
> -Russ
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to