x/ref: Move x/ref/lib/flags/buildinfo to x/lib/buildinfo
This reduces package nesting, and is also nicer since the
devtools/v23 tool uses this mechanism, and it's better for v23 to
have absolutely no dependencies on x/ref/...
MultiPart: 2/3
Change-Id: Ifee7aa2443e0b71852a7f03cca1d690628ba75c0
diff --git a/lib/flags/buildinfo/buildinfo.go b/lib/flags/buildinfo/buildinfo.go
deleted file mode 100644
index 133ba1a..0000000
--- a/lib/flags/buildinfo/buildinfo.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2015 The Vanadium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package buildinfo
-
-import (
- "encoding/json"
- "runtime"
-)
-
-// These variables are filled in at link time, using:
-// -ldflags "-X v.io/x/ref/lib/flags/buildinfo.<varname> <value>"
-var timestamp, username, platform string
-
-// T describes binary metadata.
-type T struct {
- GoVersion, BuildTimestamp, BuildUser, BuildPlatform string
-}
-
-var info T
-
-func init() {
- info = T{
- GoVersion: runtime.Version(),
- BuildTimestamp: timestamp,
- BuildUser: username,
- BuildPlatform: platform,
- }
-}
-
-// Info returns metadata about the current binary.
-func Info() *T {
- return &info
-}
-
-// String returns the binary metadata as a JSON-encoded string, under the
-// expectation that clients may want to parse it for specific bits of metadata.
-func (t *T) String() string {
- jsonT, err := json.Marshal(t)
- if err != nil {
- return ""
- }
- return string(jsonT)
-}
diff --git a/lib/flags/buildinfo/doc.go b/lib/flags/buildinfo/doc.go
deleted file mode 100644
index 622215e..0000000
--- a/lib/flags/buildinfo/doc.go
+++ /dev/null
@@ -1,6 +0,0 @@
-// Copyright 2015 The Vanadium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package buildinfo provides build-time metadata about the binary.
-package buildinfo
diff --git a/lib/flags/flags.go b/lib/flags/flags.go
index 0261ae6..20b0b3b 100644
--- a/lib/flags/flags.go
+++ b/lib/flags/flags.go
@@ -12,8 +12,8 @@
"sync"
"v.io/v23/verror"
+ "v.io/x/lib/buildinfo"
"v.io/x/ref/envvar"
- "v.io/x/ref/lib/flags/buildinfo"
)
const pkgPath = "v.io/x/ref/lib/flags"
diff --git a/lib/stats/sysstats/sysstats.go b/lib/stats/sysstats/sysstats.go
index 86772fd..49ad421 100644
--- a/lib/stats/sysstats/sysstats.go
+++ b/lib/stats/sysstats/sysstats.go
@@ -14,7 +14,7 @@
"strings"
"time"
- "v.io/x/ref/lib/flags/buildinfo"
+ "v.io/x/lib/buildinfo"
"v.io/x/ref/lib/stats"
)
diff --git a/profiles/internal/rt/runtime.go b/profiles/internal/rt/runtime.go
index 83dd024..41fc442 100644
--- a/profiles/internal/rt/runtime.go
+++ b/profiles/internal/rt/runtime.go
@@ -23,10 +23,9 @@
"v.io/v23/security"
"v.io/v23/verror"
"v.io/v23/vtrace"
+ "v.io/x/lib/buildinfo"
"v.io/x/lib/vlog"
-
"v.io/x/ref/lib/flags"
- "v.io/x/ref/lib/flags/buildinfo"
"v.io/x/ref/lib/stats"
_ "v.io/x/ref/lib/stats/sysstats"
"v.io/x/ref/profiles/internal/lib/dependency"
diff --git a/services/device/internal/impl/device_service.go b/services/device/internal/impl/device_service.go
index 0a1b8d8..ff65e69 100644
--- a/services/device/internal/impl/device_service.go
+++ b/services/device/internal/impl/device_service.go
@@ -61,8 +61,8 @@
"v.io/v23/services/binary"
"v.io/v23/services/device"
"v.io/v23/verror"
+ "v.io/x/lib/buildinfo"
"v.io/x/lib/vlog"
- "v.io/x/ref/lib/flags/buildinfo"
"v.io/x/ref/envvar"
vexec "v.io/x/ref/lib/exec"