Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,32 @@
package main
import (
"bufio"
"fmt"
"log"
"os"
)
func main() {
lines := make(chan string)
count := make(chan int)
go func() {
c := 0
for l := range lines {
fmt.Println(l)
c++
}
count <- c
}()
f, err := os.Open("input.txt")
if err != nil {
log.Fatal(err)
}
for s := bufio.NewScanner(f); s.Scan(); {
lines <- s.Text()
}
f.Close()
close(lines)
fmt.Println("Number of lines:", <-count)
}