aboutsummaryrefslogtreecommitdiffstats
path: root/library/go
diff options
context:
space:
mode:
authoralexv-smirnov <alex@ydb.tech>2022-08-18 16:52:30 +0300
committeralexv-smirnov <alex@ydb.tech>2022-08-18 16:52:30 +0300
commitc140abc954b61ab7d86af80bdeced01482d9971a (patch)
treec47d70fa3213240d5e0eb59787a5325782a360de /library/go
parent0ce07b9705ed20e3fce2759eae41496014ca4c33 (diff)
downloadydb-c140abc954b61ab7d86af80bdeced01482d9971a.tar.gz
temp fix ydb oss sync config to unlock sync on /vendor dependency
Diffstat (limited to 'library/go')
-rw-r--r--library/go/core/buildinfo/buildinfo.go68
1 files changed, 68 insertions, 0 deletions
diff --git a/library/go/core/buildinfo/buildinfo.go b/library/go/core/buildinfo/buildinfo.go
new file mode 100644
index 0000000000..cad0805d4f
--- /dev/null
+++ b/library/go/core/buildinfo/buildinfo.go
@@ -0,0 +1,68 @@
+package buildinfo
+
+import "strings"
+
+type BuildInfo struct {
+ // ProgramVersion is multiline string completely describing
+ // version of current binary.
+ //
+ // Svn info:
+ // URL: svn+ssh://arcadia.yandex.ru/arc/trunk/arcadia
+ // Last Changed Rev: 4479764
+ // Last Changed Author: robot-yappy
+ // Last Changed Date: 2019-02-19 16:33:55 +0300 (Tue, 19 Feb 2019)
+ //
+ // Other info:
+ // Build by: prime
+ // Top src dir: /home/prime/Code/go/src/a.yandex-team.ru
+ // Top build dir: /home/prime/.ya/build/build_root/qbh0/000002
+ // Hostname: 77.88.18.146-red.dhcp.yndx.net
+ // Host information:
+ // Linux 77.88.18.146-red.dhcp.yndx.net 4.19.10-300.fc29.x86_64 #1 SMP Mon Dec 17 15:34:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
+ ProgramVersion string
+
+ User string
+ Host string
+ Date string
+
+ // VCS is one of "svn", "arc", "hg", "git" or ""
+ VCS string
+
+ SVNRevision string
+ ArcadiaSourceRevision string
+ ArcadiaSourceLastChanged string
+ ArcadiaPatchNumber string
+ ArcadiaSourcePath string
+ BuildTimestamp string
+ Hash string
+ Tag string
+ Dirty string
+ Branch string
+}
+
+// Info holds information about current build.
+//
+// Info might not available in distributed build and when building from
+// IDE. Users of api must gracefully handle such cases.
+var Info BuildInfo
+
+// InitBuildInfo is internal, but exported API.
+//
+// This function is called from the main package by the code generated in build/scripts/vcs_info.py
+func InitBuildInfo(buildinfo map[string]string) {
+ Info.ProgramVersion = strings.TrimRight(buildinfo["PROGRAM_VERSION"], " ")
+ Info.User = buildinfo["BUILD_USER"]
+ Info.Host = buildinfo["BUILD_HOST"]
+ Info.Date = buildinfo["BUILD_DATE"]
+ Info.VCS = buildinfo["VCS"]
+ Info.SVNRevision = buildinfo["ARCADIA_SOURCE_REVISION"]
+ Info.ArcadiaSourceRevision = buildinfo["ARCADIA_SOURCE_REVISION"]
+ Info.ArcadiaSourceLastChanged = buildinfo["ARCADIA_SOURCE_LAST_CHANGE"]
+ Info.ArcadiaPatchNumber = buildinfo["ARCADIA_PATCH_NUMBER"]
+ Info.ArcadiaSourcePath = buildinfo["ARCADIA_SOURCE_PATH"]
+ Info.BuildTimestamp = buildinfo["BUILD_TIMESTAMP"]
+ Info.Hash = buildinfo["ARCADIA_SOURCE_HG_HASH"]
+ Info.Tag = buildinfo["ARCADIA_TAG"]
+ Info.Dirty = buildinfo["DIRTY"]
+ Info.Branch = buildinfo["BRANCH"]
+}