Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Unified Diff: cipd/client/cipd/common/common.go

Issue 2653843003: Move arch+plat logic to common. (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cipd/client/cipd/client.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cipd/client/cipd/common/common.go
diff --git a/cipd/client/cipd/common/common.go b/cipd/client/cipd/common/common.go
index 91089274d34f49bbf6459bf7bd63ece0e15fc183..14764f2705bb0e3e716dc602e229cf51be76803d 100644
--- a/cipd/client/cipd/common/common.go
+++ b/cipd/client/cipd/common/common.go
@@ -8,6 +8,7 @@ package common
import (
"fmt"
"regexp"
+ "runtime"
"strings"
)
@@ -126,3 +127,35 @@ func GetInstanceTagKey(t string) string {
}
return chunks[0]
}
+
+var currentArchitecture = ""
+var currentPlatform = ""
+
+func init() {
+ // TODO(iannucci): rationalize these to just be exactly GOOS and GOARCH.
+ currentArchitecture = runtime.GOOS
+ if currentArchitecture == "darwin" {
+ currentArchitecture = "mac"
+ }
+
+ currentPlatform = runtime.GOARCH
+ if currentPlatform == "arm" {
+ currentPlatform = "armv6l"
+ }
+}
+
+// CurrentArchitecture returns the current cipd-style architecture that the
+// current go binary conforms to. Possible values:
+// - "armv6l" (if GOARCH=arm)
+// - other GOARCH values
+func CurrentArchitecture() string {
+ return currentArchitecture
+}
+
+// CurrentPlatform returns the current cipd-style platform that the
+// current go binary conforms to. Possible values:
+// - "mac" (if GOOS=darwin)
+// - other GOOS values
+func CurrentPlatform() string {
+ return currentPlatform
+}
« no previous file with comments | « cipd/client/cipd/client.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698