From d5e1721d1f30af823df08b7f709b3f117b8e108b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 14 Jun 2022 22:40:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=88=9B=E5=BB=BA=20.gitignore=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- git.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/git.go b/git.go index b24bb5d..8243b09 100644 --- a/git.go +++ b/git.go @@ -7,7 +7,11 @@ // Date : 2022-06-14 20:02 package command -import "git.zhangdeman.cn/zhangdeman/command/define" +import ( + "os" + + "git.zhangdeman.cn/zhangdeman/command/define" +) // Git ... // @@ -139,10 +143,11 @@ release } // 将信息写入文件 return &define.Result{ - WorkDir: g.workDir, - CmdPath: "", - Param: nil, - Error: File(g.workDir, ".gitignore").Write([]byte(baseFileContent)), + WorkDir: g.workDir, + CmdPath: "", + Param: nil, + Error: File(g.workDir, ".gitignore").AutoCreate().SetClearHasContentForWrite(). + SetOpenFlag(os.O_TRUNC, os.O_RDWR, os.O_CREATE).Write([]byte(baseFileContent)), Output: nil, StartTime: 0, FinishTime: 0,