Skip to content

Commit 81ef247

Browse files
committed
Apply go fix modernizers
1 parent 2a185a5 commit 81ef247

5 files changed

Lines changed: 12 additions & 17 deletions

File tree

cmd/src/code_intel_upload_vendored.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ func uploadMultipartIndexParts(ctx context.Context, httpClient upload.Client, op
176176
}
177177

178178
for i, reader := range readers {
179-
i, reader := i, reader
180179

181180
pool.Go(func(ctx context.Context) error {
182181
// Determine size of this reader. If we're not the last reader in the slice,

cmd/src/snapshot_upload.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,6 @@ func uploadFilesToBucket(client *gcsClient, args *uploadArgs, openedFiles []uplo
292292
// Upload each file in parallel
293293
for fileIndex, openedFile := range openedFiles {
294294

295-
openedFile := openedFile
296-
297295
uploadPool.Go(func(ctx context.Context) error {
298296
progressFn := func(bytesWritten int64) { progress.SetValue(fileIndex, float64(bytesWritten)) }
299297

internal/api/api.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"net/url"
1313
"os"
1414
"runtime"
15+
"strings"
1516

1617
ioaux "github.com/jig/teereadcloser"
1718
"github.com/kballard/go-shellquote"
@@ -371,18 +372,19 @@ func (r *request) curlCmd() (string, error) {
371372
return "", err
372373
}
373374

374-
s := "curl \\\n"
375+
var s strings.Builder
376+
s.WriteString("curl \\\n")
375377
if r.client.opts.AccessToken != "" {
376-
s += fmt.Sprintf(" %s \\\n", shellquote.Join("-H", "Authorization: token "+r.client.opts.AccessToken))
378+
s.WriteString(fmt.Sprintf(" %s \\\n", shellquote.Join("-H", "Authorization: token "+r.client.opts.AccessToken)))
377379
}
378380
// Preserve overrides if Content-Type is set
379381
if r.client.opts.AdditionalHeaders["Content-Type"] == "" {
380382
r.client.opts.AdditionalHeaders["Content-Type"] = "application/json"
381383
}
382384
for k, v := range r.client.opts.AdditionalHeaders {
383-
s += fmt.Sprintf(" %s \\\n", shellquote.Join("-H", k+": "+v))
385+
s.WriteString(fmt.Sprintf(" %s \\\n", shellquote.Join("-H", k+": "+v)))
384386
}
385-
s += fmt.Sprintf(" %s \\\n", shellquote.Join("-d", string(data)))
386-
s += fmt.Sprintf(" %s", shellquote.Join(r.client.opts.EndpointURL.JoinPath(".api/graphql").String()))
387-
return s, nil
387+
s.WriteString(fmt.Sprintf(" %s \\\n", shellquote.Join("-d", string(data))))
388+
s.WriteString(fmt.Sprintf(" %s", shellquote.Join(r.client.opts.EndpointURL.JoinPath(".api/graphql").String())))
389+
return s.String(), nil
388390
}

internal/api/test_unix_socket_server.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ func StartUnixSocketServer(socketPath string) (*Server, error) {
5757
StopChan: make(chan struct{}),
5858
}
5959

60-
server.Wg.Add(1)
61-
go func() {
62-
defer server.Wg.Done()
60+
server.Wg.Go(func() {
6361
for {
6462
conn, err := server.Listener.Accept()
6563
if err != nil {
@@ -96,7 +94,7 @@ func StartUnixSocketServer(socketPath string) (*Server, error) {
9694
}
9795
}(conn)
9896
}
99-
}()
97+
})
10098

10199
return server, nil
102100
}

internal/batches/service/service.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,7 @@ func (svc *Service) EnsureDockerImages(
337337
}
338338
var wg sync.WaitGroup
339339
for i := 0; i < parallelism; i++ {
340-
wg.Add(1)
341-
go func() {
342-
defer wg.Done()
340+
wg.Go(func() {
343341
for {
344342
select {
345343
case <-workerCtx.Done():
@@ -363,7 +361,7 @@ func (svc *Service) EnsureDockerImages(
363361
}
364362
}
365363
}
366-
}()
364+
})
367365
}
368366

369367
go func() {

0 commit comments

Comments
 (0)