Browse code

Merge pull request #14785 from brahmaroutu/lint_api_server

fix golint errors/warnings

Tibor Vass authored on 2015/07/30 02:09:31
Showing 9 changed files
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"github.com/gorilla/mux"
10 10
 )
11 11
 
12
-func ProfilerSetup(mainRouter *mux.Router, path string) {
12
+func profilerSetup(mainRouter *mux.Router, path string) {
13 13
 	var r = mainRouter.PathPrefix(path).Subrouter()
14 14
 	r.HandleFunc("/vars", expVars)
15 15
 	r.HandleFunc("/pprof/", pprof.Index)
... ...
@@ -40,7 +40,8 @@ import (
40 40
 	"github.com/docker/docker/utils"
41 41
 )
42 42
 
43
-type ServerConfig struct {
43
+// Config provides the configuration for the API server
44
+type Config struct {
44 45
 	Logging     bool
45 46
 	EnableCors  bool
46 47
 	CorsHeaders string
... ...
@@ -49,15 +50,17 @@ type ServerConfig struct {
49 49
 	TLSConfig   *tls.Config
50 50
 }
51 51
 
52
+// Server contains instance details for the server
52 53
 type Server struct {
53 54
 	daemon  *daemon.Daemon
54
-	cfg     *ServerConfig
55
+	cfg     *Config
55 56
 	router  *mux.Router
56 57
 	start   chan struct{}
57 58
 	servers []serverCloser
58 59
 }
59 60
 
60
-func New(cfg *ServerConfig) *Server {
61
+// New returns a new instance of the server based on the specified configuration.
62
+func New(cfg *Config) *Server {
61 63
 	srv := &Server{
62 64
 		cfg:   cfg,
63 65
 		start: make(chan struct{}),
... ...
@@ -67,6 +70,7 @@ func New(cfg *ServerConfig) *Server {
67 67
 	return srv
68 68
 }
69 69
 
70
+// Close closes servers and thus stop receiving requests
70 71
 func (s *Server) Close() {
71 72
 	for _, srv := range s.servers {
72 73
 		if err := srv.Close(); err != nil {
... ...
@@ -80,9 +84,9 @@ type serverCloser interface {
80 80
 	Close() error
81 81
 }
82 82
 
83
-// ServeApi loops through all of the protocols sent in to docker and spawns
83
+// ServeAPI loops through all of the protocols sent in to docker and spawns
84 84
 // off a go routine to setup a serving http.Server for each.
85
-func (s *Server) ServeApi(protoAddrs []string) error {
85
+func (s *Server) ServeAPI(protoAddrs []string) error {
86 86
 	var chErrors = make(chan error, len(protoAddrs))
87 87
 
88 88
 	for _, protoAddr := range protoAddrs {
... ...
@@ -117,19 +121,27 @@ func (s *Server) ServeApi(protoAddrs []string) error {
117 117
 	return nil
118 118
 }
119 119
 
120
-type HttpServer struct {
120
+// HTTPServer contains an instance of http server and the listener.
121
+// srv *http.Server, contains configuration to create a http server and a mux router with all api end points.
122
+// l   net.Listener, is a TCP or Socket listener that dispatches incoming request to the router.
123
+type HTTPServer struct {
121 124
 	srv *http.Server
122 125
 	l   net.Listener
123 126
 }
124 127
 
125
-func (s *HttpServer) Serve() error {
128
+// Serve starts listening for inbound requests.
129
+func (s *HTTPServer) Serve() error {
126 130
 	return s.srv.Serve(s.l)
127 131
 }
128
-func (s *HttpServer) Close() error {
132
+
133
+// Close closes the HTTPServer from listening for the inbound requests.
134
+func (s *HTTPServer) Close() error {
129 135
 	return s.l.Close()
130 136
 }
131 137
 
132
-type HttpApiFunc func(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error
138
+// HTTPAPIFunc is an adapter to allow the use of ordinary functions as Docker API endpoints.
139
+// Any function that has the appropriate signature can be register as a API endpoint (e.g. getVersion).
140
+type HTTPAPIFunc func(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error
133 141
 
134 142
 func hijackServer(w http.ResponseWriter) (io.ReadCloser, io.Writer, error) {
135 143
 	conn, _, err := w.(http.Hijacker).Hijack()
... ...
@@ -153,8 +165,8 @@ func closeStreams(streams ...interface{}) {
153 153
 	}
154 154
 }
155 155
 
156
-// Check to make sure request's Content-Type is application/json
157
-func checkForJson(r *http.Request) error {
156
+// checkForJSON makes sure that the request's Content-Type is application/json.
157
+func checkForJSON(r *http.Request) error {
158 158
 	ct := r.Header.Get("Content-Type")
159 159
 
160 160
 	// No Content-Type header is ok as long as there's no Body
... ...
@@ -438,7 +450,7 @@ func (s *Server) getEvents(version version.Version, w http.ResponseWriter, r *ht
438 438
 	outStream.Write(nil) // make sure response is sent immediately
439 439
 	enc := json.NewEncoder(outStream)
440 440
 
441
-	getContainerId := func(cn string) string {
441
+	getContainerID := func(cn string) string {
442 442
 		c, err := d.Get(cn)
443 443
 		if err != nil {
444 444
 			return ""
... ...
@@ -449,7 +461,7 @@ func (s *Server) getEvents(version version.Version, w http.ResponseWriter, r *ht
449 449
 	sendEvent := func(ev *jsonmessage.JSONMessage) error {
450 450
 		//incoming container filter can be name,id or partial id, convert and replace as a full container id
451 451
 		for i, cn := range ef["container"] {
452
-			ef["container"][i] = getContainerId(cn)
452
+			ef["container"][i] = getContainerID(cn)
453 453
 		}
454 454
 
455 455
 		if isFiltered(ev.Status, ef["event"]) || (isFiltered(ev.ID, ef["image"]) &&
... ...
@@ -684,7 +696,7 @@ func (s *Server) postCommit(version version.Version, w http.ResponseWriter, r *h
684 684
 		return err
685 685
 	}
686 686
 
687
-	if err := checkForJson(r); err != nil {
687
+	if err := checkForJSON(r); err != nil {
688 688
 		return err
689 689
 	}
690 690
 
... ...
@@ -734,8 +746,8 @@ func (s *Server) postImagesCreate(version version.Version, w http.ResponseWriter
734 734
 	authEncoded := r.Header.Get("X-Registry-Auth")
735 735
 	authConfig := &cliconfig.AuthConfig{}
736 736
 	if authEncoded != "" {
737
-		authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
738
-		if err := json.NewDecoder(authJson).Decode(authConfig); err != nil {
737
+		authJSON := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
738
+		if err := json.NewDecoder(authJSON).Decode(authConfig); err != nil {
739 739
 			// for a pull it is not an error if no auth was given
740 740
 			// to increase compatibility with the existing api it is defaulting to be empty
741 741
 			authConfig = &cliconfig.AuthConfig{}
... ...
@@ -814,8 +826,8 @@ func (s *Server) getImagesSearch(version version.Version, w http.ResponseWriter,
814 814
 	)
815 815
 
816 816
 	if authEncoded != "" {
817
-		authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
818
-		if err := json.NewDecoder(authJson).Decode(&config); err != nil {
817
+		authJSON := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
818
+		if err := json.NewDecoder(authJSON).Decode(&config); err != nil {
819 819
 			// for a search it is not an error if no auth was given
820 820
 			// to increase compatibility with the existing api it is defaulting to be empty
821 821
 			config = &cliconfig.AuthConfig{}
... ...
@@ -852,8 +864,8 @@ func (s *Server) postImagesPush(version version.Version, w http.ResponseWriter,
852 852
 	authEncoded := r.Header.Get("X-Registry-Auth")
853 853
 	if authEncoded != "" {
854 854
 		// the new format is to handle the authConfig as a header
855
-		authJson := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
856
-		if err := json.NewDecoder(authJson).Decode(authConfig); err != nil {
855
+		authJSON := base64.NewDecoder(base64.URLEncoding, strings.NewReader(authEncoded))
856
+		if err := json.NewDecoder(authJSON).Decode(authConfig); err != nil {
857 857
 			// to increase compatibility to existing api it is defaulting to be empty
858 858
 			authConfig = &cliconfig.AuthConfig{}
859 859
 		}
... ...
@@ -923,7 +935,7 @@ func (s *Server) postContainersCreate(version version.Version, w http.ResponseWr
923 923
 	if err := parseForm(r); err != nil {
924 924
 		return err
925 925
 	}
926
-	if err := checkForJson(r); err != nil {
926
+	if err := checkForJSON(r); err != nil {
927 927
 		return err
928 928
 	}
929 929
 	var (
... ...
@@ -935,15 +947,15 @@ func (s *Server) postContainersCreate(version version.Version, w http.ResponseWr
935 935
 	if err != nil {
936 936
 		return err
937 937
 	}
938
-	adjustCpuShares(version, hostConfig)
938
+	adjustCPUShares(version, hostConfig)
939 939
 
940
-	containerId, warnings, err := s.daemon.ContainerCreate(name, config, hostConfig)
940
+	containerID, warnings, err := s.daemon.ContainerCreate(name, config, hostConfig)
941 941
 	if err != nil {
942 942
 		return err
943 943
 	}
944 944
 
945 945
 	return writeJSON(w, http.StatusCreated, &types.ContainerCreateResponse{
946
-		ID:       containerId,
946
+		ID:       containerID,
947 947
 		Warnings: warnings,
948 948
 	})
949 949
 }
... ...
@@ -1045,7 +1057,7 @@ func (s *Server) postContainersStart(version version.Version, w http.ResponseWri
1045 1045
 	// allow a nil body for backwards compatibility
1046 1046
 	var hostConfig *runconfig.HostConfig
1047 1047
 	if r.Body != nil && (r.ContentLength > 0 || r.ContentLength == -1) {
1048
-		if err := checkForJson(r); err != nil {
1048
+		if err := checkForJSON(r); err != nil {
1049 1049
 			return err
1050 1050
 		}
1051 1051
 
... ...
@@ -1292,9 +1304,9 @@ func (s *Server) postBuild(version version.Version, w http.ResponseWriter, r *ht
1292 1292
 	buildConfig.CgroupParent = r.FormValue("cgroupparent")
1293 1293
 
1294 1294
 	var buildUlimits = []*ulimit.Ulimit{}
1295
-	ulimitsJson := r.FormValue("ulimits")
1296
-	if ulimitsJson != "" {
1297
-		if err := json.NewDecoder(strings.NewReader(ulimitsJson)).Decode(&buildUlimits); err != nil {
1295
+	ulimitsJSON := r.FormValue("ulimits")
1296
+	if ulimitsJSON != "" {
1297
+		if err := json.NewDecoder(strings.NewReader(ulimitsJSON)).Decode(&buildUlimits); err != nil {
1298 1298
 			return err
1299 1299
 		}
1300 1300
 		buildConfig.Ulimits = buildUlimits
... ...
@@ -1332,7 +1344,7 @@ func (s *Server) postContainersCopy(version version.Version, w http.ResponseWrit
1332 1332
 		return fmt.Errorf("Missing parameter")
1333 1333
 	}
1334 1334
 
1335
-	if err := checkForJson(r); err != nil {
1335
+	if err := checkForJSON(r); err != nil {
1336 1336
 		return err
1337 1337
 	}
1338 1338
 
... ...
@@ -1431,7 +1443,7 @@ func (s *Server) postContainerExecCreate(version version.Version, w http.Respons
1431 1431
 	if err := parseForm(r); err != nil {
1432 1432
 		return err
1433 1433
 	}
1434
-	if err := checkForJson(r); err != nil {
1434
+	if err := checkForJSON(r); err != nil {
1435 1435
 		return err
1436 1436
 	}
1437 1437
 	name := vars["name"]
... ...
@@ -1547,7 +1559,7 @@ func (s *Server) ping(version version.Version, w http.ResponseWriter, r *http.Re
1547 1547
 	return err
1548 1548
 }
1549 1549
 
1550
-func (s *Server) initTcpSocket(addr string) (l net.Listener, err error) {
1550
+func (s *Server) initTCPSocket(addr string) (l net.Listener, err error) {
1551 1551
 	if s.cfg.TLSConfig == nil || s.cfg.TLSConfig.ClientAuth != tls.RequireAndVerifyClientCert {
1552 1552
 		logrus.Warn("/!\\ DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\")
1553 1553
 	}
... ...
@@ -1560,7 +1572,7 @@ func (s *Server) initTcpSocket(addr string) (l net.Listener, err error) {
1560 1560
 	return
1561 1561
 }
1562 1562
 
1563
-func makeHttpHandler(logging bool, localMethod string, localRoute string, handlerFunc HttpApiFunc, corsHeaders string, dockerVersion version.Version) http.HandlerFunc {
1563
+func makeHTTPHandler(logging bool, localMethod string, localRoute string, handlerFunc HTTPAPIFunc, corsHeaders string, dockerVersion version.Version) http.HandlerFunc {
1564 1564
 	return func(w http.ResponseWriter, r *http.Request) {
1565 1565
 		// log the request
1566 1566
 		logrus.Debugf("Calling %s %s", localMethod, localRoute)
... ...
@@ -1612,9 +1624,9 @@ func makeHttpHandler(logging bool, localMethod string, localRoute string, handle
1612 1612
 func createRouter(s *Server) *mux.Router {
1613 1613
 	r := mux.NewRouter()
1614 1614
 	if os.Getenv("DEBUG") != "" {
1615
-		ProfilerSetup(r, "/debug/")
1615
+		profilerSetup(r, "/debug/")
1616 1616
 	}
1617
-	m := map[string]map[string]HttpApiFunc{
1617
+	m := map[string]map[string]HTTPAPIFunc{
1618 1618
 		"HEAD": {
1619 1619
 			"/containers/{name:.*}/archive": s.headContainersArchive,
1620 1620
 		},
... ...
@@ -1693,7 +1705,7 @@ func createRouter(s *Server) *mux.Router {
1693 1693
 			localMethod := method
1694 1694
 
1695 1695
 			// build the handler function
1696
-			f := makeHttpHandler(s.cfg.Logging, localMethod, localRoute, localFct, corsHeaders, version.Version(s.cfg.Version))
1696
+			f := makeHTTPHandler(s.cfg.Logging, localMethod, localRoute, localFct, corsHeaders, version.Version(s.cfg.Version))
1697 1697
 
1698 1698
 			// add the new route
1699 1699
 			if localRoute == "" {
... ...
@@ -19,8 +19,8 @@ import (
19 19
 
20 20
 const (
21 21
 	// See http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/tree/kernel/sched/sched.h?id=8cd9234c64c584432f6992fe944ca9e46ca8ea76#n269
22
-	linuxMinCpuShares = 2
23
-	linuxMaxCpuShares = 262144
22
+	linuxMinCPUShares = 2
23
+	linuxMaxCPUShares = 262144
24 24
 )
25 25
 
26 26
 // newServer sets up the required serverClosers and does protocol specific checking.
... ...
@@ -40,7 +40,7 @@ func (s *Server) newServer(proto, addr string) ([]serverCloser, error) {
40 40
 		// won't be ready.
41 41
 		<-s.start
42 42
 	case "tcp":
43
-		l, err := s.initTcpSocket(addr)
43
+		l, err := s.initTCPSocket(addr)
44 44
 		if err != nil {
45 45
 			return nil, err
46 46
 		}
... ...
@@ -56,7 +56,7 @@ func (s *Server) newServer(proto, addr string) ([]serverCloser, error) {
56 56
 	}
57 57
 	var res []serverCloser
58 58
 	for _, l := range ls {
59
-		res = append(res, &HttpServer{
59
+		res = append(res, &HTTPServer{
60 60
 			&http.Server{
61 61
 				Addr:    addr,
62 62
 				Handler: s.router,
... ...
@@ -67,6 +67,9 @@ func (s *Server) newServer(proto, addr string) ([]serverCloser, error) {
67 67
 	return res, nil
68 68
 }
69 69
 
70
+// AcceptConnections allows clients to connect to the API server.
71
+// Referenced Daemon is notified about this server, and waits for the
72
+// daemon acknowledgement before the incoming connections are accepted.
70 73
 func (s *Server) AcceptConnections(d *daemon.Daemon) {
71 74
 	// Tell the init daemon we are accepting requests
72 75
 	s.daemon = d
... ...
@@ -107,16 +110,16 @@ func allocateDaemonPort(addr string) error {
107 107
 	return nil
108 108
 }
109 109
 
110
-func adjustCpuShares(version version.Version, hostConfig *runconfig.HostConfig) {
110
+func adjustCPUShares(version version.Version, hostConfig *runconfig.HostConfig) {
111 111
 	if version.LessThan("1.19") {
112 112
 		if hostConfig != nil && hostConfig.CPUShares > 0 {
113 113
 			// Handle unsupported CpuShares
114
-			if hostConfig.CPUShares < linuxMinCpuShares {
115
-				logrus.Warnf("Changing requested CpuShares of %d to minimum allowed of %d", hostConfig.CPUShares, linuxMinCpuShares)
116
-				hostConfig.CPUShares = linuxMinCpuShares
117
-			} else if hostConfig.CPUShares > linuxMaxCpuShares {
118
-				logrus.Warnf("Changing requested CpuShares of %d to maximum allowed of %d", hostConfig.CPUShares, linuxMaxCpuShares)
119
-				hostConfig.CPUShares = linuxMaxCpuShares
114
+			if hostConfig.CPUShares < linuxMinCPUShares {
115
+				logrus.Warnf("Changing requested CpuShares of %d to minimum allowed of %d", hostConfig.CPUShares, linuxMinCPUShares)
116
+				hostConfig.CPUShares = linuxMinCPUShares
117
+			} else if hostConfig.CPUShares > linuxMaxCPUShares {
118
+				logrus.Warnf("Changing requested CpuShares of %d to maximum allowed of %d", hostConfig.CPUShares, linuxMaxCPUShares)
119
+				hostConfig.CPUShares = linuxMaxCPUShares
120 120
 			}
121 121
 		}
122 122
 	}
... ...
@@ -9,60 +9,60 @@ import (
9 9
 	"github.com/docker/docker/runconfig"
10 10
 )
11 11
 
12
-func TestAdjustCpuSharesOldApi(t *testing.T) {
12
+func TestAdjustCPUSharesOldApi(t *testing.T) {
13 13
 	apiVersion := version.Version("1.18")
14 14
 	hostConfig := &runconfig.HostConfig{
15
-		CPUShares: linuxMinCpuShares - 1,
15
+		CPUShares: linuxMinCPUShares - 1,
16 16
 	}
17
-	adjustCpuShares(apiVersion, hostConfig)
18
-	if hostConfig.CPUShares != linuxMinCpuShares {
19
-		t.Errorf("Expected CpuShares to be %d", linuxMinCpuShares)
17
+	adjustCPUShares(apiVersion, hostConfig)
18
+	if hostConfig.CPUShares != linuxMinCPUShares {
19
+		t.Errorf("Expected CPUShares to be %d", linuxMinCPUShares)
20 20
 	}
21 21
 
22
-	hostConfig.CPUShares = linuxMaxCpuShares + 1
23
-	adjustCpuShares(apiVersion, hostConfig)
24
-	if hostConfig.CPUShares != linuxMaxCpuShares {
25
-		t.Errorf("Expected CpuShares to be %d", linuxMaxCpuShares)
22
+	hostConfig.CPUShares = linuxMaxCPUShares + 1
23
+	adjustCPUShares(apiVersion, hostConfig)
24
+	if hostConfig.CPUShares != linuxMaxCPUShares {
25
+		t.Errorf("Expected CPUShares to be %d", linuxMaxCPUShares)
26 26
 	}
27 27
 
28 28
 	hostConfig.CPUShares = 0
29
-	adjustCpuShares(apiVersion, hostConfig)
29
+	adjustCPUShares(apiVersion, hostConfig)
30 30
 	if hostConfig.CPUShares != 0 {
31
-		t.Error("Expected CpuShares to be unchanged")
31
+		t.Error("Expected CPUShares to be unchanged")
32 32
 	}
33 33
 
34 34
 	hostConfig.CPUShares = 1024
35
-	adjustCpuShares(apiVersion, hostConfig)
35
+	adjustCPUShares(apiVersion, hostConfig)
36 36
 	if hostConfig.CPUShares != 1024 {
37
-		t.Error("Expected CpuShares to be unchanged")
37
+		t.Error("Expected CPUShares to be unchanged")
38 38
 	}
39 39
 }
40 40
 
41
-func TestAdjustCpuSharesNoAdjustment(t *testing.T) {
41
+func TestAdjustCPUSharesNoAdjustment(t *testing.T) {
42 42
 	apiVersion := version.Version("1.19")
43 43
 	hostConfig := &runconfig.HostConfig{
44
-		CPUShares: linuxMinCpuShares - 1,
44
+		CPUShares: linuxMinCPUShares - 1,
45 45
 	}
46
-	adjustCpuShares(apiVersion, hostConfig)
47
-	if hostConfig.CPUShares != linuxMinCpuShares-1 {
48
-		t.Errorf("Expected CpuShares to be %d", linuxMinCpuShares-1)
46
+	adjustCPUShares(apiVersion, hostConfig)
47
+	if hostConfig.CPUShares != linuxMinCPUShares-1 {
48
+		t.Errorf("Expected CPUShares to be %d", linuxMinCPUShares-1)
49 49
 	}
50 50
 
51
-	hostConfig.CPUShares = linuxMaxCpuShares + 1
52
-	adjustCpuShares(apiVersion, hostConfig)
53
-	if hostConfig.CPUShares != linuxMaxCpuShares+1 {
54
-		t.Errorf("Expected CpuShares to be %d", linuxMaxCpuShares+1)
51
+	hostConfig.CPUShares = linuxMaxCPUShares + 1
52
+	adjustCPUShares(apiVersion, hostConfig)
53
+	if hostConfig.CPUShares != linuxMaxCPUShares+1 {
54
+		t.Errorf("Expected CPUShares to be %d", linuxMaxCPUShares+1)
55 55
 	}
56 56
 
57 57
 	hostConfig.CPUShares = 0
58
-	adjustCpuShares(apiVersion, hostConfig)
58
+	adjustCPUShares(apiVersion, hostConfig)
59 59
 	if hostConfig.CPUShares != 0 {
60
-		t.Error("Expected CpuShares to be unchanged")
60
+		t.Error("Expected CPUShares to be unchanged")
61 61
 	}
62 62
 
63 63
 	hostConfig.CPUShares = 1024
64
-	adjustCpuShares(apiVersion, hostConfig)
64
+	adjustCPUShares(apiVersion, hostConfig)
65 65
 	if hostConfig.CPUShares != 1024 {
66
-		t.Error("Expected CpuShares to be unchanged")
66
+		t.Error("Expected CPUShares to be unchanged")
67 67
 	}
68 68
 }
... ...
@@ -43,6 +43,7 @@ func (s *Server) newServer(proto, addr string) ([]serverCloser, error) {
43 43
 
44 44
 }
45 45
 
46
+// AcceptConnections allows router to start listening for the incoming requests.
46 47
 func (s *Server) AcceptConnections(d *daemon.Daemon) {
47 48
 	s.daemon = d
48 49
 	s.registerSubRouter()
... ...
@@ -58,7 +59,7 @@ func allocateDaemonPort(addr string) error {
58 58
 	return nil
59 59
 }
60 60
 
61
-func adjustCpuShares(version version.Version, hostConfig *runconfig.HostConfig) {
61
+func adjustCPUShares(version version.Version, hostConfig *runconfig.HostConfig) {
62 62
 }
63 63
 
64 64
 // getContainersByNameDownlevel performs processing for pre 1.20 APIs. This
... ...
@@ -211,7 +211,7 @@ func (cli *DaemonCli) CmdDaemon(args ...string) error {
211 211
 		cli.LogConfig.Config = make(map[string]string)
212 212
 	}
213 213
 
214
-	serverConfig := &apiserver.ServerConfig{
214
+	serverConfig := &apiserver.Config{
215 215
 		Logging: true,
216 216
 		Version: dockerversion.VERSION,
217 217
 	}
... ...
@@ -236,7 +236,7 @@ func (cli *DaemonCli) CmdDaemon(args ...string) error {
236 236
 	// daemon doesn't exit
237 237
 	serveAPIWait := make(chan error)
238 238
 	go func() {
239
-		if err := api.ServeApi(commonFlags.Hosts); err != nil {
239
+		if err := api.ServeAPI(commonFlags.Hosts); err != nil {
240 240
 			logrus.Errorf("ServeAPI error: %v", err)
241 241
 			serveAPIWait <- err
242 242
 			return
... ...
@@ -15,7 +15,7 @@ import (
15 15
 	_ "github.com/docker/docker/daemon/execdriver/native"
16 16
 )
17 17
 
18
-func setPlatformServerConfig(serverConfig *apiserver.ServerConfig, daemonCfg *daemon.Config) *apiserver.ServerConfig {
18
+func setPlatformServerConfig(serverConfig *apiserver.Config, daemonCfg *daemon.Config) *apiserver.Config {
19 19
 	serverConfig.SocketGroup = daemonCfg.SocketGroup
20 20
 	serverConfig.EnableCors = daemonCfg.EnableCors
21 21
 	serverConfig.CorsHeaders = daemonCfg.CorsHeaders
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"github.com/docker/docker/daemon"
8 8
 )
9 9
 
10
-func setPlatformServerConfig(serverConfig *apiserver.ServerConfig, daemonCfg *daemon.Config) *apiserver.ServerConfig {
10
+func setPlatformServerConfig(serverConfig *apiserver.Config, daemonCfg *daemon.Config) *apiserver.Config {
11 11
 	return serverConfig
12 12
 }
13 13
 
... ...
@@ -8,6 +8,7 @@ source "${MAKEDIR}/.validate"
8 8
 # packages=( $(go list ./... 2> /dev/null | grep -vE "^github.com/docker/docker/vendor" || true ) )
9 9
 
10 10
 packages=(
11
+	api/server
11 12
 	builder
12 13
 	builder/command
13 14
 	builder/parser