Skip to content

Commit 92e5a24

Browse files
authored
Fix typo in create_function_stmt.go comment (#4147)
1 parent 5cca6f1 commit 92e5a24

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

‎internal/cmd/vet.go‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"runtime/trace"
1515
"slices"
1616
"strings"
17+
"sync"
1718
"time"
1819

1920
_ "github.com/go-sql-driver/mysql"
@@ -386,6 +387,7 @@ type checker struct {
386387
Stderr io.Writer
387388
OnlyManagedDB bool
388389
Client dbmanager.Client
390+
clientOnce sync.Once
389391
Replacer *shfmt.Replacer
390392
}
391393

@@ -402,11 +404,10 @@ func (c *checker) fetchDatabaseUri(ctx context.Context, s config.SQL) (string, f
402404
return uri, cleanup, err
403405
}
404406

405-
if c.Client == nil {
406-
// FIXME: Eventual race condition
407-
client := dbmanager.NewClient(c.Conf.Servers)
408-
c.Client = client
409-
}
407+
// Initialize the client exactly once, even if called concurrently
408+
c.clientOnce.Do(func() {
409+
c.Client = dbmanager.NewClient(c.Conf.Servers)
410+
})
410411

411412
var ddl []string
412413
files, err := sqlpath.Glob(s.Schema)

‎internal/sql/ast/create_function_stmt.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type CreateFunctionStmt struct {
55
Params *List
66
ReturnType *TypeName
77
Func *FuncName
8-
// TODO: Undertand these two fields
8+
// TODO: Understand these two fields
99
Options *List
1010
WithClause *List
1111
}

0 commit comments

Comments
 (0)