diff --git a/client.go b/client.go index 75cfc8698b..df3698adc6 100644 --- a/client.go +++ b/client.go @@ -53,13 +53,11 @@ import ( "path/filepath" "strings" + "github.com/docker/docker/api" "github.com/docker/go-connections/sockets" "github.com/docker/go-connections/tlsconfig" ) -// DefaultVersion is the version of the current stable API -const DefaultVersion string = "1.26" - // Client is the API client that performs all operations // against a docker server. type Client struct { @@ -115,7 +113,7 @@ func NewEnvClient() (*Client, error) { } version := os.Getenv("DOCKER_API_VERSION") if version == "" { - version = DefaultVersion + version = api.DefaultVersion } cli, err := NewClient(host, version, client, nil) diff --git a/client_test.go b/client_test.go index 7c26403ebe..64188d5fb1 100644 --- a/client_test.go +++ b/client_test.go @@ -11,6 +11,7 @@ import ( "strings" "testing" + "github.com/docker/docker/api" "github.com/docker/docker/api/types" "golang.org/x/net/context" ) @@ -26,7 +27,7 @@ func TestNewEnvClient(t *testing.T) { }{ { envs: map[string]string{}, - expectedVersion: DefaultVersion, + expectedVersion: api.DefaultVersion, }, { envs: map[string]string{ @@ -38,21 +39,21 @@ func TestNewEnvClient(t *testing.T) { envs: map[string]string{ "DOCKER_CERT_PATH": "testdata/", }, - expectedVersion: DefaultVersion, + expectedVersion: api.DefaultVersion, }, { envs: map[string]string{ "DOCKER_CERT_PATH": "testdata/", "DOCKER_TLS_VERIFY": "1", }, - expectedVersion: DefaultVersion, + expectedVersion: api.DefaultVersion, }, { envs: map[string]string{ "DOCKER_CERT_PATH": "testdata/", "DOCKER_HOST": "https://notaunixsocket", }, - expectedVersion: DefaultVersion, + expectedVersion: api.DefaultVersion, }, { envs: map[string]string{ @@ -64,7 +65,7 @@ func TestNewEnvClient(t *testing.T) { envs: map[string]string{ "DOCKER_HOST": "invalid://url", }, - expectedVersion: DefaultVersion, + expectedVersion: api.DefaultVersion, }, { envs: map[string]string{ @@ -262,8 +263,8 @@ func TestNewEnvClientSetsDefaultVersion(t *testing.T) { if err != nil { t.Fatal(err) } - if client.version != DefaultVersion { - t.Fatalf("Expected %s, got %s", DefaultVersion, client.version) + if client.version != api.DefaultVersion { + t.Fatalf("Expected %s, got %s", api.DefaultVersion, client.version) } expected := "1.22"