As far as I see, it's a dead code.
Signed-off-by: Hu Keping <hukeping@huawei.com>
| ... | ... |
@@ -7,7 +7,6 @@ import ( |
| 7 | 7 |
"errors" |
| 8 | 8 |
"fmt" |
| 9 | 9 |
"io" |
| 10 |
- "net/http" |
|
| 11 | 10 |
"net/http/httptest" |
| 12 | 11 |
"os" |
| 13 | 12 |
"os/exec" |
| ... | ... |
@@ -275,26 +274,6 @@ type FileServer struct {
|
| 275 | 275 |
*httptest.Server |
| 276 | 276 |
} |
| 277 | 277 |
|
| 278 |
-func fileServer(files map[string]string) (*FileServer, error) {
|
|
| 279 |
- var handler http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
|
|
| 280 |
- if filePath, found := files[r.URL.Path]; found {
|
|
| 281 |
- http.ServeFile(w, r, filePath) |
|
| 282 |
- } else {
|
|
| 283 |
- http.Error(w, http.StatusText(404), 404) |
|
| 284 |
- } |
|
| 285 |
- } |
|
| 286 |
- |
|
| 287 |
- for _, file := range files {
|
|
| 288 |
- if _, err := os.Stat(file); err != nil {
|
|
| 289 |
- return nil, err |
|
| 290 |
- } |
|
| 291 |
- } |
|
| 292 |
- server := httptest.NewServer(handler) |
|
| 293 |
- return &FileServer{
|
|
| 294 |
- Server: server, |
|
| 295 |
- }, nil |
|
| 296 |
-} |
|
| 297 |
- |
|
| 298 | 278 |
// randomUnixTmpDirPath provides a temporary unix path with rand string appended. |
| 299 | 279 |
// does not create or checks if it exists. |
| 300 | 280 |
func randomUnixTmpDirPath(s string) string {
|