Skip to content

Commit 2200d89

Browse files
committed
login cmd 使用 ioutil 写文件
1 parent 54cc3cb commit 2200d89

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cmd/login.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@ func saveCookie(cookies []*http.Cookie) error {
190190
if c == nil {
191191
return fmt.Errorf("Session Cookie 不存在")
192192
}
193-
f, err := os.OpenFile(cookieFile, os.O_WRONLY|os.O_CREATE, 0666)
194-
_, err = f.WriteString(c.Name + "=" + c.Value)
193+
err := ioutil.WriteFile(cookieFile, []byte(c.Name+"="+c.Value), 0666)
195194
if err != nil {
196195
return fmt.Errorf("保存 Session Cookie 失败,%v", err)
197196
}

0 commit comments

Comments
 (0)