Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ linters:
- '-QF1012' # disable rule 'Use fmt.Fprintf instead of x.Write(fmt.Sprintf(...))'
- '-QF1003' # disable rule 'Convert if/else-if chain to tagged switch'
- '-QF1004' # disable rule 'Use strings.ReplaceAll instead of strings.Replace'
- '-QF1008' # disable rule 'Omit embedded fields from selector'
# https://golangci-lint.run/usage/linters/#staticcheck
# https://staticcheck.dev/docs/configuration/options/#initialisms
initialisms:
Expand Down
2 changes: 1 addition & 1 deletion cmd/triggers/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func runUpdateCommand(clients *shared.ClientFactory, cmd *cobra.Command) error {
// If the user used --workflow and the creation failed because we were missing the interactivity
// context, lets prompt and optionally add it
if updateFlags.workflow != "" && extendedErr.MissingParameterDetail.Type == "slack#/types/interactivity" {
updateRequest.TriggerRequest.Inputs = api.Inputs{
updateRequest.Inputs = api.Inputs{
extendedErr.MissingParameterDetail.Name: &api.Input{Value: dataInteractivityPayload},
}
shouldUpdate, innerErr := updatePromptShouldRetryWithInteractivityFunc(cmd, clients.IO, triggerArg)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (c *Client) Activity(ctx context.Context, token string, activityRequest typ
if !resp.Ok {
return ActivityResult{}, slackerror.NewAPIError(resp.Error, resp.Description, resp.Errors, appActivityMethod)
}
resp.ActivityResult.NextCursor = resp.ResponseMetadata.NextCursor
resp.NextCursor = resp.ResponseMetadata.NextCursor

return resp.ActivityResult, nil
}
2 changes: 1 addition & 1 deletion internal/api/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestClient_ExportAppManifest_Ok(t *testing.T) {
defer teardown()
result, err := c.ExportAppManifest(ctx, "token", "A0123456789")
require.NoError(t, err)
require.Equal(t, "example", result.Manifest.AppManifest.DisplayInformation.Name)
require.Equal(t, "example", result.Manifest.DisplayInformation.Name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reads sososo much better to me 📚🥹✨

}

func TestClient_ExportAppManifest_CommonErrors(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (c *Client) ExchangeAuthTicket(ctx context.Context, ticket string, challeng
}

// ExchangeAuthTicketResult must have a token to be valid
if resp.ExchangeAuthTicketResult.Token == "" {
if resp.Token == "" {
return ExchangeAuthTicketResult{}, slackerror.New(fmt.Sprintf("No token returned from the following Slack API method %s. Login can not be completed.", exchangeAuthTicketMethod))
}

Expand Down
22 changes: 11 additions & 11 deletions internal/api/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ func (c *Client) AppsDatastoreBulkPut(ctx context.Context, token string, request
return types.AppDatastoreBulkPutResult{}, slackerror.NewAPIError(resp.Error, resp.Description, resp.Errors, appDatastoreBulkPutMethod)
}

if resp.AppDatastoreBulkPutResult.Datastore == "" {
resp.AppDatastoreBulkPutResult.Datastore = request.Datastore
if resp.Datastore == "" {
resp.Datastore = request.Datastore
}

return resp.AppDatastoreBulkPutResult, nil
Expand Down Expand Up @@ -234,7 +234,7 @@ func (c *Client) AppsDatastoreQuery(ctx context.Context, token string, query typ
return types.AppDatastoreQueryResult{}, slackerror.NewAPIError(resp.Error, resp.Description, resp.Errors, appDatastoreQueryMethod)
}

resp.AppDatastoreQueryResult.NextCursor = resp.baseResponse.ResponseMetadata.NextCursor
resp.NextCursor = resp.ResponseMetadata.NextCursor

return resp.AppDatastoreQueryResult, nil
}
Expand Down Expand Up @@ -327,11 +327,11 @@ func (c *Client) AppsDatastoreDelete(ctx context.Context, token string, request
}

// the delete API doesn't return id or datastore (yet) so set it if empty
if resp.AppDatastoreDeleteResult.ID == "" {
resp.AppDatastoreDeleteResult.ID = request.ID
if resp.ID == "" {
resp.ID = request.ID
}
if resp.AppDatastoreDeleteResult.Datastore == "" {
resp.AppDatastoreDeleteResult.Datastore = request.Datastore
if resp.Datastore == "" {
resp.Datastore = request.Datastore
}

return resp.AppDatastoreDeleteResult, nil
Expand Down Expand Up @@ -377,8 +377,8 @@ func (c *Client) AppsDatastoreBulkDelete(ctx context.Context, token string, requ
return types.AppDatastoreBulkDeleteResult{}, slackerror.NewAPIError(resp.Error, resp.Description, resp.Errors, appDatastoreBulkDeleteMethod)
}

if resp.AppDatastoreBulkDeleteResult.Datastore == "" {
resp.AppDatastoreBulkDeleteResult.Datastore = request.Datastore
if resp.Datastore == "" {
resp.Datastore = request.Datastore
}

return resp.AppDatastoreBulkDeleteResult, nil
Expand Down Expand Up @@ -467,8 +467,8 @@ func (c *Client) AppsDatastoreBulkGet(ctx context.Context, token string, request
return types.AppDatastoreBulkGetResult{}, slackerror.NewAPIError(resp.Error, resp.Description, resp.Errors, appDatastoreBulkGetMethod)
}

if resp.AppDatastoreBulkGetResult.Datastore == "" {
resp.AppDatastoreBulkGetResult.Datastore = request.Datastore
if resp.Datastore == "" {
resp.Datastore = request.Datastore
}

return resp.AppDatastoreBulkGetResult, nil
Expand Down
6 changes: 3 additions & 3 deletions internal/api/workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (c *Client) workflowsTriggerSave(ctx context.Context, token string, method
}
}

serverTrigger := resp.triggerResult.Trigger
serverTrigger := resp.Trigger

return serverTrigger, nil
}
Expand All @@ -217,7 +217,7 @@ func parseMissingParameterErrors(details triggerCreateOrUpdateErrorDetails) ([]s
var missingParameterDetail *MissingParameterDetail
for _, detail := range details {
slackErrorDetails = append(slackErrorDetails, detail.ErrorDetail)
if detail.MissingParameterDetail.Name != "" {
if detail.Name != "" {
missingParameterDetail = &detail.MissingParameterDetail
}
}
Expand Down Expand Up @@ -258,7 +258,7 @@ func (c *Client) WorkflowsTriggersList(ctx context.Context, token string, listAr
return []types.DeployedTrigger{}, "", slackerror.NewAPIError(resp.Error, resp.Description, resp.Errors, workflowsTriggersListMethod)
}

return resp.Triggers, resp.extendedBaseResponse.ResponseMetadata.NextCursor, nil
return resp.Triggers, resp.ResponseMetadata.NextCursor, nil
}

// WorkflowsTriggersInfo will retrieve information on an existing trigger
Expand Down
4 changes: 2 additions & 2 deletions internal/cache/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (c *Cache) SetManifestHash(ctx context.Context, appID string, hash Hash) er
cache[appID] = ManifestCacheApp{
Hash: hash,
}
c.ManifestCache.Apps = cache
c.Apps = cache
return c.writeManifestCache(ctx)
}

Expand Down Expand Up @@ -112,7 +112,7 @@ func (c *Cache) writeManifestCache(ctx context.Context) error {
if err != nil && !os.IsExist(err) {
return err
}
cache, err := json.MarshalIndent(c.ManifestCache.Apps, "", " ")
cache, err := json.MarshalIndent(c.Apps, "", " ")
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cache/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestCache_Manifest(t *testing.T) {
cache := NewCache(fsMock, osMock, projectDirPath)
err = cache.SetManifestHash(ctx, tt.mockAppID, tt.mockCache.Hash)
require.NoError(t, err)
cache.ManifestCache.Apps = map[string]ManifestCacheApp{
cache.Apps = map[string]ManifestCacheApp{
tt.mockAppID: tt.mockCache,
}
hash, err := cache.GetManifestHash(ctx, tt.mockAppID)
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/apps/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ func Install(ctx context.Context, clients *shared.ClientFactory, log *logger.Log
return app, "", err
}

log.Data["appName"] = slackYaml.AppManifest.DisplayInformation.Name
log.Data["appName"] = slackYaml.DisplayInformation.Name
log.Data["isUpdate"] = app.AppID != ""
log.Data["teamName"] = *authSession.TeamName
log.Log("INFO", "app_install_manifest")

manifest := slackYaml.AppManifest
if slackYaml.AppManifest.IsFunctionRuntimeSlackHosted() {
if slackYaml.IsFunctionRuntimeSlackHosted() {
configureHostedManifest(ctx, clients, &manifest)
}

Expand Down Expand Up @@ -370,7 +370,7 @@ func InstallLocalApp(ctx context.Context, clients *shared.ClientFactory, orgGran
return app, api.DeveloperAppInstallResult{}, "", err
}

log.Data["appName"] = slackYaml.AppManifest.DisplayInformation.Name
log.Data["appName"] = slackYaml.DisplayInformation.Name
log.Data["isUpdate"] = app.AppID != ""
log.Data["teamName"] = *authSession.TeamName
log.Log("INFO", "app_install_manifest")
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/platform/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func Deploy(ctx context.Context, clients *shared.ClientFactory, showTriggers boo
if err != nil {
return nil, slackerror.Wrap(err, slackerror.ErrAppManifestAccess)
}
log.Data["appName"] = manifest.AppManifest.DisplayInformation.Name
log.Data["appName"] = manifest.DisplayInformation.Name

if showTriggers {
// Generate an optional trigger when none exist
Expand Down
Loading