mirror of
https://github.com/kataras/iris.git
synced 2025-03-14 02:56:26 +01:00
minor
This commit is contained in:
parent
b0ccd579af
commit
193de00426
|
@ -16,8 +16,10 @@ import (
|
|||
|
||||
var (
|
||||
// BuildRevision holds the vcs commit id information.
|
||||
// Available at go version 1.18+
|
||||
BuildRevision = context.BuildRevision
|
||||
// BuildTime holds the vcs commit time information.
|
||||
// Available at go version 1.18+
|
||||
BuildTime = context.BuildTime
|
||||
)
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ import (
|
|||
"path/filepath"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"runtime/debug"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -48,29 +47,13 @@ import (
|
|||
|
||||
var (
|
||||
// BuildRevision holds the vcs commit id information.
|
||||
// Available at go version 1.18+
|
||||
BuildRevision string
|
||||
// BuildTime holds the vcs commit time information.
|
||||
// Available at go version 1.18+
|
||||
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 (
|
||||
// BodyDecoder is an interface which any struct can implement in order to customize the decode action
|
||||
// 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