newClientVersion constructs a new clientVersion. If a dockerCLI is passed as argument, additional information is included (API version), which may invoke an API connection. Pass nil to omit the additional information.
(contextName string, dockerCli command.Cli)
| 109 | // which may invoke an API connection. Pass nil to omit the additional |
| 110 | // information. |
| 111 | func newClientVersion(contextName string, dockerCli command.Cli) clientVersion { |
| 112 | v := clientVersion{ |
| 113 | Version: version.Version, |
| 114 | DefaultAPIVersion: client.MaxAPIVersion, |
| 115 | GoVersion: runtime.Version(), |
| 116 | GitCommit: version.GitCommit, |
| 117 | BuildTime: reformatDate(version.BuildTime), |
| 118 | Os: runtime.GOOS, |
| 119 | Arch: arch(), |
| 120 | Context: contextName, |
| 121 | } |
| 122 | if version.PlatformName != "" { |
| 123 | v.Platform = &platformInfo{Name: version.PlatformName} |
| 124 | } |
| 125 | if dockerCli != nil { |
| 126 | v.APIVersion = dockerCli.CurrentVersion() |
| 127 | } |
| 128 | return v |
| 129 | } |
| 130 | |
| 131 | func newServerVersion(sv client.ServerVersionResult) *serverVersion { |
| 132 | out := &serverVersion{ |
no test coverage detected
searching dependent graphs…