1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/api/client/lib/version.go
David Calavera 229d3bace8 Move client version to the docker cli.
This removes the dockerversion dependency from the client library.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-11 19:03:33 -05:00

20 lines
441 B
Go

package lib
import (
"encoding/json"
"github.com/docker/docker/api/types"
)
// ServerVersion returns information of the docker client and server host.
func (cli *Client) ServerVersion() (types.Version, error) {
resp, err := cli.get("/version", nil, nil)
if err != nil {
return types.Version{}, err
}
defer ensureReaderClosed(resp)
var server types.Version
err = json.NewDecoder(resp.body).Decode(&server)
return server, err
}