optimize gormSourceDir replace
This commit is contained in:
parent
ac722c16f9
commit
942a65f5e4
@ -4,7 +4,6 @@ import (
|
|||||||
"database/sql/driver"
|
"database/sql/driver"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -15,7 +14,7 @@ var gormSourceDir string
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
_, file, _, _ := runtime.Caller(0)
|
_, file, _, _ := runtime.Caller(0)
|
||||||
gormSourceDir = regexp.MustCompile(`utils.utils\.go`).ReplaceAllString(file, "")
|
gormSourceDir = strings.Replace(file, `utils.utils.go`, "", -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func FileWithLineNum() string {
|
func FileWithLineNum() string {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user