Skip to content

Commit

Permalink
fix unnecssary fmt.Sprintf (staticcheck S1039)
Browse files Browse the repository at this point in the history
Done automatically with `gofmt -w -r "fmt.Sprintf(s) -> s" .`.
  • Loading branch information
egonelbre authored and brianolson committed Dec 2, 2024
1 parent 82af8d8 commit 59538a1
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion automod/engine/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func slackBody(header string, acct AccountMeta, newLabels, newFlags []string, ne
msg += fmt.Sprintf("Report `%s`: %s\n", rep.ReasonType, rep.Comment)
}
if newTakedown {
msg += fmt.Sprintf("Takedown!\n")
msg += "Takedown!\n"
}
return msg
}
2 changes: 1 addition & 1 deletion automod/rules/harassment.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func HarassmentTrivialPostRule(c *automod.RecordContext, post *appbsky.FeedPost)

if count > 5 {
//c.AddRecordFlag("trivial-harassing-post")
c.ReportAccount(automod.ReportReasonOther, fmt.Sprintf("possible targetted harassment (also labeled; remove label if this isn't harassment!)"))
c.ReportAccount(automod.ReportReasonOther, "possible targetted harassment (also labeled; remove label if this isn't harassment!)")
c.AddAccountLabel("!hide")
c.Notify("slack")
}
Expand Down
2 changes: 1 addition & 1 deletion automod/rules/nostr.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NostrSpamPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error {
return nil
}

c.ReportAccount(automod.ReportReasonOther, fmt.Sprintf("likely nostr spam account (also labeled; remove label if this isn't spam!)"))
c.ReportAccount(automod.ReportReasonOther, "likely nostr spam account (also labeled; remove label if this isn't spam!)")
c.AddAccountLabel("!hide")
c.Notify("slack")
return nil
Expand Down
2 changes: 1 addition & 1 deletion automod/rules/promo.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func AggressivePromotionRule(c *automod.RecordContext, post *appbsky.FeedPost) e
uniqueReplies := c.GetCountDistinct("reply-to", did, countstore.PeriodDay)
if uniqueReplies >= 10 {
c.AddAccountFlag("promo-multi-reply")
c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("possible aggressive self-promotion"))
c.ReportAccount(automod.ReportReasonSpam, "possible aggressive self-promotion")
c.Notify("slack")
}

Expand Down
4 changes: 2 additions & 2 deletions automod/rules/quick.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func BotLinkProfileRule(c *automod.RecordContext, profile *appbsky.ActorProfile)
}
if strings.Contains(*profile.Description, "🏈🍕🌀") {
c.AddAccountFlag("profile-bot-string")
c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("possible bot based on string in profile"))
c.ReportAccount(automod.ReportReasonSpam, "possible bot based on string in profile")
c.Notify("slack")
return nil
}
Expand Down Expand Up @@ -89,7 +89,7 @@ func TrivialSpamPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error
return nil
}

c.ReportAccount(automod.ReportReasonOther, fmt.Sprintf("trivial spam account (also labeled; remove label if this isn't spam!)"))
c.ReportAccount(automod.ReportReasonOther, "trivial spam account (also labeled; remove label if this isn't spam!)")
c.AddAccountLabel("!hide")
c.Notify("slack")
return nil
Expand Down
14 changes: 7 additions & 7 deletions cmd/astrolabe/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (srv *Server) WebAccount(c echo.Context) error {

atid, err := syntax.ParseAtIdentifier(c.Param("atid"))
if err != nil {
return echo.NewHTTPError(404, fmt.Sprintf("failed to parse handle or DID"))
return echo.NewHTTPError(404, "failed to parse handle or DID")
}

ident, err := srv.dir.Lookup(ctx, *atid)
Expand Down Expand Up @@ -96,7 +96,7 @@ func (srv *Server) WebRepo(c echo.Context) error {

atid, err := syntax.ParseAtIdentifier(c.Param("atid"))
if err != nil {
return echo.NewHTTPError(400, fmt.Sprintf("failed to parse handle or DID"))
return echo.NewHTTPError(400, "failed to parse handle or DID")
}

ident, err := srv.dir.Lookup(ctx, *atid)
Expand Down Expand Up @@ -133,12 +133,12 @@ func (srv *Server) WebRepoCollection(c echo.Context) error {

atid, err := syntax.ParseAtIdentifier(c.Param("atid"))
if err != nil {
return echo.NewHTTPError(400, fmt.Sprintf("failed to parse handle or DID"))
return echo.NewHTTPError(400, "failed to parse handle or DID")
}

collection, err := syntax.ParseNSID(c.Param("collection"))
if err != nil {
return echo.NewHTTPError(400, fmt.Sprintf("failed to parse collection NSID"))
return echo.NewHTTPError(400, "failed to parse collection NSID")
}

ident, err := srv.dir.Lookup(ctx, *atid)
Expand Down Expand Up @@ -191,17 +191,17 @@ func (srv *Server) WebRepoRecord(c echo.Context) error {

atid, err := syntax.ParseAtIdentifier(c.Param("atid"))
if err != nil {
return echo.NewHTTPError(400, fmt.Sprintf("failed to parse handle or DID"))
return echo.NewHTTPError(400, "failed to parse handle or DID")
}

collection, err := syntax.ParseNSID(c.Param("collection"))
if err != nil {
return echo.NewHTTPError(400, fmt.Sprintf("failed to parse collection NSID"))
return echo.NewHTTPError(400, "failed to parse collection NSID")
}

rkey, err := syntax.ParseRecordKey(c.Param("rkey"))
if err != nil {
return echo.NewHTTPError(400, fmt.Sprintf("failed to parse record key"))
return echo.NewHTTPError(400, "failed to parse record key")
}

ident, err := srv.dir.Lookup(ctx, *atid)
Expand Down
2 changes: 1 addition & 1 deletion lex/type_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func (s *TypeSchema) WriteHandlerStub(w io.Writer, fname, shortname, impname str
}
returndef = fmt.Sprintf("(*%s.%s, error)", impname, outname)
case "application/cbor", "application/vnd.ipld.car", "*/*":
returndef = fmt.Sprintf("(io.Reader, error)")
returndef = "(io.Reader, error)"
default:
return fmt.Errorf("unrecognized output encoding (handler stub): %q", s.Output.Encoding)
}
Expand Down
4 changes: 2 additions & 2 deletions repomgr/ingest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ func TestDuplicateRecord(t *testing.T) {
}

p1, _, err := repoman.CreateRecord(ctx, 1, "app.bsky.feed.post", &bsky.FeedPost{
Text: fmt.Sprintf("hello friend"),
Text: "hello friend",
})
if err != nil {
t.Fatal(err)
}

p2, _, err := repoman.CreateRecord(ctx, 1, "app.bsky.feed.post", &bsky.FeedPost{
Text: fmt.Sprintf("hello friend"),
Text: "hello friend",
})
if err != nil {
t.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion search/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func parseCursorLimit(e echo.Context) (int, int, error) {
if offset > 10000 {
return 0, 0, &echo.HTTPError{
Code: 400,
Message: fmt.Sprintf("invalid value for 'cursor' (can't paginate so deep)"),
Message: "invalid value for 'cursor' (can't paginate so deep)",
}
}

Expand Down

0 comments on commit 59538a1

Please sign in to comment.