catapult: Use Go v1.8 method of verifying JSON
json.Valid does not exist in the Go version used by our builders
IN-199
Change-Id: Ic11eae316780304cc696eae8fe36390f9d63b5e3
diff --git a/cmd/catapult/upload.go b/cmd/catapult/upload.go
index 92c8514..d516532 100644
--- a/cmd/catapult/upload.go
+++ b/cmd/catapult/upload.go
@@ -99,8 +99,10 @@
// structure of the data also but this isn't always practical. (For
// example, when parsing a dynamic schema such as Catapult's
// HistogramSet).
- if !json.Valid(requestBody) {
- return errors.New("input is not valid JSON")
+ // TODO(kjharland): use json.Valid after fuchsia's go is updated to v1.10
+ var ignored interface{}
+ if err := json.Unmarshal(requestBody, &ignored); err != nil {
+ return fmt.Errorf("input is not valid JSON: %v", err)
}
// URL encode the request body. This is weird but the Catapult dashboard