mirror of
https://github.com/docker/cli.git
synced 2026-01-13 18:22:35 +03:00
Merge pull request #13500 from HuKeping/cleanup
Remove unused code Upstream-commit: 3f66f6f2f066d46f554deec55284377ee726a028 Component: engine
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -275,26 +274,6 @@ type FileServer struct {
|
||||
*httptest.Server
|
||||
}
|
||||
|
||||
func fileServer(files map[string]string) (*FileServer, error) {
|
||||
var handler http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
|
||||
if filePath, found := files[r.URL.Path]; found {
|
||||
http.ServeFile(w, r, filePath)
|
||||
} else {
|
||||
http.Error(w, http.StatusText(404), 404)
|
||||
}
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
if _, err := os.Stat(file); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
server := httptest.NewServer(handler)
|
||||
return &FileServer{
|
||||
Server: server,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// randomUnixTmpDirPath provides a temporary unix path with rand string appended.
|
||||
// does not create or checks if it exists.
|
||||
func randomUnixTmpDirPath(s string) string {
|
||||
|
||||
Reference in New Issue
Block a user