Skip to content

Commit ca0a4c5

Browse files
committed
all: run go fix ./...
1 parent 4ba122a commit ca0a4c5

7 files changed

Lines changed: 19 additions & 20 deletions

File tree

ai-agent-api/ai/ai.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"fmt"
99
"io"
1010
"net/http"
11+
"strings"
1112
)
1213

1314
var secrets struct {
@@ -76,12 +77,12 @@ func Complete(ctx context.Context, req *CompleteRequest) (*CompleteResponse, err
7677
return nil, fmt.Errorf("unmarshal response: %v", err)
7778
}
7879

79-
var text string
80+
var text strings.Builder
8081
for _, block := range result.Content {
8182
if block.Type == "text" {
82-
text += block.Text
83+
text.WriteString(block.Text)
8384
}
8485
}
8586

86-
return &CompleteResponse{Content: text}, nil
87+
return &CompleteResponse{Content: text.String()}, nil
8788
}

ai-chat/chat/provider/slack/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func (s *Service) SendMessage(ctx context.Context, channelID string, req *provid
202202
channelID,
203203
slack.MsgOptionMetadata(slack.SlackMetadata{
204204
EventType: BotMessageEventType,
205-
EventPayload: map[string]interface{}{
205+
EventPayload: map[string]any{
206206
BotIDPayload: req.Bot.ID,
207207
},
208208
}),

ai-chat/pkg/fns/fns.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ package fns
22

33
import (
44
"io"
5+
"slices"
56
"time"
67

78
"github.com/sashabaranov/go-openai"
89
"golang.org/x/exp/rand"
910
)
1011

1112
// Ptr returns a pointer to the given value.
13+
//
14+
//go:fix inline
1215
func Ptr[T any](v T) *T {
13-
return &v
16+
return new(v)
1417
}
1518

1619
// ToMap converts a slice to a map using the given key function.
@@ -83,10 +86,5 @@ func CloseIgnore(stream io.Closer) {
8386
}
8487

8588
func Any(results []openai.Result, f func(r openai.Result) bool) bool {
86-
for _, r := range results {
87-
if f(r) {
88-
return true
89-
}
90-
}
91-
return false
89+
return slices.ContainsFunc(results, f)
9290
}

assemblyai-starter/backend/transcript.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,17 @@ func getClient() *aai.Client {
249249
func newTranscriptParams() *aai.TranscriptOptionalParams {
250250
params := &aai.TranscriptOptionalParams{
251251
// Enables Speaker Diarization.
252-
SpeakerLabels: aai.Bool(true),
252+
SpeakerLabels: new(true),
253253
}
254254

255255
// AssemblyAI won't be able to send a webhook delivery when we're running
256256
// locally, so let's disable it unless we're running in the cloud.
257257
if cfg.UseWebhook() {
258258
url := encore.Meta().APIBaseURL.ResolveReference(&url.URL{Path: "/api/transcripts/webhook"})
259259

260-
params.WebhookURL = aai.String(url.String())
261-
params.WebhookAuthHeaderName = aai.String("X-Webhook-Secret")
262-
params.WebhookAuthHeaderValue = aai.String(secrets.AssemblyAIWebhookSecret)
260+
params.WebhookURL = new(url.String())
261+
params.WebhookAuthHeaderName = new("X-Webhook-Secret")
262+
params.WebhookAuthHeaderValue = new(secrets.AssemblyAIWebhookSecret)
263263
}
264264

265265
return params

auth0/backend/auth/auth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func (s *Service) Callback(
7979
}
8080
}
8181

82-
var profile map[string]interface{}
82+
var profile map[string]any
8383
if err := idToken.Claims(&profile); err != nil {
8484
return nil, &errs.Error{
8585
Code: errs.Internal,
@@ -150,7 +150,7 @@ func (s *Service) AuthHandler(
150150
}
151151
}
152152

153-
var profile map[string]interface{}
153+
var profile map[string]any
154154
if err := t.Claims(&profile); err != nil {
155155
return "", nil, &errs.Error{
156156
Code: errs.Internal,

booking-system/booking/slots.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func GetBookableSlots(ctx context.Context, from string) (*SlotsResponse, error)
3232
const numDays = 7
3333

3434
var slots []BookableSlot
35-
for i := 0; i < numDays; i++ {
35+
for i := range numDays {
3636
date := fromDate.AddDate(0, 0, i)
3737
weekday := int(date.Weekday())
3838
if len(availability) <= weekday {

nextjs-auth0-starter/backend/auth/auth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (s *Service) Callback(ctx context.Context, req *CallbackRequest) (*Callback
7575
}
7676
}
7777

78-
var profile map[string]interface{}
78+
var profile map[string]any
7979
if err := idToken.Claims(&profile); err != nil {
8080
return nil, &errs.Error{
8181
Code: errs.Internal,
@@ -137,7 +137,7 @@ func (s *Service) AuthHandler(ctx context.Context, token string) (auth.UID, erro
137137
}
138138
}
139139

140-
var profile map[string]interface{}
140+
var profile map[string]any
141141
if err := t.Claims(&profile); err != nil {
142142
return "", &errs.Error{
143143
Code: errs.Internal,

0 commit comments

Comments
 (0)