From 8095117313da96970c3ee300819ff6511b022fba Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 23 Apr 2019 16:54:45 +0300 Subject: all: fix some static analysis warnings Fix warnings produced by golangci-lint. Update #977 --- pkg/csource/options.go | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'pkg/csource') diff --git a/pkg/csource/options.go b/pkg/csource/options.go index 0a9539663..61094456f 100644 --- a/pkg/csource/options.go +++ b/pkg/csource/options.go @@ -56,45 +56,45 @@ func (opts Options) Check(OS string) error { } if !opts.Threaded && opts.Collide { // Collide requires threaded. - return errors.New("Collide without Threaded") + return errors.New("option Collide without Threaded") } if !opts.Repeat { if opts.Procs > 1 { // This does not affect generated code. - return errors.New("Procs>1 without Repeat") + return errors.New("option Procs>1 without Repeat") } if opts.EnableNetReset { - return errors.New("EnableNetReset without Repeat") + return errors.New("option EnableNetReset without Repeat") } if opts.RepeatTimes > 1 { - return errors.New("RepeatTimes without Repeat") + return errors.New("option RepeatTimes without Repeat") } } if opts.Sandbox == "" { if opts.EnableTun { - return errors.New("EnableTun without sandbox") + return errors.New("option EnableTun without sandbox") } if opts.EnableNetDev { - return errors.New("EnableNetDev without sandbox") + return errors.New("option EnableNetDev without sandbox") } if opts.EnableCgroups { - return errors.New("EnableCgroups without sandbox") + return errors.New("option EnableCgroups without sandbox") } if opts.EnableBinfmtMisc { - return errors.New("EnableBinfmtMisc without sandbox") + return errors.New("option EnableBinfmtMisc without sandbox") } } if opts.Sandbox == sandboxNamespace && !opts.UseTmpDir { // This is borken and never worked. // This tries to create syz-tmp dir in cwd, // which will fail if procs>1 and on second run of the program. - return errors.New("Sandbox=namespace without UseTmpDir") + return errors.New("option Sandbox=namespace without UseTmpDir") } if opts.EnableNetReset && (opts.Sandbox == "" || opts.Sandbox == sandboxSetuid) { - return errors.New("EnableNetReset without sandbox") + return errors.New("option EnableNetReset without sandbox") } if opts.EnableCgroups && !opts.UseTmpDir { - return errors.New("EnableCgroups without UseTmpDir") + return errors.New("option EnableCgroups without UseTmpDir") } return opts.checkLinuxOnly(OS) } @@ -104,19 +104,19 @@ func (opts Options) checkLinuxOnly(OS string) error { return nil } if opts.EnableTun && !(OS == openbsd || OS == freebsd) { - return fmt.Errorf("EnableTun is not supported on %v", OS) + return fmt.Errorf("option EnableTun is not supported on %v", OS) } if opts.EnableNetDev { - return fmt.Errorf("EnableNetDev is not supported on %v", OS) + return fmt.Errorf("option EnableNetDev is not supported on %v", OS) } if opts.EnableNetReset { - return fmt.Errorf("EnableNetReset is not supported on %v", OS) + return fmt.Errorf("option EnableNetReset is not supported on %v", OS) } if opts.EnableCgroups { - return fmt.Errorf("EnableCgroups is not supported on %v", OS) + return fmt.Errorf("option EnableCgroups is not supported on %v", OS) } if opts.EnableBinfmtMisc { - return fmt.Errorf("EnableBinfmtMisc is not supported on %v", OS) + return fmt.Errorf("option EnableBinfmtMisc is not supported on %v", OS) } if opts.EnableCloseFds { return fmt.Errorf("EnableCloseFds is not supported on %v", OS) @@ -124,10 +124,10 @@ func (opts Options) checkLinuxOnly(OS string) error { if opts.Sandbox == sandboxNamespace || (opts.Sandbox == sandboxSetuid && !(OS == openbsd || OS == freebsd)) || opts.Sandbox == sandboxAndroidUntrustedApp { - return fmt.Errorf("Sandbox=%v is not supported on %v", opts.Sandbox, OS) + return fmt.Errorf("option Sandbox=%v is not supported on %v", opts.Sandbox, OS) } if opts.Fault { - return fmt.Errorf("Fault is not supported on %v", OS) + return fmt.Errorf("option Fault is not supported on %v", OS) } return nil } -- cgit mrf-deployment