go-ethereum/internal/version/version.go
2025-11-15 16:46:54 +05:30

52 lines
1.7 KiB
Go

// Copyright 2022 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// Package version implements reading of build version information.
package version
import (
"fmt"
"github.com/XinFinOrg/XDPoSChain/version"
)
const ourPath = "github.com/XinFinOrg/XDPoSChain" // Path to our module
// Family holds the textual version string for major.minor
var Family = fmt.Sprintf("%d.%d", version.Major, version.Minor)
// Semantic holds the textual version string for major.minor.patch.
var Semantic = fmt.Sprintf("%d.%d.%d", version.Major, version.Minor, version.Patch)
// WithMeta holds the textual version string including the metadata.
var WithMeta = func() string {
v := Semantic
if version.Meta != "" {
v += "-" + version.Meta
}
return v
}()
func WithCommit(gitCommit, gitDate string) string {
vsn := WithMeta
if len(gitCommit) >= 8 {
vsn += "-" + gitCommit[:8]
}
if (version.Meta != "stable") && (gitDate != "") {
vsn += "-" + gitDate
}
return vsn
}