tstest/integration/vms: use hujson.Standardize instead of hujson.Unmarshal (#4520)

The hujson package transition to just being a pure AST
parser and formatter for HuJSON and not an unmarshaler.

Thus, parse HuJSON as such, convert it to JSON,
and then use the standard JSON unmarshaler.

Signed-off-by: Joe Tsai <joetsai@digital-static.net>
This commit is contained in:
Joe Tsai
2022-05-06 14:16:10 -07:00
committed by GitHub
parent 9f3ad40707
commit 741ae9956e
3 changed files with 11 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ package vms
import (
_ "embed"
"encoding/json"
"log"
"github.com/tailscale/hujson"
@@ -53,10 +54,12 @@ var distroData string
var Distros []Distro = func() []Distro {
var result []Distro
err := hujson.Unmarshal([]byte(distroData), &result)
b, err := hujson.Standardize([]byte(distroData))
if err != nil {
log.Fatalf("error decoding distros: %v", err)
}
if err := json.Unmarshal(b, &result); err != nil {
log.Fatalf("error decoding distros: %v", err)
}
return result
}()