mirror of
https://github.com/kataras/iris.git
synced 2025-03-15 12:26:29 +01:00
minor
This commit is contained in:
parent
b0ccd579af
commit
193de00426
|
@ -16,8 +16,10 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// BuildRevision holds the vcs commit id information.
|
// BuildRevision holds the vcs commit id information.
|
||||||
|
// Available at go version 1.18+
|
||||||
BuildRevision = context.BuildRevision
|
BuildRevision = context.BuildRevision
|
||||||
// BuildTime holds the vcs commit time information.
|
// BuildTime holds the vcs commit time information.
|
||||||
|
// Available at go version 1.18+
|
||||||
BuildTime = context.BuildTime
|
BuildTime = context.BuildTime
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime/debug"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -48,29 +47,13 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// BuildRevision holds the vcs commit id information.
|
// BuildRevision holds the vcs commit id information.
|
||||||
|
// Available at go version 1.18+
|
||||||
BuildRevision string
|
BuildRevision string
|
||||||
// BuildTime holds the vcs commit time information.
|
// BuildTime holds the vcs commit time information.
|
||||||
|
// Available at go version 1.18+
|
||||||
BuildTime string
|
BuildTime string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
if info, ok := debug.ReadBuildInfo(); ok {
|
|
||||||
for _, setting := range info.Settings {
|
|
||||||
if BuildRevision != "" && BuildTime != "" {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
if setting.Key == "vcs.revision" {
|
|
||||||
BuildRevision = setting.Value
|
|
||||||
}
|
|
||||||
|
|
||||||
if setting.Key == "vcs.time" {
|
|
||||||
BuildTime = setting.Key
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// BodyDecoder is an interface which any struct can implement in order to customize the decode action
|
// BodyDecoder is an interface which any struct can implement in order to customize the decode action
|
||||||
// from ReadJSON and ReadXML
|
// from ReadJSON and ReadXML
|
||||||
|
|
23
context/context_go118.go
Normal file
23
context/context_go118.go
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
//go:build go1.18
|
||||||
|
|
||||||
|
package context
|
||||||
|
|
||||||
|
import "runtime/debug"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if info, ok := debug.ReadBuildInfo(); ok {
|
||||||
|
for _, setting := range info.Settings {
|
||||||
|
if BuildRevision != "" && BuildTime != "" {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
if setting.Key == "vcs.revision" {
|
||||||
|
BuildRevision = setting.Value
|
||||||
|
}
|
||||||
|
|
||||||
|
if setting.Key == "vcs.time" {
|
||||||
|
BuildTime = setting.Key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user