Skip to content

Commit

Permalink
Update io.go to send trimmed lines directly to the channel
Browse files Browse the repository at this point in the history
  • Loading branch information
WangYihang committed Aug 29, 2024
1 parent 3d48b32 commit e7537f8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/utils/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ func Cat(filePath string) <-chan string {

scanner := bufio.NewScanner(file.(io.Reader)) // Change the type of file to io.Reader
for scanner.Scan() {
line := scanner.Text()
slog.Info("reading line", slog.String("line", line))
out <- strings.TrimSpace(line) // Send the line to the channel
out <- strings.TrimSpace(scanner.Text()) // Send the line to the channel
}

// Check for errors during Scan, excluding EOF
Expand Down

0 comments on commit e7537f8

Please sign in to comment.