goreleaser ok
This commit is contained in:
parent
53c8ed78eb
commit
72f19274ad
@ -7,6 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@ -71,5 +72,9 @@ func MustGetwd() string {
|
|||||||
// GetCurrentCodeDir 获取当前源代码的目录,主要用于测试时,查找相关文件
|
// GetCurrentCodeDir 获取当前源代码的目录,主要用于测试时,查找相关文件
|
||||||
func GetCurrentCodeDir() string {
|
func GetCurrentCodeDir() string {
|
||||||
_, file, _, _ := runtime.Caller(1)
|
_, 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…
x
Reference in New Issue
Block a user