From b5712b4207f67b5b7260445db9ed2d0c2307691d Mon Sep 17 00:00:00 2001 From: Yihang Wang Date: Tue, 23 Apr 2024 21:36:51 +0800 Subject: [PATCH] style: misspells --- examples/complex-http-crawler/pkg/model/http.go | 2 +- examples/random-error/main.go | 2 +- pkg/runner/runner.go | 2 +- pkg/utils/io.go | 4 ++-- prometheus.go | 2 +- scheduler.go | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/complex-http-crawler/pkg/model/http.go b/examples/complex-http-crawler/pkg/model/http.go index b0f0bf1..a18d2d5 100644 --- a/examples/complex-http-crawler/pkg/model/http.go +++ b/examples/complex-http-crawler/pkg/model/http.go @@ -97,7 +97,7 @@ func NewHTTPResponse(resp *http.Response) (*HTTPResponse, error) { // Read response body body, err := io.ReadAll(resp.Body) if err != nil { - slog.Warn("error occured while reading response body", slog.String("error", err.Error())) + slog.Warn("error occurred while reading response body", slog.String("error", err.Error())) return httpResponse, nil } httpResponse.Body = body diff --git a/examples/random-error/main.go b/examples/random-error/main.go index 906c9f5..9b2ff96 100644 --- a/examples/random-error/main.go +++ b/examples/random-error/main.go @@ -25,7 +25,7 @@ func New(index int, sleepSeconds int) *MyTask { func (t *MyTask) Do() error { time.Sleep(time.Duration(t.SleepSeconds) * time.Second) if rand.Float64() < t.ErrorProbability { - return errors.New("an error occured") + return errors.New("an error occurred") } return nil } diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go index 7b485e6..ac94787 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -16,7 +16,7 @@ func init() { Runner = NewIPInfo() err := Runner.Get() if err != nil { - slog.Error("error occured while getting runner ip info", slog.String("error", err.Error())) + slog.Error("error occurred while getting runner ip info", slog.String("error", err.Error())) return } }) diff --git a/pkg/utils/io.go b/pkg/utils/io.go index 8b60b05..c733d73 100644 --- a/pkg/utils/io.go +++ b/pkg/utils/io.go @@ -71,7 +71,7 @@ func Cat(filePath string) <-chan string { // Open the file file, err := os.Open(filePath) if err != nil { - slog.Error("error occured while opening file", slog.String("path", filePath), slog.String("error", err.Error())) + slog.Error("error occurred while opening file", slog.String("path", filePath), slog.String("error", err.Error())) return // Close the channel and exit the goroutine } defer file.Close() @@ -83,7 +83,7 @@ func Cat(filePath string) <-chan string { // Check for errors during Scan, excluding EOF if err := scanner.Err(); err != nil { - slog.Error("error occured while reading file", slog.String("path", filePath), slog.String("error", err.Error())) + slog.Error("error occurred while reading file", slog.String("path", filePath), slog.String("error", err.Error())) } }() diff --git a/prometheus.go b/prometheus.go index 43874b0..6546387 100644 --- a/prometheus.go +++ b/prometheus.go @@ -69,7 +69,7 @@ func prometheusPusher(url, job string, statusChan <-chan Status, wg *sync.WaitGr if err := push.New(url, job).Grouping( "instance", instance, ).Gatherer(registry).Push(); err != nil { - slog.Error("error occured while pushing to prometheus", slog.String("error", err.Error())) + slog.Error("error occurred while pushing to prometheus", slog.String("error", err.Error())) } } wg.Done() diff --git a/scheduler.go b/scheduler.go index 885363c..d1b2083 100644 --- a/scheduler.go +++ b/scheduler.go @@ -227,7 +227,7 @@ func WithMetadataFilePath(path string) schedulerOption { func chanRecorder[T *basicTask | Status | schedulerMetadata](path string, ch <-chan T, wg *sync.WaitGroup) { fd, err := utils.OpenFile(path) if err != nil { - slog.Error("error occured while opening file", slog.String("path", path), slog.String("error", err.Error())) + slog.Error("error occurred while opening file", slog.String("path", path), slog.String("error", err.Error())) return } go func() { @@ -235,7 +235,7 @@ func chanRecorder[T *basicTask | Status | schedulerMetadata](path string, ch <-c encoder := json.NewEncoder(fd) for item := range ch { if err := encoder.Encode(item); err != nil { - slog.Error("error occured while serializing data", slog.String("path", path), slog.String("error", err.Error())) + slog.Error("error occurred while serializing data", slog.String("path", path), slog.String("error", err.Error())) } } wg.Done()