图片文件夹的更短路径-Golang

I have a solution that works, but I want to fine tune it and at the same time understand how it works.

Here is my folder structure:

web/
├── main.go
└── public/
      ├── css/
      ├── js/
      ├── img/
      │    └── pict.jpg
      └── templates/

The current path that works to get a picture is:

<img src="public/img/pict.jpg"></a>

The desired path to get a picture is (I want to skip the public/ part):

<img src="img/pict.jpg"></a>

The relevant go code:

func main() {
    http.HandleFunc("/", index)
    http.Handle("/public/", http.StripPrefix("/public/", http.FileServer(http.Dir("./public"))))
    http.ListenAndServe(":8080", nil)
}

The same short path should also apply on css and js folder. TIA!

Try this: downside is you need to repeat this for each sub-directory

http.HandleFunc("/", index)

http.Handle("/img/",
    http.StripPrefix("/img/", http.FileServer(http.Dir("./public/img"))))
http.Handle("/css/",
    http.StripPrefix("/css/", http.FileServer(http.Dir("./public/css"))))

// ... etc.