mirror of
https://github.com/beego/bee.git
synced 2024-11-01 00:00:53 +00:00
truncate before overwritten
This commit is contained in:
parent
05882bb4f6
commit
97ea34cc80
@ -731,7 +731,7 @@ func writeModelFiles(tables []*Table, mPath string, selectedTables map[string]bo
|
|||||||
if isExist(fpath) {
|
if isExist(fpath) {
|
||||||
ColorLog("[WARN] %v is exist, do you want to overwrite it? Yes or No?\n", fpath)
|
ColorLog("[WARN] %v is exist, do you want to overwrite it? Yes or No?\n", fpath)
|
||||||
if askForConfirmation() {
|
if askForConfirmation() {
|
||||||
f, err = os.OpenFile(fpath, os.O_RDWR, 0666)
|
f, err = os.OpenFile(fpath, os.O_RDWR|os.O_TRUNC, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ColorLog("[WARN] %v\n", err)
|
ColorLog("[WARN] %v\n", err)
|
||||||
continue
|
continue
|
||||||
@ -793,7 +793,7 @@ func writeControllerFiles(tables []*Table, cPath string, selectedTables map[stri
|
|||||||
if isExist(fpath) {
|
if isExist(fpath) {
|
||||||
ColorLog("[WARN] %v is exist, do you want to overwrite it? Yes or No?\n", fpath)
|
ColorLog("[WARN] %v is exist, do you want to overwrite it? Yes or No?\n", fpath)
|
||||||
if askForConfirmation() {
|
if askForConfirmation() {
|
||||||
f, err = os.OpenFile(fpath, os.O_RDWR, 0666)
|
f, err = os.OpenFile(fpath, os.O_RDWR|os.O_TRUNC, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ColorLog("[WARN] %v\n", err)
|
ColorLog("[WARN] %v\n", err)
|
||||||
continue
|
continue
|
||||||
@ -848,7 +848,7 @@ func writeRouterFile(tables []*Table, rPath string, selectedTables map[string]bo
|
|||||||
if isExist(fpath) {
|
if isExist(fpath) {
|
||||||
ColorLog("[WARN] %v is exist, do you want to overwrite it? Yes or No?\n", fpath)
|
ColorLog("[WARN] %v is exist, do you want to overwrite it? Yes or No?\n", fpath)
|
||||||
if askForConfirmation() {
|
if askForConfirmation() {
|
||||||
f, err = os.OpenFile(fpath, os.O_RDWR, 0666)
|
f, err = os.OpenFile(fpath, os.O_RDWR|os.O_TRUNC, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ColorLog("[WARN] %v\n", err)
|
ColorLog("[WARN] %v\n", err)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user