diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-01-16 14:49:47 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-01-16 14:49:47 +0100 |
| commit | d538790b533961dc27ea57611e326f857747a4ee (patch) | |
| tree | a9ee8dd47b8e805dc3f4cf37f77d7c6968db635d /pkg | |
| parent | 025b20b5cb6f6a5ca25ac0c8895da3db047d654d (diff) | |
pkg/mgrconfig: do not serialize optional fields
Since we now show manager config on web page, make it leaner.
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/config/config.go | 1 | ||||
| -rw-r--r-- | pkg/mgrconfig/mgrconfig.go | 34 |
2 files changed, 18 insertions, 17 deletions
diff --git a/pkg/config/config.go b/pkg/config/config.go index 5502df765..49d030499 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -64,6 +64,7 @@ func checkUnknownFieldsRec(data []byte, prefix string, typ reflect.Type) error { for i := 0; i < typ.NumField(); i++ { field := typ.Field(i) tag := field.Tag.Get("json") + tag = strings.TrimSuffix(tag, ",omitempty") if tag == "-" { continue } diff --git a/pkg/mgrconfig/mgrconfig.go b/pkg/mgrconfig/mgrconfig.go index 595b2558b..e4c9efc0b 100644 --- a/pkg/mgrconfig/mgrconfig.go +++ b/pkg/mgrconfig/mgrconfig.go @@ -25,31 +25,31 @@ type Config struct { // TCP address to serve HTTP stats page (e.g. "localhost:50000"). HTTP string `json:"http"` // TCP address to serve RPC for fuzzer processes (optional). - RPC string `json:"rpc"` + RPC string `json:"rpc,omitempty"` Workdir string `json:"workdir"` // Directory with kernel object files. KernelObj string `json:"kernel_obj"` // Kernel source directory (if not set defaults to KernelObj). - KernelSrc string `json:"kernel_src"` + KernelSrc string `json:"kernel_src,omitempty"` // Arbitrary optional tag that is saved along with crash reports (e.g. branch/commit). - Tag string `json:"tag"` + Tag string `json:"tag,omitempty"` // Linux image for VMs. - Image string `json:"image"` + Image string `json:"image,omitempty"` // SSH key for the image (may be empty for some VM types). - SSHKey string `json:"sshkey"` + SSHKey string `json:"sshkey,omitempty"` // SSH user ("root" by default). - SSHUser string `json:"ssh_user"` + SSHUser string `json:"ssh_user,omitempty"` - HubClient string `json:"hub_client"` - HubAddr string `json:"hub_addr"` - HubKey string `json:"hub_key"` + HubClient string `json:"hub_client,omitempty"` + HubAddr string `json:"hub_addr,omitempty"` + HubKey string `json:"hub_key,omitempty"` // syz-manager will send crash emails to this list of emails using mailx (optional). - EmailAddrs []string `json:"email_addrs"` + EmailAddrs []string `json:"email_addrs,omitempty"` - DashboardClient string `json:"dashboard_client"` - DashboardAddr string `json:"dashboard_addr"` - DashboardKey string `json:"dashboard_key"` + DashboardClient string `json:"dashboard_client,omitempty"` + DashboardAddr string `json:"dashboard_addr,omitempty"` + DashboardKey string `json:"dashboard_key,omitempty"` // Path to syzkaller checkout (syz-manager will look for binaries in bin subdir). Syzkaller string `json:"syzkaller"` @@ -70,14 +70,14 @@ type Config struct { // Reproduce, localize and minimize crashers (default: true). Reproduce bool `json:"reproduce"` - EnabledSyscalls []string `json:"enable_syscalls"` - DisabledSyscalls []string `json:"disable_syscalls"` + EnabledSyscalls []string `json:"enable_syscalls,omitempty"` + DisabledSyscalls []string `json:"disable_syscalls,omitempty"` // Don't save reports matching these regexps, but reboot VM after them, // matched against whole report output. - Suppressions []string `json:"suppressions"` + Suppressions []string `json:"suppressions,omitempty"` // Completely ignore reports matching these regexps (don't save nor reboot), // must match the first line of crash message. - Ignores []string `json:"ignores"` + Ignores []string `json:"ignores,omitempty"` // VM type (qemu, gce, android, isolated, etc). Type string `json:"type"` |
