aboutsummaryrefslogtreecommitdiff
path: root/android/android.go
diff options
context:
space:
mode:
Diffstat (limited to 'android/android.go')
-rw-r--r--android/android.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/android/android.go b/android/android.go
new file mode 100644
index 00000000..a06e657d
--- /dev/null
+++ b/android/android.go
@@ -0,0 +1,20 @@
+// Package android provides android-specific extensions to the upstream module.
+package android
+
+import "google.golang.org/protobuf/internal/detrand"
+
+// DisableRand disables the randomness introduced into JSON and Text encodings.
+// This function is not concurrent-safe and must be called during program init.
+//
+// This does not guarantee long term stability of the JSON/Text encodings, but
+// that isn't necessary in Soong or similar build tools. They are only
+// interested in longer stable periods, as any change in the output may
+// introduce significant extra building during incremental builds. That price
+// is expected when upgrading library versions (and will be paid then even
+// without a format change, as the reader and writer packages will often both
+// change), but is not desired when changing other parts of the executables.
+//
+// See https://github.com/golang/protobuf/issues/1121 for more discussion.
+func DisableRand() {
+ detrand.Disable()
+}