♻️ Refactor Go to err != nil, err == nil (#12385)

This commit is contained in:
Oleksandr Redko 2024-09-04 04:40:50 +03:00 committed by GitHub
parent 473a159ef2
commit b100721fee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
147 changed files with 1661 additions and 1659 deletions

View file

@ -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