Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6acf82

Browse files
committed
:||
1 parent d572dfa commit e6acf82

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

coderd/provisionerdserver/provisionerdserver.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,15 +1452,16 @@ func (s *server) CompleteJob(ctx context.Context, completed *proto.CompletedJob)
14521452

14531453
// nolint:gocritic // Requires reading "system" files
14541454
file, err := tx.GetFileByHashAndCreator(dbauthz.AsSystemRestricted(ctx), database.GetFileByHashAndCreatorParams{Hash: hash, CreatedBy: uuid.Nil})
1455-
if err == nil {
1455+
switch {
1456+
case err == nil:
14561457
// This set of modules is already cached, which means we can reuse them
14571458
fileID = uuid.NullUUID{
14581459
Valid: true,
14591460
UUID: file.ID,
14601461
}
1461-
} else if !xerrors.Is(err, sql.ErrNoRows) {
1462+
case !xerrors.Is(err, sql.ErrNoRows):
14621463
return xerrors.Errorf("check for cached modules: %w", err)
1463-
} else {
1464+
default:
14641465
// nolint:gocritic // Requires creating a "system" file
14651466
file, err = tx.InsertFile(dbauthz.AsSystemRestricted(ctx), database.InsertFileParams{
14661467
ID: uuid.New(),

0 commit comments

Comments
 (0)