Skip to content

Commit

Permalink
style: misspells
Browse files Browse the repository at this point in the history
  • Loading branch information
WangYihang committed Apr 23, 2024
1 parent 5918763 commit b5712b4
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/complex-http-crawler/pkg/model/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/random-error/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()))
}
}()

Expand Down
2 changes: 1 addition & 1 deletion prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@ 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() {
defer fd.Close()
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()
Expand Down

0 comments on commit b5712b4

Please sign in to comment.