Browse Source

goreleaser ok

pull/27/head v1.0.1
yedf2 5 years ago
parent
commit
72f19274ad
  1. 7
      common/utils.go

7
common/utils.go

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

Loading…
Cancel
Save