diff --git a/cmd/gf/internal/cmd/gendao/gendao_clear.go b/cmd/gf/internal/cmd/gendao/gendao_clear.go index 9cc7a7823..4eb69d4c3 100644 --- a/cmd/gf/internal/cmd/gendao/gendao_clear.go +++ b/cmd/gf/internal/cmd/gendao/gendao_clear.go @@ -9,13 +9,13 @@ import ( "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" ) -func doClear(ctx context.Context, dirPath string) { +func doClear(ctx context.Context, dirPath string, force bool) { files, err := gfile.ScanDirFile(dirPath, "*.go", true) if err != nil { mlog.Fatal(err) } for _, file := range files { - if utils.IsFileDoNotEdit(file) { + if force || utils.IsFileDoNotEdit(file) { if err = gfile.Remove(file); err != nil { mlog.Print(err) } diff --git a/cmd/gf/internal/cmd/gendao/gendao_dao.go b/cmd/gf/internal/cmd/gendao/gendao_dao.go index 392385451..167ff6c46 100644 --- a/cmd/gf/internal/cmd/gendao/gendao_dao.go +++ b/cmd/gf/internal/cmd/gendao/gendao_dao.go @@ -6,12 +6,13 @@ import ( "fmt" "strings" + "github.com/olekukonko/tablewriter" + "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" - "github.com/olekukonko/tablewriter" "github.com/gogf/gf/cmd/gf/v2/internal/consts" "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" @@ -24,7 +25,7 @@ func generateDao(ctx context.Context, in CGenDaoInternalInput) { dirPathDaoInternal = gfile.Join(dirPathDao, "internal") ) if in.Clear { - doClear(ctx, dirPathDao) + doClear(ctx, dirPathDao, true) } for i := 0; i < len(in.TableNames); i++ { generateDaoSingle(ctx, generateDaoSingleInput{ diff --git a/cmd/gf/internal/cmd/gendao/gendao_do.go b/cmd/gf/internal/cmd/gendao/gendao_do.go index 7da4fda96..482ad4398 100644 --- a/cmd/gf/internal/cmd/gendao/gendao_do.go +++ b/cmd/gf/internal/cmd/gendao/gendao_do.go @@ -18,7 +18,7 @@ import ( func generateDo(ctx context.Context, in CGenDaoInternalInput) { var dirPathDo = gfile.Join(in.Path, in.DoPath) if in.Clear { - doClear(ctx, dirPathDo) + doClear(ctx, dirPathDo, false) } in.NoJsonTag = true in.DescriptionTag = false diff --git a/cmd/gf/internal/cmd/gendao/gendao_entity.go b/cmd/gf/internal/cmd/gendao/gendao_entity.go index e5afcc86a..501a7a292 100644 --- a/cmd/gf/internal/cmd/gendao/gendao_entity.go +++ b/cmd/gf/internal/cmd/gendao/gendao_entity.go @@ -16,7 +16,7 @@ import ( func generateEntity(ctx context.Context, in CGenDaoInternalInput) { var dirPathEntity = gfile.Join(in.Path, in.EntityPath) if in.Clear { - doClear(ctx, dirPathEntity) + doClear(ctx, dirPathEntity, false) } // Model content. for i, tableName := range in.TableNames { diff --git a/version.go b/version.go index 0443f5247..13ced56fc 100644 --- a/version.go +++ b/version.go @@ -2,5 +2,5 @@ package gf const ( // VERSION is the current GoFrame version. - VERSION = "v2.3.2" + VERSION = "v2.3.3" )