Enforce Go style rules across codebase
Apply five style rules: convert iota string enums to typed string constants, replace errors.As with errors.AsType, merge three-group imports into two groups, fix multiline parameter/argument formatting, and replace fmt.Sprintf URL construction with net/url. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -385,51 +385,67 @@ func (s AccessSourceService) ConfigureAccessSource(
|
||||
|
||||
switch dbConnector.Provider {
|
||||
case coredata.ConnectorProviderGitHub:
|
||||
if err := dbConnector.SetSettings(&coredata.GitHubConnectorSettings{
|
||||
Organization: req.OrganizationSlug,
|
||||
}); err != nil {
|
||||
if err := dbConnector.SetSettings(
|
||||
&coredata.GitHubConnectorSettings{
|
||||
Organization: req.OrganizationSlug,
|
||||
},
|
||||
); err != nil {
|
||||
return fmt.Errorf("cannot set github settings: %w", err)
|
||||
}
|
||||
case coredata.ConnectorProviderSentry:
|
||||
if err := dbConnector.SetSettings(&coredata.SentryConnectorSettings{
|
||||
OrganizationSlug: req.OrganizationSlug,
|
||||
}); err != nil {
|
||||
if err := dbConnector.SetSettings(
|
||||
&coredata.SentryConnectorSettings{
|
||||
OrganizationSlug: req.OrganizationSlug,
|
||||
},
|
||||
); err != nil {
|
||||
return fmt.Errorf("cannot set sentry settings: %w", err)
|
||||
}
|
||||
case coredata.ConnectorProviderGitLab:
|
||||
if err := dbConnector.SetSettings(&coredata.GitLabConnectorSettings{
|
||||
GroupID: req.OrganizationSlug,
|
||||
}); err != nil {
|
||||
if err := dbConnector.SetSettings(
|
||||
&coredata.GitLabConnectorSettings{
|
||||
GroupID: req.OrganizationSlug,
|
||||
},
|
||||
); err != nil {
|
||||
return fmt.Errorf("cannot set gitlab settings: %w", err)
|
||||
}
|
||||
case coredata.ConnectorProviderBitbucket:
|
||||
if err := dbConnector.SetSettings(&coredata.BitbucketConnectorSettings{
|
||||
Workspace: req.OrganizationSlug,
|
||||
}); err != nil {
|
||||
if err := dbConnector.SetSettings(
|
||||
&coredata.BitbucketConnectorSettings{
|
||||
Workspace: req.OrganizationSlug,
|
||||
},
|
||||
); err != nil {
|
||||
return fmt.Errorf("cannot set bitbucket settings: %w", err)
|
||||
}
|
||||
case coredata.ConnectorProviderHeroku:
|
||||
if err := dbConnector.SetSettings(&coredata.HerokuConnectorSettings{
|
||||
TeamID: req.OrganizationSlug,
|
||||
}); err != nil {
|
||||
if err := dbConnector.SetSettings(
|
||||
&coredata.HerokuConnectorSettings{
|
||||
TeamID: req.OrganizationSlug,
|
||||
},
|
||||
); err != nil {
|
||||
return fmt.Errorf("cannot set heroku settings: %w", err)
|
||||
}
|
||||
case coredata.ConnectorProviderAsana:
|
||||
if err := dbConnector.SetSettings(&coredata.AsanaConnectorSettings{
|
||||
WorkspaceGID: req.OrganizationSlug,
|
||||
}); err != nil {
|
||||
if err := dbConnector.SetSettings(
|
||||
&coredata.AsanaConnectorSettings{
|
||||
WorkspaceGID: req.OrganizationSlug,
|
||||
},
|
||||
); err != nil {
|
||||
return fmt.Errorf("cannot set asana settings: %w", err)
|
||||
}
|
||||
case coredata.ConnectorProviderNetlify:
|
||||
if err := dbConnector.SetSettings(&coredata.NetlifyConnectorSettings{
|
||||
AccountSlug: req.OrganizationSlug,
|
||||
}); err != nil {
|
||||
if err := dbConnector.SetSettings(
|
||||
&coredata.NetlifyConnectorSettings{
|
||||
AccountSlug: req.OrganizationSlug,
|
||||
},
|
||||
); err != nil {
|
||||
return fmt.Errorf("cannot set netlify settings: %w", err)
|
||||
}
|
||||
case coredata.ConnectorProviderClickUp:
|
||||
if err := dbConnector.SetSettings(&coredata.ClickUpConnectorSettings{
|
||||
TeamID: req.OrganizationSlug,
|
||||
}); err != nil {
|
||||
if err := dbConnector.SetSettings(
|
||||
&coredata.ClickUpConnectorSettings{
|
||||
TeamID: req.OrganizationSlug,
|
||||
},
|
||||
); err != nil {
|
||||
return fmt.Errorf("cannot set clickup settings: %w", err)
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user