Skip to content

Commit eac66e3

Browse files
authored
refactor: enable linter rule ST1005 for error string formatting (#73)
refactor: enable linter ST1005 'Incorrectly formatted error string'
1 parent 9437aa2 commit eac66e3

File tree

7 files changed

+6
-7
lines changed

7 files changed

+6
-7
lines changed

.golangci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ linters:
3333
staticcheck:
3434
checks:
3535
- all
36-
- '-ST1005' # disable rule 'Incorrectly formatted error string'
3736
- '-ST1023' # disable rule 'Redundant type in variable declaration'
3837
- '-QF1001' # disable rule 'Apply De Morgan’s law'
3938
- '-QF1012' # disable rule 'Use fmt.Fprintf instead of x.Write(fmt.Sprintf(...))'

internal/api/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ func (c *Client) DoWithRetry(ctx context.Context, request *http.Request, span op
294294
span.SetTag("status_code", r.StatusCode)
295295

296296
if r.StatusCode != http.StatusOK {
297-
return nil, errors.WithStack(fmt.Errorf("Slack API unexpected status code %d returned from url %s", r.StatusCode, sURL))
297+
return nil, errors.WithStack(fmt.Errorf("unexpected status code %d returned from url %s", r.StatusCode, sURL))
298298
}
299299

300300
var bytes []byte

internal/auth/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ func (c *Client) SetAuth(ctx context.Context, auth types.SlackAuth) (types.Slack
374374

375375
allAuths, err := c.auths(ctx)
376376
if err != nil {
377-
return types.SlackAuth{}, "", fmt.Errorf("Failed to fetch user authorizations %s", err)
377+
return types.SlackAuth{}, "", fmt.Errorf("failed to fetch user authorizations %s", err)
378378
}
379379
allAuths[auth.TeamID] = auth
380380

internal/pkg/create/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func getAppDirName(appName string) (string, error) {
169169

170170
// name cannot be a reserved word
171171
if goutils.Contains(reserved, appName, false) {
172-
return "", fmt.Errorf("The app name you entered is reserved. Please try a different name.")
172+
return "", fmt.Errorf("the app name you entered is reserved")
173173
}
174174
return appName, nil
175175
}

internal/pkg/platform/localserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ type SocketEvent struct {
428428
func sendWebSocketMessage(c WebSocketConnection, linkResponse *LinkResponse) error {
429429
// Validate the response
430430
if linkResponse == nil {
431-
return slackerror.Wrap(fmt.Errorf("Websocket response message cannot be empty"), slackerror.ErrSocketConnection)
431+
return slackerror.Wrap(fmt.Errorf("websocket response message cannot be empty"), slackerror.ErrSocketConnection)
432432
}
433433

434434
// Prepare response for websocket

internal/style/template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func getTemplateFuncs() template.FuncMap {
111111
func PrintTemplate(w io.Writer, tmpl string, data any) (err error) {
112112
defer func() {
113113
if r := recover(); r != nil {
114-
err = fmt.Errorf("Failed to create the template! %+v", r)
114+
err = fmt.Errorf("failed to create the template: %+v", r)
115115
}
116116
}()
117117
t := template.New("template")

internal/update/cli_metadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func (md *Metadata) httpClientRequest(method string, host string, data interface
9898
}
9999

100100
if res.StatusCode != http.StatusOK {
101-
return errors.WithStack(fmt.Errorf("Slack CLI metadata responded with an unexpected status code %d from url %s", res.StatusCode, host))
101+
return errors.WithStack(fmt.Errorf("CLI metadata responded with an unexpected status code %d from url %s", res.StatusCode, host))
102102
}
103103

104104
var bytes []byte

0 commit comments

Comments
 (0)