Hi there,
I have been testing the (relatively) new go:embed feature for a few days and I came across this situation which I wasn't quite sure what was causing it so I thought asking here would help.
Consider the following code:
```golang
package main
import (
"embed"
"fmt"
"log"
"net/http"
)
//go:embed files/static
var static embed.FS
func main() {
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(static))))
log.Fatal(http.ListenAndServe(":8000", nil))
}
```
Now the files in directory files/static are very much accessible but the issue I seem to have is that it was accessible under the url /static/files/static/filename instead of just being accessible through /static/filename where filename exists inside the directory files/static/
I tried looking up some examples online and it seems that I have to use the fs.FS and fs.Sub and only expose (not sure if this is correct terminology) the new fs.Sub which would mitigate the issue I was having.
My question is about the reason why the Go team went with this implementation? Because in the above program I wasn't able to access the files in files/ directory even though there were files in it and was only able to access files inside the files/static files directory. So there doesn't seem to be a point in this implementation unless I'm missing something, and I'm sure its the latter case haha. If anyone knows about why they went with this implementation, I would be very grateful.
Best wishes
Taj