mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
tailcfg: add omitempty to all fields of Hostinfo (#4360)
This reduces the noise when marshaling only a subset of this type. Signed-off-by: Joe Tsai <joetsai@digital-static.net>
This commit is contained in:
@@ -217,7 +217,7 @@ func TestJSON(t *testing.T) {
|
||||
var buf bytes.Buffer
|
||||
var logf Logf = func(f string, a ...any) { fmt.Fprintf(&buf, f, a...) }
|
||||
logf.JSON(1, "foo", &tailcfg.Hostinfo{})
|
||||
want := "[v\x00JSON]1" + `{"foo":{"OS":"","Hostname":""}}`
|
||||
want := "[v\x00JSON]1" + `{"foo":{}}`
|
||||
if got := buf.String(); got != want {
|
||||
t.Errorf("mismatch\n got: %q\nwant: %q\n", got, want)
|
||||
}
|
||||
|
Reference in New Issue
Block a user