diff --git a/commands/discover.go b/commands/discover.go index 22964371..6b68e526 100644 --- a/commands/discover.go +++ b/commands/discover.go @@ -39,7 +39,7 @@ type DiscoverCmd struct { func (*DiscoverCmd) Name() string { return "discover" } // Synopsis return synopsis -func (*DiscoverCmd) Synopsis() string { return "Host discovery in the CIDR." } +func (*DiscoverCmd) Synopsis() string { return "Host discovery in the CIDR" } // Usage return usage func (*DiscoverCmd) Usage() string { @@ -77,7 +77,7 @@ func (p *DiscoverCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface } if len(hosts) < 1 { - logrus.Errorf("Active hosts not found in %s.", cidr) + logrus.Errorf("Active hosts not found in %s", cidr) return subcommands.ExitSuccess } else if err := printConfigToml(hosts); err != nil { logrus.Errorf("Failed to parse template. err: %s", err) diff --git a/commands/prepare.go b/commands/prepare.go index 50d83f32..79ef2643 100644 --- a/commands/prepare.go +++ b/commands/prepare.go @@ -121,7 +121,7 @@ func (p *PrepareCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{ logger.Info("Installing...") if errs := scan.Prepare(); 0 < len(errs) { for _, e := range errs { - logger.Errorf("Failed: %s.", e) + logger.Errorf("Failed: %s", e) } return subcommands.ExitFailure } diff --git a/commands/scan.go b/commands/scan.go index bf6a4fb2..1764aa11 100644 --- a/commands/scan.go +++ b/commands/scan.go @@ -57,7 +57,7 @@ type ScanCmd struct { func (*ScanCmd) Name() string { return "scan" } // Synopsis return synopsis -func (*ScanCmd) Synopsis() string { return "Scan vulnerabilities." } +func (*ScanCmd) Synopsis() string { return "Scan vulnerabilities" } // Usage return usage func (*ScanCmd) Usage() string { @@ -202,7 +202,7 @@ func (p *ScanCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) Log.Info("Scanning vulnerabilities... ") if errs := scan.Scan(); 0 < len(errs) { for _, e := range errs { - Log.Errorf("Failed to scan. err: %s.", e) + Log.Errorf("Failed to scan. err: %s", e) } return subcommands.ExitFailure } diff --git a/commands/tui.go b/commands/tui.go index de3a6212..927c29f6 100644 --- a/commands/tui.go +++ b/commands/tui.go @@ -39,7 +39,7 @@ type TuiCmd struct { func (*TuiCmd) Name() string { return "tui" } // Synopsis return synopsis -func (*TuiCmd) Synopsis() string { return "Run Tui view to anayze vulnerabilites." } +func (*TuiCmd) Synopsis() string { return "Run Tui view to anayze vulnerabilites" } // Usage return usage func (*TuiCmd) Usage() string { diff --git a/config/tomlloader.go b/config/tomlloader.go index a43b4b44..3339ade6 100644 --- a/config/tomlloader.go +++ b/config/tomlloader.go @@ -34,7 +34,7 @@ type TOMLLoader struct { func (c TOMLLoader) Load(pathToToml string) (err error) { var conf Config if _, err := toml.DecodeFile(pathToToml, &conf); err != nil { - log.Error("Load config failed.", err) + log.Error("Load config failed", err) return err } @@ -91,7 +91,7 @@ func (c TOMLLoader) Load(pathToToml string) (err error) { servers[name] = s } - log.Debug("Config loaded.") + log.Debug("Config loaded") log.Debugf("%s", pp.Sprintf("%v", servers)) Conf.Servers = servers return diff --git a/db/db.go b/db/db.go index 7ba2c556..3bc1d2a1 100644 --- a/db/db.go +++ b/db/db.go @@ -226,7 +226,7 @@ func SelectLatestScanHistory() (m.ScanHistory, error) { db.Order("scanned_at desc").First(&scanHistory) if scanHistory.ID == 0 { - return m.ScanHistory{}, fmt.Errorf("No scanHistory records.") + return m.ScanHistory{}, fmt.Errorf("No scanHistory records") } results := []m.ScanResult{} diff --git a/scan/debian.go b/scan/debian.go index 27a0ace5..ff644408 100644 --- a/scan/debian.go +++ b/scan/debian.go @@ -346,7 +346,7 @@ func (o *debian) fillCandidateVersion(packs []models.PackageInfo) ([]models.Pack case err := <-errChan: return nil, err case <-timeout: - return nil, fmt.Errorf("Timeout fillCandidateVersion.") + return nil, fmt.Errorf("Timeout fillCandidateVersion") } } return result, nil @@ -500,7 +500,7 @@ func (o *debian) scanPackageCveInfos(unsecurePacks []models.PackageInfo) (cvePac return nil, err } case <-timeout: - return nil, fmt.Errorf("Timeout scanPackageCveIds.") + return nil, fmt.Errorf("Timeout scanPackageCveIds") } } diff --git a/scan/debian_test.go b/scan/debian_test.go index c01d33ca..98d8f8b0 100644 --- a/scan/debian_test.go +++ b/scan/debian_test.go @@ -199,7 +199,7 @@ util-linux (2.26.2-6) unstable; urgency=medium`, for _, tt := range tests { _, err := d.getCveIDParsingChangelog(tt.in[2], tt.in[0], "version number do'nt match case") if err != nil { - t.Errorf("Returning error is unexpected.") + t.Errorf("Returning error is unexpected") } } } @@ -504,7 +504,7 @@ Calculating upgrade... Done for _, tt := range tests { actual, err := d.parseAptGetUpgrade(tt.in) if err != nil { - t.Errorf("Returning error is unexpected.") + t.Errorf("Returning error is unexpected") } if len(tt.expected) != len(actual) { t.Errorf("Result length is not as same as expected. expected: %d, actual: %d", len(tt.expected), len(actual)) diff --git a/scan/redhat.go b/scan/redhat.go index 60b146a8..0d80fcf5 100644 --- a/scan/redhat.go +++ b/scan/redhat.go @@ -160,7 +160,7 @@ func (o *redhat) installYumChangelog() error { cmd := "rpm -q " + packName if r := o.ssh(cmd, noSudo); r.isSuccess() { - o.log.Infof("Ignored: %s already installed.", packName) + o.log.Infof("Ignored: %s already installed", packName) return nil } @@ -170,7 +170,7 @@ func (o *redhat) installYumChangelog() error { "Failed to install %s. status: %d, stdout: %s, stderr: %s", packName, r.ExitStatus, r.Stdout, r.Stderr) } - o.log.Infof("Installed: %s.", packName) + o.log.Infof("Installed: %s", packName) } return nil } diff --git a/scan/serverapi.go b/scan/serverapi.go index 5d19e39b..dda7bc0b 100644 --- a/scan/serverapi.go +++ b/scan/serverapi.go @@ -130,7 +130,7 @@ func detectServersOS() (osi []osTypeInterface, err error) { case res := <-osTypeChan: osi = append(osi, res) case <-timeout: - Log.Error("Timeout occured while detecting OS.") + Log.Error("Timeout occured while detecting OS") err = fmt.Errorf("Timeout!") return } @@ -151,7 +151,7 @@ func Prepare() []error { // Scan scan func Scan() []error { if len(servers) == 0 { - return []error{fmt.Errorf("Not initialized yet.")} + return []error{fmt.Errorf("Not initialized yet")} } Log.Info("Check required packages for scanning...") @@ -201,7 +201,7 @@ func GetScanResults() (results models.ScanResults, err error) { for _, s := range servers { r, err := s.convertToModel() if err != nil { - return results, fmt.Errorf("Failed converting to model: %s.", err) + return results, fmt.Errorf("Failed converting to model: %s", err) } results = append(results, r) } diff --git a/scan/sshutil.go b/scan/sshutil.go index 3e8e6820..e0da16d0 100644 --- a/scan/sshutil.go +++ b/scan/sshutil.go @@ -94,11 +94,11 @@ func parallelSSHExec(fn func(osTypeInterface) error, timeoutSec ...int) (errs [] if err != nil { errs = append(errs, err) } else { - logrus.Debug("Parallel SSH Success.") + logrus.Debug("Parallel SSH Success") } case <-time.After(time.Duration(timeout) * time.Second): - logrus.Errorf("Parallel SSH Timeout.") - errs = append(errs, fmt.Errorf("Timed out!")) + logrus.Errorf("Parallel SSH Timeout") + errs = append(errs, fmt.Errorf("Timed out")) } } return