mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
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:
@@ -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
|
||||
}()
|
||||
|
Reference in New Issue
Block a user