mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-28 12:28:48 +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
|
|
@ -36,7 +36,7 @@ func zip(c *gin.Context) {
|
|||
|
||||
entryPath := arg["path"].(string)
|
||||
entryAbsPath, err := util.GetAbsPathInWorkspace(entryPath)
|
||||
if nil != err {
|
||||
if err != nil {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
|
|
@ -44,14 +44,14 @@ func zip(c *gin.Context) {
|
|||
|
||||
zipFilePath := arg["zipPath"].(string)
|
||||
zipAbsFilePath, err := util.GetAbsPathInWorkspace(zipFilePath)
|
||||
if nil != err {
|
||||
if err != nil {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
zipFile, err := gulu.Zip.Create(zipAbsFilePath)
|
||||
if nil != err {
|
||||
if err != nil {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
|
|
@ -63,13 +63,13 @@ func zip(c *gin.Context) {
|
|||
} else {
|
||||
err = zipFile.AddEntry(base, entryAbsPath)
|
||||
}
|
||||
if nil != err {
|
||||
if err != nil {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
if err = zipFile.Close(); nil != err {
|
||||
if err = zipFile.Close(); err != nil {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
|
|
@ -87,7 +87,7 @@ func unzip(c *gin.Context) {
|
|||
|
||||
zipFilePath := arg["zipPath"].(string)
|
||||
zipAbsFilePath, err := util.GetAbsPathInWorkspace(zipFilePath)
|
||||
if nil != err {
|
||||
if err != nil {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
|
|
@ -95,13 +95,13 @@ func unzip(c *gin.Context) {
|
|||
|
||||
entryPath := arg["path"].(string)
|
||||
entryAbsPath, err := util.GetAbsPathInWorkspace(entryPath)
|
||||
if nil != err {
|
||||
if err != nil {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
if err := gulu.Zip.Unzip(zipAbsFilePath, entryAbsPath); nil != err {
|
||||
if err := gulu.Zip.Unzip(zipAbsFilePath, entryAbsPath); err != nil {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue