mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
♻️ Refactor Go to err != nil, err == nil (#12385)
This commit is contained in:
parent
473a159ef2
commit
b100721fee
147 changed files with 1661 additions and 1659 deletions
|
|
@ -49,7 +49,7 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string) (retID string
|
|||
if nil != preferredParent && preferredParent.ID == parentID {
|
||||
// 如果父文档存在且 ID 一致,则直接在父文档下创建
|
||||
p := strings.TrimSuffix(preferredParent.Path, ".sy") + "/" + id + ".sy"
|
||||
if _, err = createDoc(boxID, p, name, content); nil != err {
|
||||
if _, err = createDoc(boxID, p, name, content); err != nil {
|
||||
logging.LogErrorf("create doc [%s] failed: %s", p, err)
|
||||
}
|
||||
return
|
||||
|
|
@ -101,18 +101,18 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string) (retID string
|
|||
pathBuilder.WriteString(rootID)
|
||||
docP := pathBuilder.String() + ".sy"
|
||||
if isNotLast {
|
||||
if _, err = createDoc(boxID, docP, part, ""); nil != err {
|
||||
if _, err = createDoc(boxID, docP, part, ""); err != nil {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if _, err = createDoc(boxID, docP, part, content); nil != err {
|
||||
if _, err = createDoc(boxID, docP, part, content); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if isNotLast {
|
||||
dirPath := filepath.Join(util.DataDir, boxID, pathBuilder.String())
|
||||
if err = os.MkdirAll(dirPath, 0755); nil != err {
|
||||
if err = os.MkdirAll(dirPath, 0755); err != nil {
|
||||
logging.LogErrorf("mkdir [%s] failed: %s", dirPath, err)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue