Browse code

fix version struct on old versions

Signed-off-by: Jessica Frazelle <princess@docker.com>

Jessica Frazelle authored on 2015/06/04 08:56:09
Showing 2 changed files
... ...
@@ -246,14 +246,18 @@ func (s *Server) postAuth(version version.Version, w http.ResponseWriter, r *htt
246 246
 
247 247
 func (s *Server) getVersion(version version.Version, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
248 248
 	v := &types.Version{
249
-		Version:      dockerversion.VERSION,
250
-		ApiVersion:   api.APIVERSION,
251
-		GitCommit:    dockerversion.GITCOMMIT,
252
-		GoVersion:    runtime.Version(),
253
-		Os:           runtime.GOOS,
254
-		Arch:         runtime.GOARCH,
255
-		Experimental: utils.ExperimentalBuild(),
249
+		Version:    dockerversion.VERSION,
250
+		ApiVersion: api.APIVERSION,
251
+		GitCommit:  dockerversion.GITCOMMIT,
252
+		GoVersion:  runtime.Version(),
253
+		Os:         runtime.GOOS,
254
+		Arch:       runtime.GOARCH,
256 255
 	}
256
+
257
+	if version.GreaterThanOrEqualTo("1.19") {
258
+		v.Experimental = utils.ExperimentalBuild()
259
+	}
260
+
257 261
 	if kernelVersion, err := kernel.GetKernelVersion(); err == nil {
258 262
 		v.KernelVersion = kernelVersion.String()
259 263
 	}
... ...
@@ -132,7 +132,7 @@ type Version struct {
132 132
 	Os            string
133 133
 	Arch          string
134 134
 	KernelVersion string `json:",omitempty"`
135
-	Experimental  bool
135
+	Experimental  bool   `json:",omitempty"`
136 136
 }
137 137
 
138 138
 // GET "/info"