Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7fc8ead

Browse files
committed
Use fatal over panic
1 parent3bfd4d6 commit7fc8ead

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎coderd/database/databasefake/generator.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ func (g *Generator) User(ctx context.Context, seed database.User) database.User
140140
// Populate uses `require` which calls `t.FailNow()` and must be called from the
141141
// go routine running the test or benchmark function.
142142
func (g*Generator)Populate(ctx context.Context,seedmap[string]interface{})map[string]interface{} {
143+
g.testT.Helper()
143144
db:=g.db
144145
t:=g.testT
145146

@@ -346,7 +347,8 @@ func (g *Generator) Populate(ctx context.Context, seed map[string]interface{}) m
346347

347348
output[name]=link
348349
default:
349-
panic(fmt.Sprintf("unknown type %T",orig))
350+
// If you hit this, just add your type to the switch.
351+
t.Fatalf("unknown type '%T' used in fake data generator",orig)
350352
}
351353
}
352354
returnoutput

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp