mirror of
https://gitee.com/johng/gf
synced 2026-06-06 02:25:47 +08:00
add gdebug.BuildInfo function; improving gproc
This commit is contained in:
@ -10,6 +10,7 @@ package gdebug
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/gogf/gf"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
@ -28,6 +29,9 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
buildTime = "" // Binary time string, which is injected from "go build -ldflags '-X importpath.name=value'".
|
||||
buildGoVersion = "" // Binary go version, which is injected from "go build -ldflags '-X importpath.name=value'".
|
||||
buildGitCommit = "" // Binary git commit, which is injected from "go build -ldflags '-X importpath.name=value'".
|
||||
goRootForFilter = runtime.GOROOT() // goRootForFilter is used for stack filtering purpose.
|
||||
binaryVersion = "" // The version of current running binary(uint64 hex).
|
||||
binaryVersionMd5 = "" // The version of current running binary(MD5).
|
||||
@ -39,6 +43,18 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
// BuildInfo returns the built information of the binary.
|
||||
// Note that it should be used with gf-cli tool: gf build,
|
||||
// which injects necessary information into the binary.
|
||||
func BuildInfo() map[string]string {
|
||||
return map[string]string{
|
||||
"gf": gf.VERSION,
|
||||
"go": buildGoVersion,
|
||||
"git": buildGitCommit,
|
||||
"time": buildTime,
|
||||
}
|
||||
}
|
||||
|
||||
// BinVersion returns the version of current running binary.
|
||||
// It uses ghash.BKDRHash+BASE36 algorithm to calculate the unique version of the binary.
|
||||
func BinVersion() string {
|
||||
|
||||
Reference in New Issue
Block a user