diff --git a/internal/commands/root.go b/internal/commands/root.go index dd11bfed9..58951f8d3 100644 --- a/internal/commands/root.go +++ b/internal/commands/root.go @@ -120,7 +120,7 @@ func doStartupChecks(config *schema.Configuration, providers *middlewares.Provid } } -func doStartupCheck(logger *logrus.Logger, name string, provider models.StartupCheck, disabled bool) (err error) { +func doStartupCheck(logger *logrus.Logger, name string, provider models.StartupCheck, disabled bool) error { if disabled { logger.Debugf("%s provider: startup check skipped as it is disabled", name) return nil @@ -130,9 +130,5 @@ func doStartupCheck(logger *logrus.Logger, name string, provider models.StartupC return fmt.Errorf("unrecognized provider or it is not configured properly") } - if err = provider.StartupCheck(); err != nil { - return err - } - - return nil + return provider.StartupCheck() } diff --git a/internal/commands/storage_run.go b/internal/commands/storage_run.go index 87a382051..953f9b01c 100644 --- a/internal/commands/storage_run.go +++ b/internal/commands/storage_run.go @@ -33,10 +33,8 @@ func storagePersistentPreRunE(cmd *cobra.Command, _ []string) (err error) { sources = append(sources, configuration.NewYAMLFileSource(configFile)) } - } else { - if _, err := os.Stat(configs[0]); err == nil { - sources = append(sources, configuration.NewYAMLFileSource(configs[0])) - } + } else if _, err := os.Stat(configs[0]); err == nil { + sources = append(sources, configuration.NewYAMLFileSource(configs[0])) } mapping := map[string]string{ diff --git a/internal/notification/file_notifier.go b/internal/notification/file_notifier.go index fe3c555fb..b89242974 100644 --- a/internal/notification/file_notifier.go +++ b/internal/notification/file_notifier.go @@ -38,22 +38,12 @@ func (n *FileNotifier) StartupCheck() (err error) { } } - if err := os.WriteFile(n.path, []byte(""), fileNotifierMode); err != nil { - return err - } - - return nil + return os.WriteFile(n.path, []byte(""), fileNotifierMode) } // Send send a identity verification link to a user. func (n *FileNotifier) Send(recipient, subject, body, _ string) error { content := fmt.Sprintf("Date: %s\nRecipient: %s\nSubject: %s\nBody: %s", time.Now(), recipient, subject, body) - err := os.WriteFile(n.path, []byte(content), fileNotifierMode) - - if err != nil { - return err - } - - return nil + return os.WriteFile(n.path, []byte(content), fileNotifierMode) } diff --git a/internal/notification/smtp_notifier.go b/internal/notification/smtp_notifier.go index 06a020d9f..465dffdc9 100644 --- a/internal/notification/smtp_notifier.go +++ b/internal/notification/smtp_notifier.go @@ -243,11 +243,7 @@ func (n *SMTPNotifier) StartupCheck() (err error) { return err } - if err := n.client.Reset(); err != nil { - return err - } - - return nil + return n.client.Reset() } // Send is used to send an email to a recipient. diff --git a/internal/suites/utils.go b/internal/suites/utils.go index 1c6b66b2a..7f0ea6855 100644 --- a/internal/suites/utils.go +++ b/internal/suites/utils.go @@ -54,7 +54,7 @@ func (rs *RodSession) collectScreenshot(err error, page *rod.Page) { build := os.Getenv("BUILDKITE_BUILD_NUMBER") suite := strings.ToLower(os.Getenv("SUITE")) job := os.Getenv("BUILDKITE_JOB_ID") - path := filepath.Join(fmt.Sprintf("%s/%s/%s/%s", base, build, suite, job)) //nolint: gocritic + path := filepath.Join(base, build, suite, job) if err := os.MkdirAll(path, 0755); err != nil { log.Fatal(err) diff --git a/internal/utils/const.go b/internal/utils/const.go index 4c1ee05e6..bb649256e 100644 --- a/internal/utils/const.go +++ b/internal/utils/const.go @@ -33,7 +33,7 @@ const ( const ( // Hour is an int based representation of the time unit. - Hour = time.Minute * 60 //nolint: revive + Hour = time.Minute * 60 //nolint:revive // Day is an int based representation of the time unit. Day = Hour * 24