mirror of
https://github.com/go-delve/delve.git
synced 2025-10-28 12:47:22 +08:00
version: remove build constraint (#3998)
Remove the go1.18 build constraint, we no longer build on go1.17 or earlier.
This commit is contained in:
committed by
GitHub
parent
423b29b5ac
commit
64ac23de8c
@ -1,39 +0,0 @@
|
|||||||
//go:build go1.18
|
|
||||||
|
|
||||||
package version
|
|
||||||
|
|
||||||
import (
|
|
||||||
"runtime/debug"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
fixBuild = buildInfoFixBuild
|
|
||||||
}
|
|
||||||
|
|
||||||
func buildInfoFixBuild(v *Version) {
|
|
||||||
// Return if v.Build already set, but not if it is Git ident expand file blob hash
|
|
||||||
if !strings.HasPrefix(v.Build, "$Id: ") && !strings.HasSuffix(v.Build, " $") {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
info, ok := debug.ReadBuildInfo()
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, setting := range info.Settings {
|
|
||||||
if setting.Key == "vcs.revision" {
|
|
||||||
v.Build = setting.Value
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we didn't find vcs.revision, try the old key for backward compatibility
|
|
||||||
for _, setting := range info.Settings {
|
|
||||||
if setting.Key == "gitrevision" {
|
|
||||||
v.Build = setting.Value
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -3,6 +3,8 @@ package version
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"runtime/debug"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version represents the current version of Delve.
|
// Version represents the current version of Delve.
|
||||||
@ -37,6 +39,29 @@ func BuildInfo() string {
|
|||||||
return fmt.Sprintf("%s\n%s", runtime.Version(), buildInfo())
|
return fmt.Sprintf("%s\n%s", runtime.Version(), buildInfo())
|
||||||
}
|
}
|
||||||
|
|
||||||
var fixBuild = func(v *Version) {
|
func fixBuild(v *Version) {
|
||||||
// does nothing
|
// Return if v.Build already set, but not if it is Git ident expand file blob hash
|
||||||
|
if !strings.HasPrefix(v.Build, "$Id$") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
info, ok := debug.ReadBuildInfo()
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, setting := range info.Settings {
|
||||||
|
if setting.Key == "vcs.revision" {
|
||||||
|
v.Build = setting.Value
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we didn't find vcs.revision, try the old key for backward compatibility
|
||||||
|
for _, setting := range info.Settings {
|
||||||
|
if setting.Key == "gitrevision" {
|
||||||
|
v.Build = setting.Value
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user