Skip to content

Commit 97e7be9

Browse files
authored
Merge pull request #2157 from morya/main
FIX: code too complicated
2 parents 805f319 + 5cfe04e commit 97e7be9

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

server/service/system/sys_initdb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func createDatabase(dsn string, driver string, createSql string) error {
160160
// createTables 创建表(默认 dbInitHandler.initTables 行为)
161161
func createTables(ctx context.Context, inits initSlice) error {
162162
next, cancel := context.WithCancel(ctx)
163-
defer func(c func()) { c() }(cancel)
163+
defer cancel()
164164
for _, init := range inits {
165165
if init.TableCreated(next) {
166166
continue

server/service/system/sys_initdb_mssql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (h MssqlInitHandler) InitTables(ctx context.Context, inits initSlice) error
7373

7474
func (h MssqlInitHandler) InitData(ctx context.Context, inits initSlice) error {
7575
next, cancel := context.WithCancel(ctx)
76-
defer func(c func()) { c() }(cancel)
76+
defer cancel()
7777
for _, init := range inits {
7878
if init.DataInserted(next) {
7979
color.Info.Printf(InitDataExist, Mssql, init.InitializerName())

server/service/system/sys_initdb_mysql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (h MysqlInitHandler) InitTables(ctx context.Context, inits initSlice) error
7878

7979
func (h MysqlInitHandler) InitData(ctx context.Context, inits initSlice) error {
8080
next, cancel := context.WithCancel(ctx)
81-
defer func(c func()) { c() }(cancel)
81+
defer cancel()
8282
for _, init := range inits {
8383
if init.DataInserted(next) {
8484
color.Info.Printf(InitDataExist, Mysql, init.InitializerName())

server/service/system/sys_initdb_pgsql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (h PgsqlInitHandler) InitTables(ctx context.Context, inits initSlice) error
8282

8383
func (h PgsqlInitHandler) InitData(ctx context.Context, inits initSlice) error {
8484
next, cancel := context.WithCancel(ctx)
85-
defer func(c func()) { c() }(cancel)
85+
defer cancel()
8686
for i := 0; i < len(inits); i++ {
8787
if inits[i].DataInserted(next) {
8888
color.Info.Printf(InitDataExist, Pgsql, inits[i].InitializerName())

server/service/system/sys_initdb_sqlite.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (h SqliteInitHandler) InitTables(ctx context.Context, inits initSlice) erro
6969

7070
func (h SqliteInitHandler) InitData(ctx context.Context, inits initSlice) error {
7171
next, cancel := context.WithCancel(ctx)
72-
defer func(c func()) { c() }(cancel)
72+
defer cancel()
7373
for _, init := range inits {
7474
if init.DataInserted(next) {
7575
color.Info.Printf(InitDataExist, Sqlite, init.InitializerName())

0 commit comments

Comments
 (0)