diff --git a/internal/api/json/auth.go b/internal/api/json/auth.go index c48f2c2..caf64c5 100644 --- a/internal/api/json/auth.go +++ b/internal/api/json/auth.go @@ -32,7 +32,7 @@ func NewAuth(c *resty.Client) Auth { } } -//GetAPIKey gets API keys via REST CLI Gate +// GetAPIKey gets API keys via REST CLI Gate func (j Auth) GetAPIKey(a api.Auth) (string, error) { // FIXME: Enable direct call when 18.0.25-18.0.28 are no longer used: // https://jira.plesk.ru/browse/PPP-49425 @@ -59,7 +59,7 @@ func (j Auth) GetAPIKey(a api.Auth) (string, error) { } if res.IsSuccess() { - var r *createAPIKeyResponse = res.Result().(*createAPIKeyResponse) + var r = res.Result().(*createAPIKeyResponse) return r.Key, nil } @@ -67,7 +67,7 @@ func (j Auth) GetAPIKey(a api.Auth) (string, error) { return "", authError{server: j.client.HostURL, needReauth: false} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return "", errors.New(locales.L.Get("api.errors.auth.cli.failed", r.Code, r.Message)) } @@ -95,7 +95,7 @@ func (j Auth) GetAPIKey(a api.Auth) (string, error) { } if res.IsSuccess() { - var r *cliGateResponce = res.Result().(*cliGateResponce) + var r = res.Result().(*cliGateResponce) if r.Code == 0 { return r.Stdout, nil } @@ -107,7 +107,7 @@ func (j Auth) GetAPIKey(a api.Auth) (string, error) { return "", authError{server: j.client.HostURL, needReauth: false} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return "", jsonErrorToError(*r) } @@ -134,7 +134,7 @@ func (j Auth) GetLoginLink(auth api.Auth) (string, error) { } if res.IsSuccess() { - var r *cliGateResponce = res.Result().(*cliGateResponce) + var r = res.Result().(*cliGateResponce) if r.Code == 0 { return r.Stdout, nil } @@ -146,7 +146,7 @@ func (j Auth) GetLoginLink(auth api.Auth) (string, error) { return "", authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return "", jsonErrorToError(*r) } @@ -162,7 +162,7 @@ func (j Auth) RemoveAPIKey(auth api.Auth) (string, error) { } if res.IsError() { - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return "", jsonErrorToError(*r) } diff --git a/internal/api/json/databases.go b/internal/api/json/databases.go index 2daee94..7d782c1 100644 --- a/internal/api/json/databases.go +++ b/internal/api/json/databases.go @@ -47,7 +47,7 @@ func (j jsonDatabases) ListDatabases() ([]api.DatabaseInfo, error) { } if res.IsSuccess() { - var r *[]databaseInfo = res.Result().(*[]databaseInfo) + var r = res.Result().(*[]databaseInfo) return jsonDatabaseInfoToInfo(*r), err } @@ -55,7 +55,7 @@ func (j jsonDatabases) ListDatabases() ([]api.DatabaseInfo, error) { return jsonDatabaseInfoToInfo([]databaseInfo{}), authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return jsonDatabaseInfoToInfo([]databaseInfo{}), errors.New(locales.L.Get("api.errors.failed.request", r.Code, r.Message, r.Errors)) } @@ -71,7 +71,7 @@ func (j jsonDatabases) ListDomainDatabases(domain string) ([]api.DatabaseInfo, e } if res.IsSuccess() { - var r *[]databaseInfo = res.Result().(*[]databaseInfo) + var r = res.Result().(*[]databaseInfo) return jsonDatabaseInfoToInfo(*r), err } @@ -79,7 +79,7 @@ func (j jsonDatabases) ListDomainDatabases(domain string) ([]api.DatabaseInfo, e return jsonDatabaseInfoToInfo([]databaseInfo{}), authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return jsonDatabaseInfoToInfo([]databaseInfo{}), jsonErrorToError(*r) } @@ -108,7 +108,7 @@ func (j jsonDatabases) CreateDatabase(domain types.Domain, db types.NewDatabase, } if res.IsSuccess() { - var r *databaseInfo = res.Result().(*databaseInfo) + var r = res.Result().(*databaseInfo) return &api.DatabaseInfo{ ID: r.ID, Name: r.Name, @@ -122,7 +122,7 @@ func (j jsonDatabases) CreateDatabase(domain types.Domain, db types.NewDatabase, return nil, authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return nil, jsonErrorToError(*r) } @@ -140,7 +140,7 @@ func (j jsonDatabases) RemoveDatabase(db types.Database) error { } if res.IsError() { - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return jsonErrorToError(*r) } @@ -209,7 +209,7 @@ func (j jsonDatabases) DeployDatabase( } if res.IsSuccess() { - var r *cliGateResponce = res.Result().(*cliGateResponce) + var r = res.Result().(*cliGateResponce) if r.Code != 0 || len(r.Stderr) != 0 { return jsonCliGateResponceToError(*r) } @@ -219,7 +219,7 @@ func (j jsonDatabases) DeployDatabase( return authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return jsonErrorToError(*r) } @@ -234,7 +234,7 @@ func (j jsonDatabases) ListDatabaseServers() ([]api.DatabaseServerInfo, error) { } if res.IsSuccess() { - var r *[]databaseServerInfo = res.Result().(*[]databaseServerInfo) + var r = res.Result().(*[]databaseServerInfo) return jsonDatabaseServerInfoToInfo(*r), err } @@ -242,7 +242,7 @@ func (j jsonDatabases) ListDatabaseServers() ([]api.DatabaseServerInfo, error) { return []api.DatabaseServerInfo{}, authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return []api.DatabaseServerInfo{}, jsonErrorToError(*r) } @@ -268,7 +268,7 @@ func (j jsonDatabases) CreateDatabaseUser(db types.Database, dbuser types.NewDat } if res.IsSuccess() { - var r *databaseUserInfo = res.Result().(*databaseUserInfo) + var r = res.Result().(*databaseUserInfo) return &api.DatabaseUserInfo{ ID: r.ID, Login: r.Login, @@ -280,7 +280,7 @@ func (j jsonDatabases) CreateDatabaseUser(db types.Database, dbuser types.NewDat return nil, authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return nil, jsonErrorToError(*r) } @@ -298,7 +298,7 @@ func (j jsonDatabases) RemoveDatabaseUser(dbu types.DatabaseUser) error { } if res.IsError() { - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return jsonErrorToError(*r) } @@ -317,7 +317,7 @@ func (j jsonDatabases) ListDatabaseUsers(db types.Database) ([]api.DatabaseUserI } if res.IsSuccess() { - var r *[]databaseUserInfo = res.Result().(*[]databaseUserInfo) + var r = res.Result().(*[]databaseUserInfo) return jsonDatabaseUserInfoToInfo(*r), err } @@ -325,6 +325,6 @@ func (j jsonDatabases) ListDatabaseUsers(db types.Database) ([]api.DatabaseUserI return []api.DatabaseUserInfo{}, authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return []api.DatabaseUserInfo{}, jsonErrorToError(*r) } diff --git a/internal/api/json/domains.go b/internal/api/json/domains.go index ed32da1..fc45500 100644 --- a/internal/api/json/domains.go +++ b/internal/api/json/domains.go @@ -69,7 +69,7 @@ func (j jsonDomains) getDomainSysUser(d string) (string, error) { } if res.IsSuccess() { - var r *cliGateResponce = res.Result().(*cliGateResponce) + var r = res.Result().(*cliGateResponce) if r.Code != 0 { return "", jsonCliGateResponceToError(*r) } @@ -88,7 +88,7 @@ func (j jsonDomains) getDomainSysUser(d string) (string, error) { return "", authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return "", errors.New(locales.L.Get("api.errors.domain.info.failed", r.Code, r.Message)) } @@ -128,7 +128,7 @@ func (j jsonDomains) CreateDomain(d string, ipa types.ServerIPAddresses) (*api.D } if res.IsSuccess() { - var _ *actionDomainResponse = res.Result().(*actionDomainResponse) + var _ = res.Result().(*actionDomainResponse) info, err := j.GetDomain(d) return &info, err } @@ -137,7 +137,7 @@ func (j jsonDomains) CreateDomain(d string, ipa types.ServerIPAddresses) (*api.D return nil, authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return nil, jsonErrorToError(*r) } @@ -166,7 +166,7 @@ func (j jsonDomains) AddDomainFeatures(domain string, featureList []string, isWi } if res.IsSuccess() { - var r *cliGateResponce = res.Result().(*cliGateResponce) + var r = res.Result().(*cliGateResponce) if r.Code == 0 { return nil } @@ -178,7 +178,7 @@ func (j jsonDomains) AddDomainFeatures(domain string, featureList []string, isWi return authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return jsonErrorToError(*r) } } @@ -198,7 +198,7 @@ func (j jsonDomains) GetDomain(d string) (api.DomainInfo, error) { } if res.IsSuccess() { - var r *[]domainInfo = res.Result().(*[]domainInfo) + var r = res.Result().(*[]domainInfo) if len(*r) == 0 { return api.DomainInfo{}, errors.New(locales.L.Get("errors.domain.unknown", d)) } @@ -223,7 +223,7 @@ func (j jsonDomains) GetDomain(d string) (api.DomainInfo, error) { return api.DomainInfo{}, authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return api.DomainInfo{}, jsonErrorToError(*r) } @@ -246,7 +246,7 @@ func (j jsonDomains) RemoveDomain(d string) error { } if res.IsError() { - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return jsonErrorToError(*r) } @@ -264,7 +264,7 @@ func (j jsonDomains) ListDomains() ([]api.DomainInfo, error) { } if res.IsSuccess() { - var r *[]domainInfo = res.Result().(*[]domainInfo) + var r = res.Result().(*[]domainInfo) return jsonDomainInfoToInfo(*r), nil } @@ -272,6 +272,6 @@ func (j jsonDomains) ListDomains() ([]api.DomainInfo, error) { return []api.DomainInfo{}, authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return []api.DomainInfo{}, jsonErrorToError(*r) } diff --git a/internal/api/json/ftp.go b/internal/api/json/ftp.go index 390ddde..6b6d082 100644 --- a/internal/api/json/ftp.go +++ b/internal/api/json/ftp.go @@ -53,7 +53,7 @@ func (j jsonFTPUsers) ListDomainFtpUsers(domain string, user types.FtpUser) ([]a } if res.IsSuccess() { - var r *[]ftpUserInfo = res.Result().(*[]ftpUserInfo) + var r = res.Result().(*[]ftpUserInfo) return jsonFTPUserInfoToInfo(*r), nil } @@ -61,7 +61,7 @@ func (j jsonFTPUsers) ListDomainFtpUsers(domain string, user types.FtpUser) ([]a return nil, authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return nil, jsonErrorToError(*r) } @@ -95,7 +95,7 @@ func (j jsonFTPUsers) CreateFtpUser(domain string, user types.FtpUser) (*api.FTP } if res.IsSuccess() { - var r *ftpUserInfo = res.Result().(*ftpUserInfo) + var r = res.Result().(*ftpUserInfo) return &api.FTPUserInfo{ Name: r.Home, Home: r.Name, @@ -108,7 +108,7 @@ func (j jsonFTPUsers) CreateFtpUser(domain string, user types.FtpUser) (*api.FTP return nil, authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return nil, jsonErrorToError(*r) } @@ -135,7 +135,7 @@ func (j jsonFTPUsers) UpdateFtpUser(domain string, user string, userNew types.Ft } if res.IsSuccess() { - var _ *statusResponse = res.Result().(*statusResponse) + var _ = res.Result().(*statusResponse) return nil } @@ -143,7 +143,7 @@ func (j jsonFTPUsers) UpdateFtpUser(domain string, user string, userNew types.Ft return authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return jsonErrorToError(*r) } @@ -161,7 +161,7 @@ func (j jsonFTPUsers) DeleteFtpUser(domain string, user types.FtpUser) error { } if res.IsError() { - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return jsonErrorToError(*r) } diff --git a/internal/api/json/info.go b/internal/api/json/info.go index be249d5..9688626 100644 --- a/internal/api/json/info.go +++ b/internal/api/json/info.go @@ -62,7 +62,7 @@ func (j jsonInfo) GetInfo() (api.ServerInfo, error) { return api.ServerInfo{}, authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return api.ServerInfo{}, jsonErrorToError(*r) } @@ -77,7 +77,7 @@ func (j jsonInfo) GetIPAddresses() (types.ServerIPAddresses, error) { } if res.IsSuccess() { - var r *[]serverIPAddresses = res.Result().(*[]serverIPAddresses) + var r = res.Result().(*[]serverIPAddresses) ip := types.ServerIPAddresses{ IPv4: []string{}, IPv6: []string{}, @@ -98,6 +98,6 @@ func (j jsonInfo) GetIPAddresses() (types.ServerIPAddresses, error) { return types.ServerIPAddresses{}, authError{server: j.client.HostURL, needReauth: true} } - var r *jsonError = res.Error().(*jsonError) + var r = res.Error().(*jsonError) return types.ServerIPAddresses{}, jsonErrorToError(*r) } diff --git a/internal/features/features.go b/internal/features/features.go index c660dcd..c34d663 100644 --- a/internal/features/features.go +++ b/internal/features/features.go @@ -55,7 +55,7 @@ func GetFeatureByString(specifier string) *Feature { } func (f FeatureProvider) GetFeaturePackage(domain string, feature Feature) ([]byte, error) { - var packet map[string][]string = map[string][]string{"params": {}, "env": {}} + var packet = map[string][]string{"params": {}, "env": {}} switch feature { case Php74: