@@ -32,15 +32,15 @@ func SetServerInfo(d *docker.Env) {
3232 mu .Lock ()
3333 defer mu .Unlock ()
3434 dockerInfo = Docker {
35- Name : d .Get ("Name" ),
36- NumContainers : d .GetInt ("Containers" ),
37- NumImages : d .GetInt ("Images" ),
38- Version : dockerEnv .Get ("Version" ),
39- ApiVersion : dockerEnv .Get ("ApiVersion" ),
40- GoVersion : dockerEnv .Get ("GoVersion" ),
41- OperatingSystem : dockerEnv .Get ("Os" ),
42- Architecture : dockerEnv .Get ("Arch" ),
43- CurrentContainerID : GetCurrentContainerID (),
35+ Name : d .Get ("Name" ),
36+ NumContainers : d .GetInt ("Containers" ),
37+ NumImages : d .GetInt ("Images" ),
38+ Version : dockerEnv .Get ("Version" ),
39+ ApiVersion : dockerEnv .Get ("ApiVersion" ),
40+ GoVersion : dockerEnv .Get ("GoVersion" ),
41+ OperatingSystem : dockerEnv .Get ("Os" ),
42+ Architecture : dockerEnv .Get ("Arch" ),
43+ CurrentContainerID : GetCurrentContainerID (),
4444 }
4545}
4646
@@ -143,15 +143,15 @@ type Mount struct {
143143}
144144
145145type Docker struct {
146- Name string
147- NumContainers int
148- NumImages int
149- Version string
150- ApiVersion string
151- GoVersion string
152- OperatingSystem string
153- Architecture string
154- CurrentContainerID string
146+ Name string
147+ NumContainers int
148+ NumImages int
149+ Version string
150+ ApiVersion string
151+ GoVersion string
152+ OperatingSystem string
153+ Architecture string
154+ CurrentContainerID string
155155}
156156
157157func GetCurrentContainerID () string {
@@ -163,11 +163,10 @@ func GetCurrentContainerID() string {
163163 log .Printf ("Fail to open /proc/self/cgroup: %s\n " , err )
164164 return ""
165165 }
166-
167- reader := bufio .NewReader (file )
168- scanner := bufio .NewScanner (reader )
169- scanner .Split (bufio .ScanLines )
170166
167+ reader := bufio .NewReader (file )
168+ scanner := bufio .NewScanner (reader )
169+ scanner .Split (bufio .ScanLines )
171170
172171 for scanner .Scan () {
173172 _ , lines , err := bufio .ScanLines ([]byte (scanner .Text ()), true )
@@ -176,11 +175,11 @@ func GetCurrentContainerID() string {
176175 if re .MatchString (string (lines )) {
177176 submatches := re .FindStringSubmatch (string (lines ))
178177 containerID := submatches [1 ]
179-
178+
180179 return containerID
181180 }
182181 }
183- }
182+ }
184183
185184 return ""
186- }
185+ }
0 commit comments