@@ -0,0 +1,2 @@
|
||||
// Package vcs derives build version information from Go build metadata.
|
||||
package vcs
|
||||
@@ -0,0 +1,15 @@
|
||||
package vcs
|
||||
|
||||
import (
|
||||
"runtime/debug"
|
||||
)
|
||||
|
||||
// Version returns the main module version from Go build metadata.
|
||||
func Version() string {
|
||||
bi, ok := debug.ReadBuildInfo()
|
||||
if ok {
|
||||
return bi.Main.Version
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
Reference in New Issue
Block a user