mirror of https://github.com/docker/cli.git
remove uses of cli.DefaultVersion()
It's hard-coded to the API defaultversion, so we can use that const directly. Ultimately, this should be something returned by the API client configured on the CLI, not the CLI itself. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
2eec74659e
commit
5f13d0f2b5
|
@ -88,7 +88,7 @@ type DockerCli struct {
|
|||
enableGlobalMeter, enableGlobalTracer bool
|
||||
}
|
||||
|
||||
// DefaultVersion returns api.defaultVersion.
|
||||
// DefaultVersion returns [api.DefaultVersion].
|
||||
func (*DockerCli) DefaultVersion() string {
|
||||
return api.DefaultVersion
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import (
|
|||
flagsHelper "github.com/docker/cli/cli/flags"
|
||||
"github.com/docker/cli/cli/version"
|
||||
"github.com/docker/cli/templates"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
@ -89,20 +90,20 @@ type clientVersion struct {
|
|||
// information.
|
||||
func newClientVersion(contextName string, dockerCli command.Cli) clientVersion {
|
||||
v := clientVersion{
|
||||
Version: version.Version,
|
||||
GoVersion: runtime.Version(),
|
||||
GitCommit: version.GitCommit,
|
||||
BuildTime: reformatDate(version.BuildTime),
|
||||
Os: runtime.GOOS,
|
||||
Arch: arch(),
|
||||
Context: contextName,
|
||||
Version: version.Version,
|
||||
DefaultAPIVersion: api.DefaultVersion,
|
||||
GoVersion: runtime.Version(),
|
||||
GitCommit: version.GitCommit,
|
||||
BuildTime: reformatDate(version.BuildTime),
|
||||
Os: runtime.GOOS,
|
||||
Arch: arch(),
|
||||
Context: contextName,
|
||||
}
|
||||
if version.PlatformName != "" {
|
||||
v.Platform = &platformInfo{Name: version.PlatformName}
|
||||
}
|
||||
if dockerCli != nil {
|
||||
v.APIVersion = dockerCli.CurrentVersion()
|
||||
v.DefaultAPIVersion = dockerCli.DefaultVersion()
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
registryclient "github.com/docker/cli/cli/registry/client"
|
||||
"github.com/docker/cli/cli/streams"
|
||||
"github.com/docker/cli/cli/trust"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/client"
|
||||
notaryclient "github.com/theupdateframework/notary/client"
|
||||
)
|
||||
|
@ -104,8 +105,8 @@ func (c *FakeCli) Client() client.APIClient {
|
|||
}
|
||||
|
||||
// CurrentVersion returns the API version used by FakeCli.
|
||||
func (c *FakeCli) CurrentVersion() string {
|
||||
return c.DefaultVersion()
|
||||
func (*FakeCli) CurrentVersion() string {
|
||||
return api.DefaultVersion
|
||||
}
|
||||
|
||||
// Out returns the output stream (stdout) the cli should write on
|
||||
|
|
Loading…
Reference in New Issue