fortify: serialise ps with string as key
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
bf11241649
commit
f2869c4235
8
print.go
8
print.go
@ -175,7 +175,11 @@ func printPs(short bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if flagJSON {
|
if flagJSON {
|
||||||
printJSON(entries)
|
es := make(map[string]*state.State, len(entries))
|
||||||
|
for id, instance := range entries {
|
||||||
|
es[id.String()] = instance
|
||||||
|
}
|
||||||
|
printJSON(es)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +219,7 @@ func printJSON(v any) {
|
|||||||
encoder := json.NewEncoder(direct.Stdout)
|
encoder := json.NewEncoder(direct.Stdout)
|
||||||
encoder.SetIndent("", " ")
|
encoder.SetIndent("", " ")
|
||||||
if err := encoder.Encode(v); err != nil {
|
if err := encoder.Encode(v); err != nil {
|
||||||
fmsg.Fatalf("cannot serialise as JSON: %v", err)
|
fmsg.Fatalf("cannot serialise: %v", err)
|
||||||
panic("unreachable")
|
panic("unreachable")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user