goreleaser ok

This commit is contained in:
yedf2 2021-09-04 08:01:06 +08:00
parent 53c8ed78eb
commit 72f19274ad

View File

@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"runtime"
"strings"
"time"
"github.com/gin-gonic/gin"
@ -71,5 +72,9 @@ func MustGetwd() string {
// GetCurrentCodeDir 获取当前源代码的目录,主要用于测试时,查找相关文件
func GetCurrentCodeDir() string {
_, file, _, _ := runtime.Caller(1)
return filepath.Dir(file)
wd := MustGetwd()
if strings.HasSuffix(wd, "/test") {
wd = filepath.Dir(wd)
}
return wd + "/" + filepath.Base(filepath.Dir(file))
}