style(be):使用goimport 格式化代码并添加golangci

This commit is contained in:
neverteaser
2021-03-16 14:00:03 +08:00
committed by dushixiang
parent 88b0200095
commit d366cbd00d
40 changed files with 244 additions and 124 deletions

View File

@ -18,6 +18,7 @@ import (
"time"
"github.com/gofrs/uuid"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/bcrypt"
)
@ -103,10 +104,7 @@ func ImageToBase64Encode(img image.Image) (string, error) {
func FileExists(path string) bool {
_, err := os.Stat(path) //os.Stat获取文件信息
if err != nil {
if os.IsExist(err) {
return true
}
return false
return os.IsExist(err)
}
return true
}
@ -209,3 +207,9 @@ func StringToInt(in string) (out int) {
out, _ = strconv.Atoi(in)
return
}
func Check(f func() error) {
if err := f(); err != nil {
logrus.Error("Received error:", err)
}
}