package version import ( "encoding/json" "errors" "nexus-common/params" g "nexus-libclient/globals" ) func GetServerVersion() (*params.Version, error) { client := g.GetInstance().Client host := g.GetInstance().Host resp, err := client.R().Get(host + "/version") if err != nil { return nil, err } else { if resp.IsSuccess() { version := params.Version{} if err := json.Unmarshal(resp.Body(), &version); err != nil { return nil, err } return &version, nil } else { return nil, errors.New(resp.Status() + ": " + resp.String()) } } }